vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Show User Profile Field only to certain usergroup? (https://vborg.vbsupport.ru/showthread.php?t=114399)

is mise 04-29-2006 11:10 PM

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.

Freesteyelz 04-30-2006 12:20 AM

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. :)

Connector 04-30-2006 12:54 AM

Very good post .. how about if i need it to be in the member.php=1 also ?

is mise 04-30-2006 04:49 PM

Excellent! You da man, Freesteyelz.

I just had to remove the '!' before "is_member_of".

Gio~Logist 04-30-2006 04:56 PM

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.

is mise 05-23-2006 04:37 PM

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?


All times are GMT. The time now is 02:25 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.01200 seconds
  • Memory Usage 1,721KB
  • 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
  • (3)bbcode_code_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