Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new entry to the registration form #140

Closed
ghost opened this issue Oct 31, 2014 · 6 comments
Closed

Adding a new entry to the registration form #140

ghost opened this issue Oct 31, 2014 · 6 comments
Assignees
Labels
use and extension Misc feature request

Comments

@ghost
Copy link

ghost commented Oct 31, 2014

Hello,

UserFrosting has helped me build a website in no time and I was able to easily tailor it for my needs for which I thank you, however I'm now stuck at trying to add a new user input in the initial registration form. My php knowledge is really basic but I'd like my users to be able to enter their website URL at registration and have it be retrievable from the database (say in their dashboard).

I created a new field in my _users table named url and then tried to follow #120 which seemed like almost the same issue however after I edited the files I get a

Parameter url must be specified!

when I press the Register button.

What is the correct procedure in implementing something like this?

@lilfade
Copy link
Contributor

lilfade commented Oct 31, 2014

We'd have to see your code to know what your doing, if you fork the repo and commit your changes to your repo we could help you out pretty fast. If you post your code on here that would help as well.

We really should add something to the wiki on this @alexweissman lol

@alexweissman alexweissman added the use and extension Misc feature request label Oct 31, 2014
@alexweissman
Copy link
Member

Hi @hontoaishiteru, it sounds like you're on the right track. It sounds like that error is being thrown in api/create_user.php, probably because you added a line like:

$url = $validator->requiredPostVar('url');

The problem is that, as it is written right now, register.php is requiring that we explicitly state each field name that is to be POSTed. So, you need to add the line:

url:        form.find('input[name="url"]' ).val(),

After line 175 of register.php, in the Javascript. Sorry about that, this is something we need to fix. Form data should totally be automatically serialized so that you don't have to muck around in the JS.

@ghost
Copy link
Author

ghost commented Oct 31, 2014

Awesome, it was exactly that line in register.php that was missing. I changed the permissions so users can update their website url in their profile and now everything seems to be working. I also went ahead and edited the install_db.php and made a new install so that it automatically adds the new url field at installation.

Thanks again @alexweissman and @lilfade.

@r3wt
Copy link

r3wt commented Oct 31, 2014

@alexweissman

$('#foo').submit(function(){
     var QueryString = $(this).serialize();
});

@alexweissman
Copy link
Member

Nice! Yup, serialize is the way to go. Actually, it already is getting used in widget-users.js, I guess I forgot to update it in register.php.

@alexweissman
Copy link
Member

Ok, register.php now uses the serialize function to post form data. Also, I've created a guide for adding new user fields here:
https://github.com/alexweissman/UserFrosting/wiki/How-to-add-a-new-user-field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
use and extension Misc feature request
Projects
None yet
Development

No branches or pull requests

3 participants