==== Use First and Last Name to Log-in ==== Here is a very simple implementation to incit people to use their first and last name, instead of a nickname, to log-in. Of course, a password is still needed. Creating a custom log-in page is much better for the user in case of private galleries ( $conf['guest_access'] = false; see [[user_documentation:use:features:conf_locale]] ), so I recommend merging the register.tpl template in the identification.tpl as a complementary First change the registration template and log-in template: read [[user_documentation:use:features:template]] and so work on register.tpl and identification.tpl\\ Here, the goal is to duplicate the html code for the username, and adapt it to last and first names for themes based on 'default'\\ So you have inside register.tpl:
  • which will become
  • __ __ :Here the words 'Lastname' and 'Firstname' are NOT translated: to translate them use {'Lastname'|@translate} instead and then you will have to add your own translations, still using the plugin Local Files Editor and its tab 'Languages' Do the same in identification.tpl on
  • by changing it with
  • Finally create a Personal Plugin using the plugin Local Files editor, and add this content: add_event_handler('init', 'id_fam'); function id_fam(){ global $template, $user; $template->assign(array( 'F_KEY' => get_ephemeral_key(6) )); if (isset($_POST['firstname']) and isset($_POST['lastname'])) { $_POST['login']=ucwords(strtolower(strip_tags($_POST['firstname']))).' '.ucwords(strtolower(strip_tags($_POST['lastname']))); $_POST['username']=ucwords(strtolower(strip_tags(($_POST['firstname']))).' '.ucwords(strtolower(strip_tags(($_POST['lastname']))); $template->assign(array( 'F_LASTNAME' => $_POST['lastname'], 'F_FIRSTNAME' => $_POST['firstname'] )); } } it will:\\ - intercept the first and last send when registring or logging-in, in order to build an username which will be 'Firstname Lastname': ucwords+strtolower is to get the first letter in capital and the rest in lower case.\\ - assign 'F_LASTNAME' and 'F_FIRSTNAME' with the values sended, for display. It's when the user is registrering but something is wrong, so the user don't have to type again. "$template->assign(array( 'F_KEY' => get_ephemeral_key(6) ));" is only needed when you want to merge register.tpl in identification.tpl