MyBB Community Forums
Additional Usergroup Images - Broken Images - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Support (https://community.mybb.com/forum-72.html)
+---- Thread: Additional Usergroup Images - Broken Images (/thread-113776.html)



Additional Usergroup Images - Broken Images - Lost Eventide - 2012-02-20

Hi there! Hopefully someone here can help me. I recently installed the Additional Usergroup Images plugin on my forum, and it works great except for one thing: the additional usergroup images are broken.

Now, I figured out why they are. I use {theme} in my usergroup image url paths seeing I'm intending on having multiple skins where the usergroup images will not match, and {theme} gets replaced in the primary usergroup with the appropriate path, but the additional images do not replace {theme} when displayed.

Is there any way to add something to the coding so that {theme} does get replaced by the appropriate path when it is rendered?

Thanks in advance for any help!


RE: Additional Usergroup Images - Broken Images - cfillion - 2012-02-20

Do you need additional user groups to be displayed in postbit?
If no (just in user profile), I made a plugin for that with the same bug (see signature). I'll update it tonight.

EDIT: Fixed.


RE: Additional Usergroup Images - Broken Images - Lost Eventide - 2012-02-21

Yeah, I want the additional usergroups in the postbit as well. My forum's a role-play one, and the characters will have the option to join "guilds" (additional groups), which I'd like to be a bit more publicly displayed than just on the user profile xD

Though if no one can offer a fix for the postbit I'll definitely look into your plugin =3 At least the guilds would be displayed somewhere xD


RE: Additional Usergroup Images - Broken Images - cfillion - 2012-02-21

You can easily fix yourself:
  1. Open "aui.php" file.
  2. Replace aui_profile function with:
    function aui_profile()
    {
    	global $templates, $theme, $xfire, $memprofile, $mybb, $db, $memprofile, $gi;
    	$gids = $memprofile['additionalgroups'];
    	$gids = explode(",",$gids);
    	$gi = "";
    	
    	if(!empty($mybb->user['language']))
    	{
    		$language = $mybb->user['language'];
    	}
    	else
    	{
    		$language = $mybb->settings['bblanguage'];
    	}
    	
    	foreach($gids as $gid)
    	{
    		$getaui=$db->query("SELECT image FROM ".TABLE_PREFIX."usergroups WHERE gid='".$gid."'");
    		$getaui=$db->fetch_array($getaui);
    		$aui = $getaui['image'];
    		
    		if($aui != "")
    		{
    			$aui = str_replace("{lang}", $language, $aui);
    			$aui = str_replace("{theme}", $theme['imgdir'], $aui);
    			$gi = $gi."<img src='$aui' /><br />";
    		}
    	}
    }
  3. Replace aui_post function with:
    function aui_post($post)
    {
    	global $templates, $theme, $xfire, $memprofile, $mybb, $db, $auigi, $gi, $aui, $memprofile;
    	$gids = $post['additionalgroups'];
    	$gids = explode(",",$gids);
    	$gi = "";
    	
    	if(!empty($mybb->user['language']))
    	{
    		$language = $mybb->user['language'];
    	}
    	else
    	{
    		$language = $mybb->settings['bblanguage'];
    	}
    	
    	foreach($gids as $gid)
    	{
    		$getaui = $db->query("SELECT image FROM ".TABLE_PREFIX."usergroups WHERE gid='".$gid."'");
    		$getaui = $db->fetch_array($getaui);
    		$aui = $getaui['image'];
    		if($aui != "")
    		{
    			$aui = str_replace("{lang}", $language, $aui);
    			$aui = str_replace("{theme}", $theme['imgdir'], $aui);
    			
    			if($mybb->user['classicpostbit'] == 1)
    			{
    				$post['groupimage'] = $post['groupimage']."<img src='$aui' /><br />";
    			}
    			else
    			{
    				$post['groupimage'] = $post['groupimage']."<br /><img src='$aui' />";
    			}
    		}	
    	}
    }
  4. Save. Smile
It is also XHTML compliant now.


RE: Additional Usergroup Images - Broken Images - Lost Eventide - 2012-02-21

Sweet! That worked like I charm =3

Thanks so much for your help <3 I really appreciate it.


RE: Additional Usergroup Images - Broken Images - foxxie - 2012-06-19

Hey there!

I had/have the same problem like Lost Eventide. After finding this thread I could fix the profile at least. The group images are finally there. But even after editing the plugin for the posts nothing changes. Any ideas? I use the default templates for a new design, so there is everything at its proper place and nothing changed there, yet.

Thx



Edit: I found something after a few more hours auf searching (found it in the reviews:

Solution is to open aui.php and change

function aui_post($post)

to

function aui_post(&$post)



RE: Additional Usergroup Images - Broken Images - melancholia - 2013-07-06

Is it possible to separate these two images like in the profile where you are able to move the additional picture with the variable {$gi}.

Edit: And it would be nice if the additional usergroup is also shown on memberlist.