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:
- Go to your display.template.php
- Find this code
Zitat<li class="membergroup">', $message['member']['group'], '</li>
- Repace it with
Zitat<li class="membergroup"><img src="http://YourDomainName.com/ranks/', $message['member']['group_id'], '.png"> </li>
- Now create a directory called "ranks" in your forum root.
- You need to get group id for each group from the admin panel. For eg admin group is 1 so the image will be 1.png
- Upload all the images.
- Done.
Now, this only appears in posts but you can also make it to appear in profiles and other pages using this simple edit.
As this is a tip/trick, mind if I move it to the... er... "Tips and tricks" board?
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.
Just what do you edit for the Profile page to show right?
I got the display and private message pages done. :)
Profile.template.php. Edit there to display images in profiles.
I looked there and did not find the code you showed.
Do you have the exact line to find and replace with?
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">
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.
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 :)
I was just thinking for those people with about 3-4 or more sites.... LOL :P
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
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 />';
thanks
I think its a cool idea of displaying group icon
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)
wow! this is so cool! i will try this.