Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: LetterBox on September 13, 2011, 05:08:55 AM

Title: How to disable changing of gender by members themselves?
Post by: LetterBox on September 13, 2011, 05:08:55 AM
UPDATE : Deleted null field, but still need help on disabling changing of gender by members themselves.

As stated, how do i delete away the 'null' field on gender?

Also, users are able to change their gender in forum profile.

Or should i create another profile field that mimics gender?

Though, i've totally no idea how to do that.
Title: Re: How to delete away null field on gender?
Post by: ziycon on September 13, 2011, 07:37:58 AM
Can you tell us what database your using and what exactly your trying to achieve?
Title: Re: How to delete away null field on gender?
Post by: Branko. on September 13, 2011, 07:57:39 AM
In /Sources/Profile-Modify find:

),
'gender' => array(
'type' => 'select',
'cast_type' => 'int',
'options' => 'return array(0 => \'\', 1 => $txt[\'male\'], 2 => $txt[\'female\']);',
'label' => $txt['gender'],
'permission' => 'profile_extra',

just remove this:  0 => \'\',

look this:
),
'gender' => array(
'type' => 'select',
'cast_type' => 'int',
'options' => 'return array(1 => $txt[\'male\'], 2 => $txt[\'female\']);',
'label' => $txt['gender'],
'permission' => 'profile_extra',

then in profile, blank field not exist anymore
Title: Re: How to delete away null field on gender?
Post by: ziycon on September 13, 2011, 08:02:21 AM
Edit: don't mind this post.
Title: Re: How to delete away null field on gender?
Post by: LetterBox on September 13, 2011, 10:22:49 AM
Thanks for the prompt reply. That will bring away the null field, i see. Thanks!

But, how do i prevent users from changing their gender?

Thanks!
Title: Re: How to delete away null field on gender?
Post by: LetterBox on September 13, 2011, 09:27:33 PM
Bumpz
Title: Re: How to delete away null field on gender?
Post by: LetterBox on September 14, 2011, 01:56:58 AM
There's no more null field, thanks. But how do i prevent users from changing their gender, and only admins can do it? Please help, urgent. Thanks!
Title: Re: How to delete away null field on gender?
Post by: Illori on September 14, 2011, 05:47:40 AM
LetterBox please do not bump within 24 hours we are all volunteers and reply if and when we know the answer
Title: Re: How to delete away null field on gender?
Post by: LetterBox on September 15, 2011, 10:35:57 AM
Quote from: Illori on September 14, 2011, 05:47:40 AM
LetterBox please do not bump within 24 hours we are all volunteers and reply if and when we know the answer

Opps, sorry. I guess it's after 24 hours now right? Need urgent help. Thanks!
Title: Re: How to disable changing of gender by members themselves?
Post by: Kays on September 15, 2011, 11:40:56 AM
Hi, try changing the "permissions" line to:


'permission' => 'admin_forum',


That should get it to show only for admins.
Title: Re: How to disable changing of gender by members themselves?
Post by: LetterBox on September 15, 2011, 01:22:08 PM
Hi, thanks, users cannot change it now. But it does not show up in registration form anymore.

And if you would like to know, under admin > configuration > profile fields, 'show on registration' is ticked.

Help please? Thanks.
Title: Re: How to disable changing of gender by members themselves?
Post by: live627 on September 15, 2011, 01:26:14 PM
Try this:


'permission' => 'admin_forum' && isset($_REQUEST['area']) && $_REQUEST['area'] == 'account',
Title: Re: How to disable changing of gender by members themselves?
Post by: LetterBox on September 15, 2011, 01:42:03 PM
UPDATE : It came back to the form after live627's codes....and i thought it worked.

But users can change them again in their profile section again.

Originally, after Kays instructions, users cannot see the gender field anymore in their profile, only admins can. That's great.

But though, gender cannot be view in the form.

That's the problem.

More help please? Thanks.
Title: Re: How to disable changing of gender by members themselves?
Post by: Kays on September 15, 2011, 01:53:55 PM
Try this then. It might work ???


'permission' => isset($_REQUEST['action']) && $_REQUEST['action'] == 'register' ? 'profile_extra' : 'admin_forum' ,

Title: Re: How to disable changing of gender by members themselves?
Post by: LetterBox on September 15, 2011, 02:07:18 PM
Woah Kays! That totally helped! Thanks alot alot alot. Yep, it works now. Yay!

Also, thanks illori, branko and live627, and all those who helped.

Thanks alot. I guess it's resolved for now. Thanks alot kays! Your great (: Have a nice one!
Title: Re: How to disable changing of gender by members themselves?
Post by: Kays on September 15, 2011, 02:17:14 PM
Cool, thanks to live627 for the nudge in the right direction. :)

I find it strange that the fields on the register page are profile permission based. Guests shouldn't have permission to edit their profiles since they don't have one to start with. Unless I'm missing something in how thing are handled there. :)