Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2012, 08:52 AM
Brexen Brexen is offline
 
Join Date: Jul 2011
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Images displayed before Username for certain Usergroups

Hi Guys,

I need to know if there is a plugin out there, that allows me to set an option to display an image before the username; if a user is in a certain usergroup. If not, how would I go about creating one, so it displays everywhere on my forum?

I know this can be done with HTML Mark-up, but I want it done my way, so that the HTML Mark-up of this group, don't interfere with other Usergroups.

Example: A user can be Premium and apart of this group with the image still displayed left of their username, without affecting the username colour.

Any help is appreciated.
Reply With Quote
  #2  
Old 06-05-2012, 09:31 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure if this exists already, but you could create a plugin using hook fetch_musername and add image code to $user['musername']. Like:

Code:
if (is_member_of($user, X))
{
   $user['musername'] = "<img src='images/someimg.gif'>" . $user['musername'];
}
Reply With Quote
  #3  
Old 06-05-2012, 10:06 AM
Brexen Brexen is offline
 
Join Date: Jul 2011
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
I'm not sure if this exists already, but you could create a plugin using hook fetch_musername and add image code to $user['musername']. Like:

Code:
if (is_member_of($user, X):
{
   $user['musername'] = "<img src='images/someimg.gif'>" . $user['musername'];
}
Thanks Kh99,

But is this;

If User is UserID add image or If user is a member of UsergroupID add images?

The second would be preferred ofcourse, but I shall try this nonetheless.
Reply With Quote
  #4  
Old 06-05-2012, 10:15 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Brexen View Post
Thanks Kh99,

But is this;

If User is UserID add image or If user is a member of UsergroupID add images?

The second one. 'X' is a groupid, and can be the primary group or any secondary group. (BTW, you can also list more values if you want, like is_member_of($user, X, Y, Z...)
Reply With Quote
  #5  
Old 06-05-2012, 10:25 AM
Brexen Brexen is offline
 
Join Date: Jul 2011
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
The second one. 'X' is a groupid, and can be the primary group or any secondary group. (BTW, you can also list more values if you want, like is_member_of($user, X, Y, Z...)
Returned a lovely error.

Code:
Parse error: syntax error, unexpected ':' in /home/tactical/public_html/includes/functions.php(1620) : eval()'d code on line 3
I'm using it on my test forum, before I try it on my main.
Reply With Quote
  #6  
Old 06-05-2012, 10:28 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oops, there was a typo - should have been ')' instead of ':' -

Code:
if (is_member_of($user, X))
{
   $user['musername'] = "<img src='images/someimg.gif'>" . $user['musername'];
}

Also you need to be careful to use single quotes in your img tag.

If you still get an error, post your exact code here.
Reply With Quote
  #7  
Old 06-05-2012, 10:36 AM
Brexen Brexen is offline
 
Join Date: Jul 2011
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works brilliantly, thanks KH99, great help as always.

Also to anyone who's trying this and wants text to be displayed when hovering over the Image.

Change this:

Code:
<img src='X'>
to this;

Code:
<img src='X' title='Y'>
Where X = image URL, and Y = Text to be displayed.

Tested and working

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:13 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07595 seconds
  • Memory Usage 2,225KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete