Not Solved [How To?] Hide Custom Field in UCP BUT Require On Registration
#1
Not Solved
I’m trying to figure out how to hide a custom profile field in the user cup so that it cannot be edited later on. However it is required to be filled in on the registration page. 

I’ve tried setting it up to where the field is viewable by everyone, required on registration but only editable by staff. Unfortunately this means it can’t be filled in on registration and essentially stops registration. 

Is it possible for me to somehow just hide this field in the User CP only?
> SELECT finger FROM hand WHERE id='3'
Reply
#2
Not Solved
Friendly bump....
> SELECT finger FROM hand WHERE id='3'
Reply
#3
Not Solved
Have you tried:

Required: Yes

Registration: Yes

Editable: No

Profile: No

Postbit: No

Viewable by: Admin / Mods
Reply
#4
Not Solved
I tried that but it stops registration because they can’t see the field that is required to be filled in
> SELECT finger FROM hand WHERE id='3'
Reply
#5
Not Solved
(2018-01-18, 09:33 PM)isoldehn Wrote: I tried that but it stops registration because they can’t see the field that is required to be filled in

Try "Editable By" part, and set it to Guests.
Reply
#6
Not Solved
Oh that’s actually smart! Thanks I’ll give that a shot and see if it works.
> SELECT finger FROM hand WHERE id='3'
Reply
#7
Not Solved
(2018-01-18, 09:52 PM)isoldehn Wrote: Oh that’s actually smart! Thanks I’ll give that a shot and see if it works.

Good luck, apart from that I don't know.
Reply
#8
Not Solved
This was a planned and implemented feature in 1.8.0, however it didn't work as expected and I can't remmeber if it was ever fixed.
Reply
#9
Not Solved
Would it be possible to add some sort of script in the usercp.php file to have this profile field hidden?

That way on registration (member.php) it’s still visible and required, so filled in when registering but when going to edit the profile it is then hidden with said script.

I know profile fields are pulled in the usercp.php file with an exploding string.

I’ve got template conditionals installed and have tried to add it into one of the templates for profile fields similar to:
<if $customfield['fid'] = 7 then></if>
Hoping that this would then display nothing when that field came up but that didn’t work either. (member_profile_customfields_field template)
> SELECT finger FROM hand WHERE id='3'
Reply
#10
Not Solved
I believe you could simply add your conditional to the following line:
if(!is_member($profilefield['editableby']) || ($profilefield['postnum'] && $profilefield['postnum'] > $mybb->user['postnum']))

Something like:
if(!is_member($profilefield['editableby']) || ($profilefield['postnum'] && $profilefield['postnum'] > $mybb->user['postnum']) || (int)$profilefield['fid'] === 1)

And after:
$plugins->run_hooks("usercp_do_profile_start");

Something like this might work:
!isset($mybb->input['profile_fields'][1]) or unset();

1 is the profile field id (fid). But you will need to adapt to consider groups, moderators, and probably even the moderator control panel, from which moderators can edit fields too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)