Return user to current page: How to link to a form from a Drupal menu
Press login / press account links for anonymous and logged in users, respectively. Subtly added to a bottom menu. Via code in order to allow for the redirect back to the page you were on after login or editing.
There is surely a way, or should be a way, that does not involve hook_page_alter(), but hey, this works.
<?php
/**
* Implements hook_page_alter().
*/
function feature_final_page_alter(&$page) {
if ($menu =& $page['footer']['menu_menu-utility']) {
if ($menu['378']['#attributes']['class'][0] == 'last') {
unset($menu['378']['#attributes']['class'][0]);
}
global $user;
if (!$user->uid) {
// If anonymous, set link and link title accordingly.
// Note: Path will be handed to l() and thus url().
$path = 'user';
$title = t('Press login');
$tooltip = t('Sign in or register for media-only access to high-resolution images and more.');
}
else {
// The user is logged in, direct them to their account page.
$path = 'user/' . $user->uid . '/edit';
$title = t('Press account');
$tooltip = t('Manage your contact information.');
}
$menu['feature_final_press'] = array(
'#theme' => 'menu_link__menu_utility',
'#attributes' => array(
'class' => array(
0 => 'last',
1 => 'leaf',
),
),
'#title' => $title,
'#href' => $path,
'#localized_options' => array(
'query' => drupal_get_destination(),
'attributes' => array(
'title' => $tooltip,
),
),
'#below' => array(),
);
}
}
?>
More like this
- Adding non-menu things to primary links menu items with Drupal 7's page alter hook
- Building Beauty presentation documentation and links
- Remove the main content title from the front page of the site
- Passing an argument to a Drupal form through hook_menu and use of drupal_get_form
- How to redirect after a Drupal form by the way you link to the form


Comments
It also will enable one
It also will enable one Windows 8 to edit records saved in Microsoft Windows 8 your server also once you are Office 2010 using the help of Microsoft Office 2010 . These modifications are instantly MS Office 2010 synchronized once you arrive Office 2010 Download . Download Office 2010 this can not merely Office 2010 Professional help you spend less time but money as Microsoft Office 2010 Download really nicely by aiding one to set up and operate company business office around the private computer, laptop, Online, and sensible phones.
Microsoft Office 2011 gorgeous exhibits with company Office 2007 which can make you Microsoft Office 2007 standout from some others. It creates it MS Office 2007 feasible for yourself to create Office 2007 Download incredible presentations by incorporating Office 2007 Professional electronic digital content Download Office 2007 material and films in Microsoft Office 2007 Professional . These displays are effortlessly Microsoft Office 2007 Download developed with out Windows 7 any Buy Windows 7 need of high priced resource. You will make Microsoft Windows 7 your displays witnessed to Win 7 everybody during the sort of Download Windows 7 .
Post new comment