vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Male / Female usergroup color (https://vborg.vbsupport.ru/showthread.php?t=277575)

sadiq6210 01-26-2012 07:53 AM

Male / Female usergroup color
 
I have +15,000 users, although I have extra filed for gender (male/female), but I can't make a usergroup for each because I should explore 15000 users and I should move the new users who will register in future I should move it manually to the another group (everyday everyday ....).

We need a smart system (Al least "IF statement") to separate the users based on their gender, in all forum not only in postbit template.

sadiq6210 03-04-2012 05:18 AM

Any idea?

BirdOPrey5 03-05-2012 11:28 AM

You would need to make a plugin on the fetch_musername hook.


Something like this- untested code-
PHP Code:

gloabl $vbulletin;

if (
$vbulletin->userinfo['field5'] == "Female")
     
$user['musername'] = '<span style="color:pink;">' $user['username'] . '</span>';
else 
// If not female, assume male
     
$user['musername'] = '<span style="color:blue;">' $user['username'] . '</span>'

Obviously change the colors to your needs. Replace the 5 in 'field5' with whatever the number of your custom profile field.

Also assumes the field holds the word "Female" - if it's "Woman" / "Girl" whatever make sure you change that too.

sadiq6210 03-06-2012 07:37 AM

1 Attachment(s)
Thanks dear :up:

This is my code:
PHP Code:

if ($vbulletin->userinfo['field12'] == "GIRL")
{
     
$user['musername'] = '<span style="color:pink;">' $user['username'] . '</span>';
}

else
{
     
$user['musername'] = '<span style="color:blue;">' $user['username'] . '</span>';



But I got all users in blue color only ! No pink
When I only change (GIRL) with (BOY) in the first line I got all users in pink color.

see the attached screen-shots
I appreciate your help

BirdOPrey5 03-06-2012 12:16 PM

You're missing the first line of my code in the plugin-

PHP Code:

global $vbulletin

Edit- actually I'm not sure that matters... I don't think it does in this hook.

I see you have some other language installed... what language is your forum in?

Oh wait- I see this is a required field... but has it always been a required field? If not a lot of users may not have set it yet- is that possible? Did you test it for a user you know is absolutely set to BOY or GIRL?

sadiq6210 03-06-2012 12:28 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2306768)
You're missing the first line of my code in the plugin-

PHP Code:

gloabl $vbulletin



If I put this code in first line then I will get error

PHP Code:

Parse errorsyntax errorunexpected T_VARIABLE in /home/WEBSITE/public_html/forum/includes/functions.php(1329) : eval()'d code on line 1 

I see this error line before my forum header hundreds times (same line) !

like this:

PHP Code:

Parse errorsyntax errorunexpected T_VARIABLE in /home/WEBSITE/public_html/forum/includes/functions.php(1329) : eval()'d code on line 1

Parse error: syntax error, unexpected T_VARIABLE in /home/WEBSITE/public_html/forum/includes/functions.php(1329) : eval()'
d code on line 1

Parse error
syntax errorunexpected T_VARIABLE in /home/WEBSITE/public_html/forum/includes/functions.php(1329) : eval()'d code on line 1

Parse error: syntax error, unexpected T_VARIABLE in /home/WEBSITE/public_html/forum/includes/functions.php(1329) : eval()'
d code on line 1

Parse error
syntax errorunexpected T_VARIABLE in /home/WEBSITE/public_html/forum/includes/functions.php(1329) : eval()'d code on line 1

...................................... 


BirdOPrey5 03-06-2012 12:44 PM

Sorry I typoed it-

it should be: global $vbulletin;

Also I edited the post above with another question.

sadiq6210 03-06-2012 12:55 PM

This is my final code

PHP Code:

global $vbulletin;

if (
$vbulletin->userinfo['field12'] == "GIRL")
{
     
$user['musername'] = '<span style="color:pink;">' $user['username'] . '</span>';
}

else
{
     
$user['musername'] = '<span style="color:blue;">' $user['username'] . '</span>';



Edit- actually I'm not sure that matters... I don't think it does in this hook.
You are right, nothing changed after add (gloabl $vbulletin;). All users are blue color.


I see you have some other language installed... what language is your forum in?
Arabic, but I am using English lang. for this field. (Group / BOY or GIRL) so no Arabic words.

Oh wait- I see this is a required field... but has it always been a required field? If not a lot of users may not have set it yet- is that possible? Did you test it for a user you know is absolutely set to BOY or GIRL?

Yes this is always required field. Nobody can register without choose this field (BOY / GIRL) and I can see this field when I visit any user profile.
I have +1000 online users (BOY + GIRLS) but all users are in blue color.

I wish we can fix this, my users will like this change
Thanks again

BirdOPrey5 03-06-2012 01:26 PM

I don't know what it could be...

I just tested this exact code on my test forum:

PHP Code:

global $vbulletin;

if (
$vbulletin->userinfo['field7'] == "GIRL")
{
     
$user['musername'] = '<span style="color:pink;">' $user['username'] . '</span>';
}

else
{
     
$user['musername'] = '<span style="color:blue;">' $user['username'] . '</span>';


And made field7 BOY / GIRL just like your settings and it works just fine.

The problem for you is that:

PHP Code:

$vbulletin->userinfo['field12'] == "GIRL" 

is NEVER being evaluated as "true" even when it should be...

Just for a test measure why not add this line to the top of the code:

PHP Code:

echo "|" $vbulletin->userinfo['field12'] . "|"

It should write out at the very top of your forum something like |BOY||BOY||GIRL||BOY....

I'm curious if says anything at all... if it does copy and paste it here...

Be sure to remove the line after you run this test so it doesn't mess up your forum for everyone.

sadiq6210 03-06-2012 03:11 PM

Thank you very much

I got this:

|||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BO Y||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY||BOY|


I can't understand why there is no (GIRL) !
Anything wrong here?
https://vborg.vbsupport.ru/attachmen...1&d=1331022780


All times are GMT. The time now is 09:08 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.01283 seconds
  • Memory Usage 1,811KB
  • 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
  • (10)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete