News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How to disable changing of gender by members themselves?

Started by LetterBox, September 13, 2011, 05:08:55 AM

Previous topic - Next topic

LetterBox

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.

ziycon

Can you tell us what database your using and what exactly your trying to achieve?

Branko.

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
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

ziycon


LetterBox

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!


LetterBox

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!

Illori

LetterBox please do not bump within 24 hours we are all volunteers and reply if and when we know the answer

LetterBox

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!

Kays

Hi, try changing the "permissions" line to:


'permission' => 'admin_forum',


That should get it to show only for admins.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

LetterBox

#10
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.

live627

Try this:


'permission' => 'admin_forum' && isset($_REQUEST['area']) && $_REQUEST['area'] == 'account',

LetterBox

#12
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.

Kays

Try this then. It might work ???


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


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

LetterBox

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!

Kays

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

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Advertisement: