Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
I'm not a sexist...
lifeisfoo
✭✭✭
...but I need to force gender selection at registration. Any advice on how do that?
There was an error rendering this rich post.
Tagged:
0
Best Answer
-
peregrine MVP
here is some jquery that will erase unspecified and force a check on male. The user can still change it to female by clicking on female.
just throw it in a plugin, themehooks to execute with registration page.
$('.RadioLabel').filter(":first").hide(); $('#Form_Gender').hide() $('#Form_Gender1').prop('checked',true);
or if you want female auto-checked.
$('#Form_Gender2').prop('checked',true);
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
7
Answers
isn't gender selection already there?
what version of Vanilla and what type of registration?
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
ok you probably mean vanilla 2.1? since it has an unspecified option.
a whole less searching if the exact version of vanilla was specified in question
one way to do it....
e.g. with registerapproval
copy the
/applications/dashboard/views/entry/registerapproval.php
to your theme views
and modify
echo $this->Form->RadioList('Gender', $this->GenderOptions, array('default' => 'u'))
so that the $this->GenderOptions are only M F or whatever you want.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
or create a plugin and copy the registration views. either way will do what you want.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thank you for your answer.
I have tried using using various hooks and this code:
SetValue("GenderOptions", $Sender, array( 'm' => T('Male'), 'f' => T('Female') ));
Without success.
This is the vanilla EntryController function that sets these values:
`
public function Register($InvitationCode = '') {
$this->FireEvent("Register");
//CUT...
}
`
As you can see an event is triggered before the values set, so it is unuseful. So I tried with the immediatily next event (and the code reported above):
EntryController_BeforeAddCss_Handler without results...
Since I don't want to mantain vanilla custom views, I'm too busy and too lazy , I'm searching for another solution...maybe javascript?
There was an error rendering this rich post.
I found this tid bit of info maybe it can help?
http://www.html-form-guide.com/php-form/php-form-processing.html
maybe if you add an if statement
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
here is some jquery that will erase unspecified and force a check on male. The user can still change it to female by clicking on female.
just throw it in a plugin, themehooks to execute with registration page.
or if you want female auto-checked.
$('#Form_Gender2').prop('checked',true);
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thanks! For asking this... Did not feel manly enough to ask.
I have also tried to add a custom validation in the controller using hooks to enforce this solution, but nothing.
Thank you everybody.
There was an error rendering this rich post.
This would be really cool.
I added a ForceGender plugin that gives only m and f f choices and removes unspecified
and validates for selection of m and f.
http://vanillaforums.org/addon/forcegender-plugin
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@lifeisfoo and @srgamer
try version 1.1 - see if it works for you
http://vanillaforums.org/addon/forcegender-plugin
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Its Srggamer, thats why I never got notifications
@Srggamer
try version 1.1 - see if it works for you
http://vanillaforums.org/addon/forcegender-plugin
consider yourself notified - if you were serious about the plugin, download and test.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I'll add an icon - when @vrijvlinder posts her icon picks .
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Dear @peregrine you serve another fine meal, works as wanted, works flawlessly and Even has a settings page. Great work mate!
lmao you read my intentions, Yep on it's way !! let me post a couple before you add it to the plugin so as to pick the best one....
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Thank you @peregrine, it works. Here is the code to manage profile updates (force users already registered users with no gender selected to select a gender on profile update). Add it to your plugin.
Sharing knowledge is always a pleasure.
There was an error rendering this rich post.
I though this would be relevant to this discussion for some reason...
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌