Jump to content

Hello - Only takes 5 minutes I think?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
SuperSponge

SuperSponge

    Learning Programmer

  • Members
  • PipPipPip
  • 35 posts
Hello,

I recently installed a Mod on my Mybb forum and this mod was suppose to show more than 1 rank and it did but I don't like the layout. If you check out Who are the Staff and what do they do? - You see the ranks stack under each other? I want them to stack beside each others.


Php Code


<?php

/*

# Show Additional Group Images plugin

# PLUGIN BY DVDXSEO (http://ptm.altervista.org/forum/)

# You're not allowed to redistribute it without my permissions. 

# Free for non commercial purposes!

# You can edit the code but you must keep my credits.

*/

if(!defined("IN_MYBB")){

	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");

}

$plugins->add_hook("postbit", "images_postbit");

$plugins->add_hook("member_profile_end", "images_profile");

$plugins->add_hook("admin_user_groups_edit_commit", "images_editgroup");


function additionalimg_info(){

	global $lang;

	$lang->load("additionalimg");

	return array(

		'name'			=> 'Show Additional Group Images',

		'description'	=> $lang->agi_descr,

		'website'		=> 'http://ptm.altervista.org/forum',

		'author'		=> 'Dvdxseo',

		'authorsite'	=> 'http://ptm.altervista.org/forum',

		'version'		=> '1.0',

		'guid'			=> 'bab9eaae39210fd31d6c31c4fe4c9baf'

	);

}

function additionalimg_activate(){

    global $db,$lang;

	$lang->load("additionalimg");

	$db->write_query("ALTER TABLE `".TABLE_PREFIX."usergroups` ADD `targhetta` INT( 2 ) NOT NULL DEFAULT '0'");

    $group = array(

        "gid"            => "NULL",

        "title"          => "Additional Group Images",

        "name"           => "additionalimg_group",

        "description"    => $lang->setting_descr,

        "disporder"      => "1",

        "isdefault"      => "0",

    );

    

    $db->insert_query("settinggroups", $group);

    $gid = $db->insert_id();

    

    

    $setting_1 = array(

        "sid"            => "NULL",

        "name"           => "additionalimg_postbit",

        "title"          => $lang->postbit_title,

        "description"    => $lang->postbit_descr,

        "optionscode"    => "yesno",

        "value"          => 'yes',

        "disporder"      => '1',

        "gid"            => intval($gid),

    );


    $db->insert_query("settings", $setting_1);

    $setting_2 = array(

        "sid"            => "NULL",

        "name"           => "additionalimg_profile",

        "title"          => $lang->member_title,

        "description"    => $lang->member_descr,

        "optionscode"    => "yesno",

        "value"          => 'yes',

        "disporder"      => '1',

        "gid"            => intval($gid),

    );


    $db->insert_query("settings", $setting_2);	


    rebuild_settings();

}

function additionalimg_deactivate(){

    global $db;

	

	$db->write_query("ALTER TABLE ".TABLE_PREFIX."usergroups DROP targhetta");

    $db->write_query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='additionalimg_group'");

    $db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='additionalimg_postbit'");

    $db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='additionalimg_profile'");	

    rebuild_settings();

} 


function images_postbit($post){	

	global $mybb;


	if($mybb->settings['additionalimg_postbit']){

		$additionalimg = getimagesgroups($post);

		if($additionalimg)

		{

			$post['groupimage'] = $post['groupimage'].$additionalimg;

		}

	}

}

function images_profile(){	

	global $mybb, $memprofile, $groupimage;


	if($mybb->settings['additionalimg_profile']){

		$additionalimg = getimagesgroups($memprofile);

		if($additionalimg)

		{

			$groupimage = $groupimage.$additionalimg."<br />";

		}

	}

}

function images_editgroup()

{

	global $mybb, $updated_group;

	$updated_group['targhetta'] = intval($mybb->input['targhetta']);

}

function getimagesgroups($post){

	global $cache, $theme, $mybb;


	$usergroups = $cache->read("usergroups");

	$groups = explode(',',$post['additionalgroups']);

	$additionalimg="";

	foreach($groups as $group){

		if($mybb->settings['postlayout'] == "classic"){

			$br = "<br />";

			}else{

			$br = " ";

			}

		$groupname=$usergroups[$group]['title'];

		$groupimages=$usergroups[$group]['image'];

		$groupdisplay=$usergroups[$group]['targhetta'];

		if(!empty($groupimages)){

			if($groupimages == $usergroups[$post['usergroup']]['image']){

				continue;

			}

			if(strpos($groupimages, "{lang}")!==false){	// Replace {lang} with the right var

				if(!empty($mybb->user['language'])){ // Check user lang 

					$language = $mybb->user['language'];

				}else{

					$language = $mybb->settings['bblanguage'];

				}

				$groupimages = str_replace("{lang}", $language, $groupimages); // Now Replace {lang}......

				$groupimages = str_replace("{theme}", $theme['imgdir'], $groupimages); // ..... and {theme}

			}

			if(!strstr($additionalimg, $groupimages)){

				if($groupdisplay){

					if($groupimages == $usergroups[$post['displaygroup']]['image']){

						$additionalimg .= $br."<img src=\"{$usergroups[$post['usergroup']]['image']}\">";

					}else{	

					continue;

					}

				/*}elseif($groupdisplay && $groupimages == $usergroups[$post['displaygroup']]['image']){

					$additionalimg .= "".$br."<img src=\"{$usergroups[$post['usergroup']]['image']}\">";

				*/}else{

					if($groupimages == $usergroups[$post['displaygroup']]['image']){

						// We don't want double images!

						$additionalimg .= "<img src=\"{$usergroups[$post['usergroup']]['image']}\">".$br;

					}else{

						$additionalimg .= "<img src=\"".$groupimages."\" alt=\"".$groupname."\">".$br;

					}

				}

			}

		}

	}

	return $additionalimg;

}

?>


#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
My guess is that there is a setting that allows you to change it from a "classic" view which uses <br /> to separate the names to something else that uses   to separate the name.

#3
SuperSponge

SuperSponge

    Learning Programmer

  • Members
  • PipPipPip
  • 35 posts
Wow.. Co-Admin reply? LOL nice.


Anyways, there is no option related to that. The only option is adding/showing the default user group as another rank but there was this other file that was included.

<?php
/*
# English Language Pack
# For the plugin
# Show additional group images
# Powered by Dvdxseo.
*/
$l['agi_descr'] = "Displays the groupimages of the users\' additional groups";
$l['setting_descr'] = "Settings for the plugin \"Show Additional Group Images\".";
$l['postbit_title'] = "Show Images in Postbit";
$l['postbit_descr'] = "Do you want to show additional groupimages in the postbit?";
$l['member_title'] = "Show Images in Profile";
$l['member_descr'] = "Do you want to show additional groupimages in members\' profile?";
$l['targhetta'] = "GroupImage Options";
$l['targhetta_descr'] = "";
$l['targhetta_check'] = "Yes, show the image only if this group is set as displayed";
?>


#4
DEViANT

DEViANT

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 358 posts
<?php
/*
# Show Additional Group Images plugin
# PLUGIN BY DVDXSEO (http://ptm.altervista.org/forum/)
# You're not allowed to redistribute it without my permissions. 
# Free for non commercial purposes!
# You can edit the code but you must keep my credits.
*/
if(!defined("IN_MYBB")){
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("postbit", "images_postbit");
$plugins->add_hook("member_profile_end", "images_profile");
$plugins->add_hook("admin_user_groups_edit_commit", "images_editgroup");

function additionalimg_info(){
    global $lang;
    $lang->load("additionalimg");
    return array(
        'name'            => 'Show Additional Group Images',
        'description'    => $lang->agi_descr,
        'website'        => 'http://ptm.altervista.org/forum',
        'author'        => 'Dvdxseo',
        'authorsite'    => 'http://ptm.altervista.org/forum',
        'version'        => '1.0',
        'guid'            => 'bab9eaae39210fd31d6c31c4fe4c9baf'
    );
}
function additionalimg_activate(){
    global $db,$lang;
    $lang->load("additionalimg");
    $db->write_query("ALTER TABLE `".TABLE_PREFIX."usergroups` ADD `targhetta` INT( 2 ) NOT NULL DEFAULT '0'");
    $group = array(
        "gid"            => "NULL",
        "title"          => "Additional Group Images",
        "name"           => "additionalimg_group",
        "description"    => $lang->setting_descr,
        "disporder"      => "1",
        "isdefault"      => "0",
    );
    
    $db->insert_query("settinggroups", $group);
    $gid = $db->insert_id();
    
    
    $setting_1 = array(
        "sid"            => "NULL",
        "name"           => "additionalimg_postbit",
        "title"          => $lang->postbit_title,
        "description"    => $lang->postbit_descr,
        "optionscode"    => "yesno",
        "value"          => 'yes',
        "disporder"      => '1',
        "gid"            => intval($gid),
    );

    $db->insert_query("settings", $setting_1);
    $setting_2 = array(
        "sid"            => "NULL",
        "name"           => "additionalimg_profile",
        "title"          => $lang->member_title,
        "description"    => $lang->member_descr,
        "optionscode"    => "yesno",
        "value"          => 'yes',
        "disporder"      => '1',
        "gid"            => intval($gid),
    );

    $db->insert_query("settings", $setting_2);    

    rebuild_settings();
}
function additionalimg_deactivate(){
    global $db;
    
    $db->write_query("ALTER TABLE ".TABLE_PREFIX."usergroups DROP targhetta");
    $db->write_query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='additionalimg_group'");
    $db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='additionalimg_postbit'");
    $db->write_query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='additionalimg_profile'");    
    rebuild_settings();
} 

function images_postbit($post){    
    global $mybb;

    if($mybb->settings['additionalimg_postbit']){
        $additionalimg = getimagesgroups($post);
        if($additionalimg)
        {
            $post['groupimage'] = $post['groupimage'].$additionalimg;
        }
    }
}
function images_profile(){    
    global $mybb, $memprofile, $groupimage;

    if($mybb->settings['additionalimg_profile']){
        $additionalimg = getimagesgroups($memprofile);
        if($additionalimg)
        {
            $groupimage = $groupimage.$additionalimg."<br />";
        }
    }
}
function images_editgroup()
{
    global $mybb, $updated_group;
    $updated_group['targhetta'] = intval($mybb->input['targhetta']);
}
function getimagesgroups($post){
    global $cache, $theme, $mybb;

    $usergroups = $cache->read("usergroups");
    $groups = explode(',',$post['additionalgroups']);
    $additionalimg="";
    foreach($groups as $group){
        if($mybb->settings['postlayout'] == "classic"){
            $br = " ";
            }else{
            $br = "<br />";
            }
        $groupname=$usergroups[$group]['title'];
        $groupimages=$usergroups[$group]['image'];
        $groupdisplay=$usergroups[$group]['targhetta'];
        if(!empty($groupimages)){
            if($groupimages == $usergroups[$post['usergroup']]['image']){
                continue;
            }
            if(strpos($groupimages, "{lang}")!==false){    // Replace {lang} with the right var
                if(!empty($mybb->user['language'])){ // Check user lang 
                    $language = $mybb->user['language'];
                }else{
                    $language = $mybb->settings['bblanguage'];
                }
                $groupimages = str_replace("{lang}", $language, $groupimages); // Now Replace {lang}......
                $groupimages = str_replace("{theme}", $theme['imgdir'], $groupimages); // ..... and {theme}
            }
            if(!strstr($additionalimg, $groupimages)){
                if($groupdisplay){
                    if($groupimages == $usergroups[$post['displaygroup']]['image']){
                        $additionalimg .= $br."<img src=\"{$usergroups[$post['usergroup']]['image']}\">";
                    }else{    
                    continue;
                    }
                /*}elseif($groupdisplay && $groupimages == $usergroups[$post['displaygroup']]['image']){
                    $additionalimg .= "".$br."<img src=\"{$usergroups[$post['usergroup']]['image']}\">";
                */}else{
                    if($groupimages == $usergroups[$post['displaygroup']]['image']){
                        // We don't want double images!
                        $additionalimg .= "<img src=\"{$usergroups[$post['usergroup']]['image']}\">".$br;
                    }else{
                        $additionalimg .= "<img src=\"".$groupimages."\" alt=\"".$groupname."\">".$br;
                    }
                }
            }
        }
    }
    return $additionalimg;
}
?> 

Try that?

:D You should rep+ me so that I can win :D

My Blog | Ask me!
Error : Satan did it

#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
My thinking comes from this snippet of code:
if($mybb->settings['postlayout'] == "classic"){ 
            $br = "<br />"; 
            }else{ 
            $br = " "; 
            } 
To "hack" it, what you will need to do, is replace one of the <br /> (break) with an   (non breaking space).
I would probably replace one <br /> at a time and undo the changes if it doesn't *appear* to do anything.

#6
SuperSponge

SuperSponge

    Learning Programmer

  • Members
  • PipPipPip
  • 35 posts
Deviant, I tried your code and it didn't work. John I tried and it didn't work:

if($mybb->settings['postlayout'] == "classic"){ 

            $br = " "; 

            }else{ 

            $br = " "; 

            }  


#7
DEViANT

DEViANT

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 358 posts
Does myBB use a template system?

:D You should rep+ me so that I can win :D

My Blog | Ask me!
Error : Satan did it

#8
SuperSponge

SuperSponge

    Learning Programmer

  • Members
  • PipPipPip
  • 35 posts
Ooh I think you are on to something. They have postbit templates and when I expand it I see the following templates that I can edit and postbit_classic comes up in green meaning it's edited:


Quote

postbit
Full Edit
Diff Report
Revert to Original
Options
postbit_attachments
Full Edit
Options
postbit_attachments_attachment
Full Edit
Options
postbit_attachments_attachment_unapproved
Full Edit
Options
postbit_attachments_images
Full Edit
Options
postbit_attachments_images_image
Full Edit
Options
postbit_attachments_thumbnails
Full Edit
Options
postbit_attachments_thumbnails_thumbnail
Full Edit
Options
postbit_author_guest
Full Edit
Options
postbit_author_user
Full Edit
Options
postbit_avatar
Full Edit
Options
postbit_away
Full Edit
Options
postbit_classic
Full Edit
Diff Report
Revert to Original
Options
postbit_delete_pm
Full Edit
Options
postbit_edit
Full Edit
Options
postbit_editedby
Full Edit
Options
postbit_email
Full Edit
Options
postbit_find
Full Edit
Options
postbit_forward_pm
Full Edit
Options
postbit_gotopost
Full Edit
Options
postbit_groupimage
Full Edit
Options
postbit_ignored
Full Edit
Options
postbit_inlinecheck
Full Edit
Options
postbit_iplogged_hiden
Full Edit
Options
postbit_iplogged_show
Full Edit
Options
postbit_multiquote
Full Edit
Options
postbit_offline
Full Edit
Options
postbit_online
Full Edit
Options
postbit_pm
Full Edit
Options
postbit_posturl
Full Edit
Options
postbit_quickdelete
Full Edit
Options
postbit_quote
Full Edit
Options
postbit_rep_button
Full Edit
Options
postbit_reply_pm
Full Edit
Options
postbit_replyall_pm
Full Edit
Options
postbit_report
Full Edit
Options
postbit_reputation
Full Edit
Options
postbit_signature
Full Edit
Options
postbit_warn
Full Edit
Options
postbit_warninglevel
Full Edit
Options
postbit_www