? logouttab-d6.patch Index: logouttab.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/logouttab/logouttab.info,v retrieving revision 1.1 diff -u -p -r1.1 logouttab.info --- logouttab.info 4 Aug 2008 16:10:37 -0000 1.1 +++ logouttab.info 22 Mar 2010 22:03:15 -0000 @@ -2,4 +2,5 @@ name = Logout Tab description = Adds a logout tab to the user profile. package = Other -version = "5.x-1.0" +version = VERSION +core = 6.x Index: logouttab.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/logouttab/logouttab.module,v retrieving revision 1.1 diff -u -p -r1.1 logouttab.module --- logouttab.module 4 Aug 2008 16:10:37 -0000 1.1 +++ logouttab.module 22 Mar 2010 22:03:16 -0000 @@ -4,71 +4,46 @@ /** * @file * Adds a logout tab to the profile area - * */ /** * Implementation of hook_menu(). */ - -function logouttab_menu($may_cache) { - - $items = array(); - if ($may_cache) { - $items[] = array( - 'path' => 'admin/settings/useraccounthelp', - 'title' => t('User Account helppage settings'), - 'description' => t('Choose the page that the user account help tab link goes to.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('logouttab_admin_settings'), - 'access' => user_access('administer site configuration') - ); - } - - //testing to make sure we're in a user profile... - if (arg(0) == 'user' && is_numeric(arg(1))) { - - - -$helpurl = variable_get('logouttab_url', 'logout'); - - // User help page - $items[] = array( - 'path' => "user/". arg(1) ."/". $helpurl, - 'title' => t('Logout'), - 'weight' => 8, - 'callback' => 'send_to_help_page', 'callback arguments' => $helpurl, - //'access' => user_access('maintain own subscriptions'), - 'type' => MENU_LOCAL_TASK, - ); - - - } - - return $items; - +function logouttab_menu() { + $items['user/%user/logouttab'] = array( + 'title' => 'Log out', + 'page callback' => '_logouttab_redirect_url', + 'access callback' => 'user_is_logged_in', + 'weight' => 8, + 'type' => MENU_LOCAL_TASK, + ); + $items['admin/user/logouttab'] = array( + 'title' => 'Logout settings', + 'description' => t('Choose the page that the user account help tab link goes to.'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('logouttab_admin_settings'), + 'access arguments' => array('administer users') + ); + return $items; } -function -send_to_help_page($helpurl) { - - drupal_goto($path = $helpurl); - +/** + * Redirect user to defined page. + */ +function _logouttab_redirect_url() { + drupal_goto(variable_get('logouttab_url', 'logout')); } /** * Define the settings form. */ - function logouttab_admin_settings() { - - $form['logouttab_url'] = array( + $form['logouttab_url'] = array( '#type' => 'textfield', '#title' => t('URL for the account help page'), - '#description' => t('Enter the relative path for the user account help page.'), - '#default_value' => variable_get('logouttab_url', 'logout'), + '#description' => t('Enter the relative path for the user account help page.'), + '#default_value' => variable_get('logouttab_url', 'logout'), '#title' => t('URL'), - ); - - return system_settings_form($form); + ); + return system_settings_form($form); }