I am using Elgg 1.12.4 and profile manager 9.1.
In the profile manager plugin settings there is an option titled "Generate username from email", it is working correctly only when the username grabbed from the email does not exists in the users_entity or the user being looked up has been validated already.
if user one comes with email address abcd@email.com and registers, his username will be abcd. If a second user comes with email address abcd@@xyz.com, although the email username are the same the following code makes the username unique but only when abcd@email.com user has been validated.
profile_manager/libs/hooks.php
// generate username $username = get_input('username'); $email = get_input('email'); if (empty($username) && !empty($email) && (elgg_get_plugin_setting("generate_username_from_email", "profile_manager") == "yes")) { $email_parts = explode('@', $email); $base_username = $email_parts[0]; $tmp_username = $base_username; $i = 1; while (get_user_by_username($tmp_username)) { $tmp_username = $base_username . $i; $i++; } set_input('username', $tmp_username); } }
Function get_user_by_username seems to be able to read only when the username has been already validated.
Line 241 in http://reference.elgg.org/users_8php_source.html
Should I create my own SQL and remove the access part or there is another built function that I can use?
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.
- Team Webgalli@webgalli
Team Webgalli - 0 likes
- Use your own sql as you mentioned
- Use access_show_hidden_entities() before searching for existing users.
- Alejandro@dveloper
Alejandro - 0 likes
You must log in to post replies.If this happens, then its a bug with the plugin and the best thing is to report this to the plugin author in the plugin listing page.
For time being, you have to options
Thank you Webgalli. It looks like the issue appears to be with the browser's cache. I noticed that when I cleared my browser's cache after registering a test user this does not happen when attempting to register a another user with the same email id but different domain. I will ask the plugin author if he is aware of this.