/[drupal]/contributions/modules/logouttab/logouttab.module
ViewVC logotype

Contents of /contributions/modules/logouttab/logouttab.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Aug 4 16:10:37 2008 UTC (15 months, 3 weeks ago) by jasonruyle
Branch: MAIN
CVS Tags: DRUPAL-5--1-1, HEAD
Branch point for: DRUPAL-5
File MIME type: text/x-php
Initial commit of logouttab module.  Adds a log out tab to your user profile.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Adds a logout tab to the profile area
7 *
8 */
9
10 /**
11 * Implementation of hook_menu().
12 */
13
14 function logouttab_menu($may_cache) {
15
16 $items = array();
17 if ($may_cache) {
18 $items[] = array(
19 'path' => 'admin/settings/useraccounthelp',
20 'title' => t('User Account helppage settings'),
21 'description' => t('Choose the page that the user account help tab link goes to.'),
22 'callback' => 'drupal_get_form',
23 'callback arguments' => array('logouttab_admin_settings'),
24 'access' => user_access('administer site configuration')
25 );
26 }
27
28 //testing to make sure we're in a user profile...
29 if (arg(0) == 'user' && is_numeric(arg(1))) {
30
31
32
33 $helpurl = variable_get('logouttab_url', 'logout');
34
35 // User help page
36 $items[] = array(
37 'path' => "user/". arg(1) ."/". $helpurl,
38 'title' => t('Logout'),
39 'weight' => 8,
40 'callback' => 'send_to_help_page', 'callback arguments' => $helpurl,
41 //'access' => user_access('maintain own subscriptions'),
42 'type' => MENU_LOCAL_TASK,
43 );
44
45
46 }
47
48 return $items;
49
50 }
51
52 function
53 send_to_help_page($helpurl) {
54
55 drupal_goto($path = $helpurl);
56
57 }
58
59 /**
60 * Define the settings form.
61 */
62
63 function logouttab_admin_settings() {
64
65 $form['logouttab_url'] = array(
66 '#type' => 'textfield',
67 '#title' => t('URL for the account help page'),
68 '#description' => t('Enter the relative path for the user account help page.'),
69 '#default_value' => variable_get('logouttab_url', 'logout'),
70 '#title' => t('URL'),
71 );
72
73 return system_settings_form($form);
74 }

  ViewVC Help
Powered by ViewVC 1.1.2