Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Change location of Opt-in/out checkbox on User Account Edit to fall under the "Analytics & Tracking" vertical tab like Google Analytics so both are listed together in the same vertical tab if both are enabled to make it less confusing to the user.
Comments
Comment #1
hass CreditAttribution: hass commentedNo idea what module you are use. Move over, please. Closing here as both ga and piwik have no vertical user tabs.
Comment #2
deanflory CreditAttribution: deanflory commentedPlease disregard this issue and all this below. I simply had to move the field in to the vertical tab I'd created months ago. Sorry to waste your time. I thought it was a hardcoded vertical tab.
Disregard all this starting here:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Move over, please? Whaaaa? Was that supposed to be More info please?
Anywho, here's where they are located on my install:
usernamehere/account/edit
Analytics & Tracking tab:
Google Analytics configuration
[_] Enable user tracking
Users are tracked by default, but you are able to opt out.
Below the vertical tabs set, in it's own collapsible fieldset:
Piwik configuration
[_] Enable user tracking
Users are tracked by default, but you are able to opt out.
Here is the code on the account edit page, the fieldset mentioned just above:
Piwik configuration
Starting with line 301 of piwik.module, you will find the code for the tracking option:
/**
* Implement hook_form_FORM_ID_alter().
*
* Allow users to decide if tracking code will be added to pages or not.
*/
function piwik_form_user_profile_form_alter(&$form, &$form_state) {
$account = $form['#user'];
$category = $form['#user_category'];
if ($category == 'account' && user_access('opt-in or out of tracking') && ($custom = variable_get('piwik_custom', 0)) != 0 && _piwik_visibility_roles($account)) {
$form['piwik'] = array(
'#type' => 'fieldset',
'#title' => t('Piwik configuration'),
'#weight' => 3,
'#collapsible' => TRUE,
'#tree' => TRUE
);
switch ($custom) {
case 1:
$description = t('Users are tracked by default, but you are able to opt out.');
break;
case 2:
$description = t('Users are not tracked by default, but you are able to opt in.');
break;
}
$form['piwik']['custom'] = array(
'#type' => 'checkbox',
'#title' => t('Enable user tracking'),
'#description' => $description,
'#default_value' => isset($account->data['piwik']['custom']) ? $account->data['piwik']['custom'] : ($custom == 1),
);
return $form;
}
}
So, this isn't in a vertical tab. How can I make it display in the vertical tab I mentioned?
Comment #3
hass CreditAttribution: hass commentedHow have you created these vertical tabs?
Comment #4
deanflory CreditAttribution: deanflory commentedI believe that functionality belongs to the field_group module.
Again, sorry to waste your time, complete oversight on my part and a little sleep didn't hurt to clear the head after 20+ hours straight.
Comment #5
hass CreditAttribution: hass commentedWas just interrested how I could move these fieldsets on my site in a vertical tab, too...
Comment #6
deanflory CreditAttribution: deanflory commentedUse the Display Suite module and the Field Group module. Then create a Field Group of the type you need when Managing Fields or Managing Display and move your fields into the field group. See the info on those modules for more info
https://drupal.org/project/ds
https://drupal.org/project/field_group