Closed (fixed)
Project:
Subscriptions
Version:
7.x-1.1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
2 May 2013 at 21:35 UTC
Updated:
2 May 2013 at 21:37 UTC
The module is great, you guys are doing awesome work!
I noticed a bunch of people asking about ways to simplify the user profile tabs for subscriptions. So I thought I'd add what I did, just incase it would be helpful to anyone else.
It's a bit of a weird workaround due to the default menu tab needing to be there, but only needing users to see the subscription type page.
/**
* hook_menu_alter().
*/
function HOOK_menu_alter(&$items) {
// Add a custom page callback function
$items['user/%user/subscriptions']= array(
'title' => 'Subscriptions',
'page arguments' => array(1),
// page callback will be a redirect
'page callback' => 'manage_subscriptions_url_redirect',
'access callback' => TRUE,
'type' => MENU_LOCAL_TASK,
);
return $items;
}
function manage_subscriptions_url_redirect() {
global $user;
if ($user->uid > 0) {
// redirect the regular subscriptions page to this simple one
drupal_goto('user/' . $user->uid . '/subscriptions/type');
}
else {
drupal_access_denied();
}
}Then if you want to modify the ../subscriptions/type page, you could use a hook_form_alter(). For example:
function HOOK_form_subscriptions_page_form_alter(&$form, &$form_state, $form_id) {
$form['header'][0]['#markup'] = t('');
// Add custom help text
$form ['footer']['#description'] = t('add some custom help text');
}And if you really don't want users to see the default local tab, when visiting the ../subscriptions/type page, you could use css.
.page-user-subscriptions-type .nav.nav-pills{
display: none;
}