MyBB Community Forums

Full Version: Hide particular custom userfield for guests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there

I'd like to hide a particular userfield for guests in the member profile and postbit.

In the member profile I created an extra template (member_profile_guest), which doesn't contains userfields in general. The editet part of the member.php looks now like

	
	$plugins->run_hooks("member_profile_end");

	    if($mybb->user['uid'] == '0')
    {
        eval("\$profile = \"".$templates->get("member_profile_guest")."\";");
    }
    else
    {
        eval("\$profile = \"".$templates->get("member_profile")."\";");
    } 
	output_page($profile);
}

if($mybb->input['action'] == "do_emailuser" && $mybb->request_method == "post")

Can someone help me with putting the userfields back - except of the one I don't want to? The code {$post['fidX']} doesn't work^^

________________________

In the postbit I filled in the userfields with {$post['fidX']}. Now I'd like to hide one ({$post['fid11']}) to guests. Unfortunately I'm not able to write a code on myself. Can somene help me with that? I thought of a similar solution like in the profile, with an extra template for guests, but perhaps someone has a more elegant way? Smile

Thanks for reading,
Rica
actually we do not need system file edits for hiding some contents from a specific group.
in general we use template conditionals plugin for such requirements

<if !in_array($mybb->usergroup['gid'], array('1', '5', '7')) then>
content visible for regular members (including staff)
</if>
(assuming that user groups IDs are not changed. 1 --> guests, 5 --> awaiting activation, 7 --> banned)
Thank you for your help Shy

Hiding the postbit works perfect.. so perfect, that nobody can view the posts when I put the if code around the postbit (thread looks empty) =/

The template now looks like this:
<if !in_array($mybb->usergroup['gid'], array('1', '5', '7')) then>
<center>{$post['fid11']}</center><br>
</if>

What am I doing wrong? I installed the plugin, the usergroup IDs of 1, 5 and 7 are not changed.
^ have you added the suggested plugin file and activated it - or do you already have it installed
Yes, I added the two files downloaded to my plugin folder and activated them (it was just the plugin to install, wasn't it? There were no additional files to download?). No, I didn't install any similar Plugin.