From 20c0df9c4541fe9e3e97d57dfb2726c2ad08b6cb Mon Sep 17 00:00:00 2001 From: Tristan Olive Date: Sun, 15 Sep 2013 23:31:05 -0400 Subject: [PATCH] Account profile menu Moved profile form out of Account Info and into Profile -> Edit. (DBOINCP-11) --- .../boinc_standard.strongarm.inc | 2 +- .../boinc/modules/boincuser/boincuser.module | 34 +++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drupal/sites/all/features/boinc_standard/boinc_standard.strongarm.inc b/drupal/sites/all/features/boinc_standard/boinc_standard.strongarm.inc index 56f7a145c4..7cd3f196da 100644 --- a/drupal/sites/all/features/boinc_standard/boinc_standard.strongarm.inc +++ b/drupal/sites/all/features/boinc_standard/boinc_standard.strongarm.inc @@ -530,7 +530,7 @@ function boinc_standard_strongarm() { ), 'user/%/edit/profile' => array( 'weight' => '1', - 'action' => 'enabled', + 'action' => 'hidden', 'tabtamer_original_path' => 'user/%user_category/edit/profile', 'tabtamer_title' => '', ), diff --git a/drupal/sites/default/boinc/modules/boincuser/boincuser.module b/drupal/sites/default/boinc/modules/boincuser/boincuser.module index bc06d1c2ca..957f40058f 100644 --- a/drupal/sites/default/boinc/modules/boincuser/boincuser.module +++ b/drupal/sites/default/boinc/modules/boincuser/boincuser.module @@ -28,11 +28,27 @@ require_once('includes/boincuser.helpers.inc'); */ function boincuser_menu() { $items['account/profile'] = array( - 'title' => 'Profile', + 'title' => '', + 'description' => '', + 'page callback' => 'boincuser_view_profile', + 'access arguments' => array('access content'), + 'type' => MENU_NORMAL_ITEM + ); + $items['account/profile/view'] = array( + 'title' => 'View', 'description' => 'Show a user profile', 'page callback' => 'boincuser_view_profile', 'access arguments' => array('access content'), - 'type' => MENU_CALLBACK + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => 0 + ); + $items['account/profile/edit'] = array( + 'title' => 'Edit', + 'description' => 'Edit a user profile', + 'page callback' => 'boincuser_edit_profile', + 'access arguments' => array('access content'), + 'type' => MENU_LOCAL_TASK, + 'weight' => 5 ); $items['join'] = array( 'title' => '', @@ -588,6 +604,20 @@ function boincuser_view_profile($account = null) { return theme('user_profile', $account); } +/** + * Page callback for editing a user profile + */ +function boincuser_edit_profile($account = null) { + // Create the user profile form + if (!$account) { + global $user; + $account = $user; + } + // Render the form + module_load_include('pages.inc', 'node', 'node'); + return content_profile_page_edit('profile', $account); +} + /** * Join page menu callback. * Display instructions on joining for new or existing BOINC users