vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Images displayed before Username for certain Usergroups (https://vborg.vbsupport.ru/showthread.php?t=283966)

Brexen 06-05-2012 08:52 AM

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.

kh99 06-05-2012 09:31 AM

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'];
}


Brexen 06-05-2012 10:06 AM

Quote:

Originally Posted by kh99 (Post 2336679)
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.

kh99 06-05-2012 10:15 AM

Quote:

Originally Posted by Brexen (Post 2336687)
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...);)

Brexen 06-05-2012 10:25 AM

Quote:

Originally Posted by kh99 (Post 2336692)
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.

kh99 06-05-2012 10:28 AM

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.

Brexen 06-05-2012 10:36 AM

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

http://screensnapr.com/e/4ybRYT.png


All times are GMT. The time now is 05:43 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00979 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete