vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Hide custom fields by usergroup? (https://vborg.vbsupport.ru/showthread.php?t=281285)

HotLink 04-08-2012 07:04 PM

Hide custom fields by usergroup?
 
Can someone give me a hand in creating a small plugin for vB 3.8.7? I want to hide/show the custom profile fields in usercp/editprofile by usergroup.

I guess the plugin should look something like this:

Code:

if (!is_member_of($vbulletin->userinfo, array(X, Y, Z)))
{
    unset(
        $vbulletin->cfield['1'],
        $vbulletin->cfield['2'],
        $vbulletin->cfield['3']
    );
}

Any help/advice would be appreciated.

kh99 04-08-2012 08:05 PM

I think I can help a little - I think you'd want:

Code:

   
if (!is_member_of($vbulletin->userinfo, array(X, Y, Z)))
{
    unset(
        $userinfo['field1'],
        $userinfo['field2'],
        $userinfo['field3']
    );
}

but I don't know which hook location to recommend.

Edit: do you mean that you don't want to show the fields if it's the profile of a user in one of those groups, or do you mean you don't want to show anyone's field1, field2, etc to someone of one of those usergroups?

HotLink 04-08-2012 08:48 PM

Quote:

Originally Posted by kh99 (Post 2318129)
I think I can help a little - I think you'd want:

Code:

   
if (!is_member_of($vbulletin->userinfo, array(X, Y, Z)))
{
    unset(
        $userinfo['field1'],
        $userinfo['field2'],
        $userinfo['field3']
    );
}

but I don't know which hook location to recommend.

Edit: do you mean that you don't want to show the fields if it's the profile of a user in one of those groups, or do you mean you don't want to show anyone's field1, field2, etc to someone of one of those usergroups?

Thanks!:) Yes, i want the fields to be hidden on edit/view, if the profile belongs to a user in the X,Y,Z groups.On a MyBB forum i did it with template conditionals but i just started using vB 3.8 and i have no clue on what/where to add..

kh99 04-08-2012 10:24 PM

Quote:

Originally Posted by HotLink (Post 2318137)
Thanks!:) Yes, i want the fields to be hidden on edit/view, if the profile belongs to a user in the X,Y,Z groups.

In that case you'd want to use $userinfo in the is_member_of() call as well.

Edit: I haven't tried it, but hook member_profileblock_fetch_unwrapped might work for that.

CAG CheechDogg 09-16-2013 02:29 PM

Hey hey Kh99, will this work on V4?

I want to hide some custom profile fields from all registered users in their usercp/editprofile ...

How would I do that for v4? Thanks in advance!


All times are GMT. The time now is 07:40 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.04493 seconds
  • Memory Usage 1,724KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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