Custom Registration help
Hello Vanilla users. I've been trying to add this 1 extra field to my registration field but I can't seem to have actually write it to my database.
Must say I'm quite new at using PHP and doesn't seem like the API is explained very well for Vanilla or I've been unable to find the proper site.
Anyways based on this:http://vanillaforums.org/discussion/15120/custom-registration-fields
I've tried to edit my \applications\dashboard\views\entry\registerapproval.php
<li>
<?php echo $this->Form->Label('Main Warframe', 'main_warframe'); echo $this->Form->DropDown('main_warframe', array('Ash', 'Banshee', 'Ember', 'Excalibur', 'Frost', 'Loki', 'Mag', 'Nova', 'Nyx', 'Rhino', 'Saryn', 'Trinity', 'Vauban', 'Volt'), array('default' => 'Ash')); ?> </li>
And I've edited \applications\dashboard\models\class.usermodel.php
To following (Under InsertForApproval() )
$Fields['Email'] = $Email;
$Fields['Roles'] = (array)$RoleIDs;
$Fields['main_warframe'] = $_POST['main_warframe'];
Even though in my database it keeps getting set as 'NULL'
I probably have done something horrible wrong question is what. I simply have 'NULL' idea what the heck I've done wrong.
Anyone know what to do? Please share!
Comments
which version of vanilla?
don't edit the core files
create a plugin - its not too hard and you will be ahead of the game, so to speak...
don't edit my \applications\dashboard\views\entry\registerapproval.php
copy it to a views folder of a plugin.
create a new plugin called WarfareRegistration
look at this so you understand a bit of concept:
http://vanillaforums.org/discussion/20359/annotated-plugin-how-to-write-a-plugin-for-how-to-set-guest-to-view-title-only-and-not-content
also look at example plugin in documentation page
in
plugins/WarfareRegistration/default.php
add this to it e.g. to add a Warframe Column in user table.
//anytime you add a structure or change it, you must enable and disable plugin to create any new columns in database.
WarFareRegistration/views\entry\registerapproval.php
and add something like this:
then you will need some form validation in default.php
and some events depending on where you want to show the Warframe (e.g. profile or discussions) - see symboledit
which you can see in Documentation or in plugins below
and experiment and look at the wiki for more help if you get stumped.
then look at original botstop or first last names plugins for more details.
I think in 2.1 and 2.2 - there may be an even an easier way, but I haven't tried it.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
there may be a syntax error or it might work - but this should give you a better start.
anyone else feel free to improve on it.
add to
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Wow thanks a bunch! Also using 2.0.18
Sadly all I get now when hitting 'apply for membership' is BONK error.
Done a few changed based on what I could see in RegistrationRoles Plugin (makes it show on registration form but still doesn't add anything)
Since I have no idea how to put it up nice a neat like you did I gotta link to a zip file.
3dn.dk/dl/WarframeRegistration.zip
Also since I am unable to find any API, anyone can guide me to where it is?
Or will I simply have to try find it in the Forum files?
NVM it actually works now, will try to make it show in profile based on what you have showed me. Again thx for the help!