Active
Project:
User Tabs
Version:
6.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2009 at 15:30 UTC
Updated:
6 Oct 2009 at 00:43 UTC
hope this helps others, i did not know where else to place it?
i changed the module and now got this and as far as i can tell it works
after cleearing cache inside drupal itself and browser couple of times to make sure?
will keep playing with it to add some more
let me know what you think of it?
p.s. one can /should add the weight to the blog part ofcourse
but that depends on what other stuff one adds what number to give it
----------------------------
<?php
// $Id: usertabs.module,v 1.2 2009/02/15 18:41:37 robertgarrigos Exp $
/**
* @file
* usertabs.module
*
* This module puts the tab for the edition of the user account under the view tab
*
* © Copyright 2009 Robert Garrigos.
* \author Robert Garrigos http://garrigos.cat
*/
/**
* Implementation of hook_help().
*/
function usertabs_help($page, $arg) {
switch ($page) {
case 'admin/help#usertabs':
return '<p>'. t('User Tabs places the usual edit account tab, which is displayed as a primary tab menu item by default, as a subtab of the view account tab. You should only activate this module if you have more than one primary tab menu items as when you active the contact module, otherwise you may end up with two secondary tabs with no primary tab. This is due to the way the drupal menu system works.') .'</p>';
}
}
/**
* Implementation of hook_menu().
*/
function usertabs_menu() {
$items['user/%user_category/edit/view'] = array(
'title' => 'View',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
'load arguments' => array('%map', '%index'),
);
$items['user/%user/edit'] = array(
'title' => 'Account',
'type' => MENU_DEFAULT_LOCAL_TASK,
'page callback' => 'usertabs_goto',
'page arguments' => array(1),
'access callback' => 'user_edit_access',
'access arguments' => array(1),
'weight' => -10,
);
$items['user/%user/blog'] = array(
'title' => 'My blog',
'page callback' => 'blog_page_user',
'page arguments' => array(1),
'access callback' => TRUE,
'acces arguments' => array (1),
'file' => 'blog.pages.inc',
'type' => MENU_LOCAL_TASK,
);
return $items;
}
/**
* Implementation of hook_menu_alter().
*/
function usertabs_menu_alter(&$callbacks) {
unset($callbacks['user/%user/view']);
unset($callbacks['user/%user_category/edit']);
$callbacks['user/%user_category/edit/account']['type'] = MENU_LOCAL_TASK;
$callbacks['user/%user_category/edit/account']['page callback'] = 'usertabs_user_edit';
$callbacks['user/%user_category/edit/account']['page arguments'] = array(1);
$callbacks['user/%user_category/edit/account']['title'] = 'Edit My Account';
$callbacks['user/%user_category/edit/account']['access callback'] = 'user_edit_access';
$callbacks['user/%user_category/edit/account']['access arguments'] = array(1);
}
/**
* Form builder; Present the form to edit a given user or profile category.
*
* @ingroup forms
* @see user_edit_validate()
* @see user_edit_submit()
*/
function usertabs_user_edit($account, $category = 'account') {
drupal_set_title(check_plain($account->name));
include_once (drupal_get_path('module', 'user') .'/user.pages.inc');
return drupal_get_form('user_profile_form', $account, $category);
}
function usertabs_goto($user) {
$dest = drupal_get_destination();
// we need to unset this otherwise drupal_goto gets into a loop and goes straight to the destination url
unset($_REQUEST['destination']);
unset($_REQUEST['edit']['destination']);
drupal_goto("user/$user->uid/edit/account", $dest);
}
Comments
Comment #1
Kit_Hally commentedoops forgot to say
copy core
../modules/blog/blog.pages.inc
in to the usertabs module file
../sites/all/modules/usertabs
so that it contains :
usertabs.info
usertabs.module
LICENSE.txt
blog.pages.inc
------------------------------------
update changed usertabs.module now got this:
Comment #2
toth_O commentedHi,
It can be done with user board module too.