Hi,
I want to add extra field (site-categories to be precise) to register form and make it mandatory.
I already added the field in the form but not sure how to make it so it gets saved in database (I'm assuming it will be metadata)
Do I need to alter the register function or what would be the best aproach?
Thanks for help.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
The best approach would be using the profile manager, which lets you add extra fields to the registration page.
Rodolfo Hernandez
Arvixe/Elgg Community Liaison
Thanks for the reply rj, I'm trying to avoid profile manager.
How do I extend the register action to include my extra field to be saved?
Unregister the action and create new one that includes my new field? in the theme/plugin start file?
Thanks.
Why are you trying to aviud Profile Manager? It is pretty straight forward, and no need to code and such.
Anyways:
//Get the path
$actions = elgg_get_plugins_path() . 'filterpro/actions/file';
//Register our new action
elgg_register_action('file/upload', "$actions/upload.php");
Rodolfo Hernandez
Arvixe/Elgg Community Liaison
I love profile manager plugin and use it on other sites but I don't want to use profile manager on this particular project because I wont be even using any profile fields and don't need any of the extras that come with the plugin. I just need to extend/override the register process to include this one extra field I added to the register form.
So what you're saying I just need to register my new register action? No need to unregister original action first?
Thanks for your replies.
Profile plugin is not being used so I can't use profile manager.
Anyone has an idea how to do this without profile manager?
Also I will need to add extra field to user settings page. Already tried but it's not getting saved. Is it because it has to be metadata?
Any help/pointers appreciated.
Any help ? :(
Couldn't you just edit register.php action?
@This Script Lover
I already told you how to extend your action. Try that or just use the profile manager
Rodolfo Hernandez
Arvixe/Elgg Community Liaison
If you re-register the action you can copy the action file and edit it in a new plugin. Or for registration, you can hook into the 'create', 'user' event
I wouldn't re-register the action nor copy the action file. Instead I think I would do it like this:
Validate the value of the category field using 'route', 'action/register' hook. Make sure you call elgg_make_sticky_form('register'); if the category value is invalid. This makes sure the other values are not removed when you forward(REFERER); the user back to the registration form.
Instead of doing the saving with 'create', 'user' event it I think it would be better to do it using 'register', 'user' hook. By this time the actual user entity has already been created but the data from the registration form is still available.
If you have used the input/categories view in the registration form, you can save the value in the plugin hook handler like this:
- Previous
- 1
- 2
- Next
You must log in to post replies.