Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Scareface in Juni 12, 2013, 11:28:34 NACHMITTAGS

Titel: Group Images Instead of Names
Beitrag von: Scareface in Juni 12, 2013, 11:28:34 NACHMITTAGS
Hey guys, this is a simple trick to display group images. This method does not involve adding the image directly in the name. If you add an image in the group name, it messes up the whole forum. so this method doesn't cause any error and you can use this method anywhere. Now I will show how to use this in display template,

Previews:







Now, this only appears in posts but you can also make it to appear in profiles and other pages using this simple edit.
Titel: Re: Group Images Instead of Names
Beitrag von: kat in Juni 13, 2013, 07:21:24 VORMITTAG
As this is a tip/trick, mind if I move it to the... er... "Tips and tricks" board?
Titel: Re: Group Images Instead of Names
Beitrag von: Scareface in Juni 13, 2013, 07:31:15 VORMITTAG
Zitat von: K@ in Juni 13, 2013, 07:21:24 VORMITTAG
As this is a tip/trick, mind if I move it to the... er... "Tips and tricks" board?

Sure.
Titel: Re: Group Images Instead of Names
Beitrag von: kat in Juni 13, 2013, 07:52:50 VORMITTAG
Titel: Re: Group Images Instead of Names
Beitrag von: Burke ♞ Knight in Juni 22, 2013, 05:56:02 NACHMITTAGS
Just what do you edit for the Profile page to show right?
I got the display and private message pages done. :)
Titel: Re: Group Images Instead of Names
Beitrag von: Scareface in Juni 22, 2013, 09:42:21 NACHMITTAGS
Profile.template.php. Edit there to display images in profiles.
Titel: Re: Group Images Instead of Names
Beitrag von: Burke ♞ Knight in Juni 22, 2013, 10:07:03 NACHMITTAGS
I looked there and did not find the code you showed.
Do you have the exact line to find and replace with?
Titel: Re: Group Images Instead of Names
Beitrag von: Scareface in Juni 22, 2013, 11:16:26 NACHMITTAGS
Zitat von: BurkeKnight in Juni 22, 2013, 10:07:03 NACHMITTAGS
I looked there and did not find the code you showed.
Do you have the exact line to find and replace with?

This needs a little modification to be done.

Find this.

<span class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</span>

Replace with

<img src="http://YOURWEBSITE.com/ranks/', $context['member']['group_id'], '.png">
Titel: Re: Group Images Instead of Names
Beitrag von: Burke ♞ Knight in Juni 22, 2013, 11:38:31 NACHMITTAGS
Thank you very much, my friend.
I've been so backlogged, I'm just now getting around to going through emails from 2008....LOL
Worked perfectly. :)


P.S. You really should make this a mod.
Titel: Re: Group Images Instead of Names
Beitrag von: Scareface in Juni 22, 2013, 11:59:30 NACHMITTAGS
Zitat von: BurkeKnight in Juni 22, 2013, 11:38:31 NACHMITTAGS
Thank you very much, my friend.
I've been so backlogged, I'm just now getting around to going through emails from 2008....LOL
Worked perfectly. :)


P.S. You really should make this a mod.

This is just 1 line coding, so can be easily edited :)
Titel: Re: Group Images Instead of Names
Beitrag von: Burke ♞ Knight in Juni 23, 2013, 06:12:07 VORMITTAG
I was just thinking for those people with about 3-4 or more sites.... LOL :P
Titel: Re: Group Images Instead of Names
Beitrag von: Scareface in Juni 23, 2013, 06:45:53 VORMITTAG
Zitat von: BurkeKnight in Juni 23, 2013, 06:12:07 VORMITTAG
I was just thinking for those people with about 3-4 or more sites.... LOL :P

Ill make this as a mod. Need to learn more about creating a mod :P
Titel: Re: Group Images Instead of Names
Beitrag von: Burke ♞ Knight in Juni 23, 2013, 06:49:52 VORMITTAG
Why do you think I made my avatar mod?
Never made one of those before....LOL

EDIT:

Also, for those with Simple Portal, maybe add the way to change it in the user info block:
Sources/PortalBlocks.php

Find:<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';

if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';



Replace:<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';

if (!empty($member_info['group']))
echo '
<li class="membergroup"><img src="http://YOURDOMAIN.com/ranks/', $member_info['id'], '.png"> </li><br />';
else
echo '
', $member_info['post_group'], '<br />';

Titel: Re: Group Images Instead of Names
Beitrag von: Dhayzon in Juni 23, 2013, 02:30:13 NACHMITTAGS
thanks

Titel: Re: Group Images Instead of Names
Beitrag von: makedir in August 14, 2013, 06:11:33 VORMITTAG
I think its a cool idea of displaying group icon
Titel: Re: Group Images Instead of Names
Beitrag von: ivanushka in August 23, 2013, 06:07:18 VORMITTAG
Zitat von: makedir in August 14, 2013, 06:11:33 VORMITTAG
I think its a cool idea of displaying group icon

It's an excellent idea. An idea worth a million LOL

click here (http://google.com)
Titel: Re: Group Images Instead of Names
Beitrag von: LavaShakes in September 02, 2013, 05:59:17 VORMITTAG
wow! this is so cool! i will try this.