Posted by Cyberwolf on October 11, 2010 at 8:13am
3 followers
Jump to:
| Project: | Email Registration |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
The title of several pages still equals the login name, which is IMHO quite confusing for end users. Instead, the e-mail address should be shown.
function emaiLregistration_menu_alter(&$items) {
$items['user/%user_uid_optional'] = array_merge($items['user/%user_uid_optional'], array(
'title' => 'My account',
'title callback' => 'email_registration_user_page_title',
'title arguments' => array(1),
));
$items['user/%user_category/edit']['page callback'] = 'email_registration_user_edit';
$empty_account = new stdClass();
if (($categories = _user_categories($empty_account)) && (count($categories) > 1)) {
foreach ($categories as $key => $category) {
// 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK.
if ($category['name'] != 'account') {
$items['user/%user_category/edit/'. $category['name']]['page callback'] = 'email_registration_user_edit';
}
}
}
return $items;
}
function email_registration_user_page_title($account) {
global $user;
if ($account->uid == $user->uid) {
return t('My account');
}
return $account->mail;
}
/**
* Replacement for user_edit page callback, which sets the user e-mail as title instead
* of the user account name
*/
function email_registration_user_edit($account, $category = 'account') {
drupal_set_title(check_plain($account->mail));
return drupal_get_form('user_profile_form', $account, $category);
Comments
#1
function emaiLregistration_menu_alter(&$items) {should have been:
function email_registration_menu_alter(&$items) {#2
#3
Only my 2cents: I think that your code could "broke/interfer" with RealName module (the last one edits user name display.. like Conten_profile does)...
Take my comment as a check-list for further module integration ;)
Regards