Two suggestions:
You could register into the 'register', 'user' plugin hook (see Elgg core action vendor/elgg/elgg/actions/register.php) to do your validation of registration fields.
Or you can take a look into the code of the Profile Manager plugin. This plugin adds register form validation during input. It overrides the register form of Elgg core and comes with it's own register action and the JS code for live validation. You could take this functionality of the Profile Manager plugin to create a custom plugin that only does account registration validation exactly as you want it.
You can try and see how it is done in this plugin.
@iionly Thankssss! really thanks.
I learned a lot from your reply! I owe you know dude :)
Just something is wrong. when I use this code "newest" key not working anymore! :(
Ah, I see the problem. In the callback function members_nav_newest() in start.php of the members plugin the url returned by the function is just "members". It worked for the "Newest" tab to show up nevertheles because the "newest" url segment was added in the pagehandler function by default if no other segment was already set. I think this is kind of a bug in Elgg that should be fixed.
For now you can use a workaround:
Add in the init function of your plugin the two lines
elgg_unregister_plugin_hook_handler('members:config', 'tabs', "members_nav_newest");
elgg_register_plugin_hook_handler('members:config', 'tabs', "my_members_nav_newest");
This unregisters the original callback for the newest tab and registers you own instead. Then add your own callback function
function my_members_nav_newest($hook, $type, $returnvalue, $params) {
$returnvalue['newest'] = array(
'title' => elgg_echo('sort:newest'),
'url' => "members/newest",
);
return $returnvalue;
}
The only difference here is that it returns the url segment "members/newest" instead of only "members". Then it will work to display also the "Newest" tab with another tab used as default.
Wow!!! You saved me! in addition I have an example for hooks usage too :-)
Thanks a world ;)
It's on the download page https://elgg.org/about/download or installable via composer
Follow the upgrade instructions (including the first advice of making a backup of database, data directory and install folder before upgrading) and you won't lose any data (as you can restore the site if anything goes wrong).
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.