Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 04-29-2006, 11:10 PM
is mise is mise is offline
 
Join Date: Apr 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Show User Profile Field only to certain usergroup?

Is there a way to make a user profile field show up only to members of a certain usergroup?

Here's my problem:

I have several public forums and one private forum. The private forum is only visible by members of a particular usergroup. These people know each other in person ("real life"), so we want them to be able to figure out their real names.

Regardless of what name they register under (CoolDude, GreatGal, whatever), I want users in the private forum to be able to see their real first name. I figured I could let them put their real first name in a custom User Profile Field, but then everyone (in the public & private forums) would see their real name.

Then I thought maybe I could set permissions or something to allow only members of the private forum/usergroup to see the FirstName user profile field.

Is there any way to do that?

Thanks!

P.S.--I bought that new vBulletin book from PACKT publishing, and it doesn't seem to discuss this at all.
Reply With Quote
  #2  
Old 04-30-2006, 12:20 AM
Freesteyelz's Avatar
Freesteyelz Freesteyelz is offline
 
Join Date: Jan 2006
Posts: 1,552
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My guess is that you want the names to appear in the posbit of the private forum. So try this. Add a (private) Custom Profile Field in Admin CP. Make sure that you've disabled viewing in Members List and Search. After you have finished in the Usergroups option, set the option to "Can View Private Custom Fields". For all other Usergroups that option should be disabled. Now for that selected Usergroup they can enter their names into the Custom Profile Field.

The next step is to set a conditional so that only the selected Usergroup can see the names in posbits. The code can work for both postbit and posbit_legacy layouts. The conditional is as follows:

Anywhere near the postbit or posbit_legacy template Username's column:
Code:
<if condition="$post['fieldx'] AND $thread['forumid'] == y AND !is_member_of($bbuserinfo, z)">
      $post[fieldx]
</if>
Where "x" is replace with the Custom Profile Field ID (2 places in code). Where "y" is replace with the private forum ID. Where "z" is replace with the Usergroup ID.

The conditional basically states that if the custom field was entered + it's in this private forum + the user is a member of this Usergroup then the entry will display in posbit. To test it add any text in the Custom Profile Field after you've entered the code and see if that text displays only in the private forum postbit.

I haven't tested it but it should work. If not let me know and we'll easily fix it.
Reply With Quote
  #3  
Old 04-30-2006, 12:54 AM
Connector Connector is offline
 
Join Date: Dec 2005
Location: Spain
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very good post .. how about if i need it to be in the member.php=1 also ?
Reply With Quote
  #4  
Old 04-30-2006, 04:49 PM
is mise is mise is offline
 
Join Date: Apr 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent! You da man, Freesteyelz.

I just had to remove the '!' before "is_member_of".
Reply With Quote
  #5  
Old 04-30-2006, 04:56 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually, if you are tyring to make this go in a post, then this would not work:
Code:
<if condition="$post['fieldx'] AND $thread['forumid'] == y AND !is_member_of($bbuserinfo, z)">
      $post[fieldx]
</if>
You'd have to use this:
Code:
<if condition="$post['fieldx'] AND $thread['forumid'] == y AND is_member_of($post, z)">
      $post[fieldx]
</if>
$bbuserinfo is the userinfo of the user that's browsing the forum. $post is what draws the userinfo of the poster.
Reply With Quote
  #6  
Old 05-23-2006, 04:37 PM
is mise is mise is offline
 
Join Date: Apr 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After further testing, I'm finding that I have to enable "Can View Private Custom Fields" for the group the member is in. Is there any way around this? I don't want them to see all the private custom fields, just this one.

Maybe vBulletin is being too smart for me?
Reply With Quote
Reply

Thread Tools
Display Modes

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 05:43 AM.


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.04374 seconds
  • Memory Usage 2,204KB
  • 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
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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