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

hass’s picture

Status: Active » Closed (cannot reproduce)

No idea what module you are use. Move over, please. Closing here as both ga and piwik have no vertical user tabs.

deanflory’s picture

Status: Closed (cannot reproduce) » Closed (works as designed)

Please 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

Enable user tracking

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?

hass’s picture

How have you created these vertical tabs?

deanflory’s picture

I 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.

hass’s picture

Was just interrested how I could move these fieldsets on my site in a vertical tab, too...

deanflory’s picture

Use 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