vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   So I'm trying to setup a hook on fetch_musername (https://vborg.vbsupport.ru/showthread.php?t=207257)

DISLEX 03-03-2009 09:42 PM

So I'm trying to setup a hook on fetch_musername
 
And when the user matches certain characteristics, I force-change their musername to a different style. Problem is, when I do that, it changes it for EVERYONE. Makes no sense to me...

This is the plugin on the hook:

Code:

if (is_member_of($vbulletin->userinfo, 31))
{
  $user[musername] = "<strong><span style='color: #FF66FF'>" . $username . "</span></strong>";
}

I know that I could setup a style for usergroup 31, this is only test code. I want to expand upon that if(). But the problem is, it applies this to everyone, not just the users in group 31. How is that even possible? I thought it had something to do with the goofy static $hook_code junk inside functions.php, so I replaced it with a normal hook call, but that didn't change anything.

Any ideas?

Dismounted 03-05-2009 05:05 AM

What hook are you placing this in?

Lynne 03-05-2009 03:00 PM

Your condition says "if you the viewer are a member of group 31, then change....". So yes, if you the viewer are a member of group 31, then all the usernames will be changed.

DISLEX 03-05-2009 10:27 PM

to clarify, I want it to only work for members of usergroup 31.

however, it does it for EVERY single user, regardless of usergroup... I don't understand how that's possible.

I'm playing it under the hook fetch_musername.

Lynne 03-06-2009 01:13 AM

There is a difference between the *viewer* of the page being a member of group 31, and the page/post belonging to a member of group 31. Your condition is for the first - the viewer of the page. "if the viewer of the page is in group 31, change the username in this way" either all user names on the page will be changed, or they won't - depending on the group the *viewer* is a member of.

If you are talking about a showthread page, and want the *posters* username to change based on whether the *poster* is in usergroup 31 or not (who cares what the usergroup id of the viewer is), then that is a different condition - you would probably use the variable $user['usergroupid'] in the condition.

Dismounted 03-06-2009 03:50 AM

Quote:

Originally Posted by Lynne (Post 1761487)
If you are talking about a showthread page, and want the *posters* username to change based on whether the *poster* is in usergroup 31 or not (who cares what the usergroup id of the viewer is), then that is a different condition - you would probably use the variable $user['usergroupid'] in the condition.

On showthread, you would use $post ;).


All times are GMT. The time now is 03:51 AM.

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.01955 seconds
  • Memory Usage 1,719KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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