Great work on the Glossary module. I use it on a number of sites. I am working on a larger site that uses Advanced profile to collect and store a lot of user information in the users profile. The info is split into multiple categories. The problem I discovered is that the Glossary form used to disable glossary indicators appears in all of the categories. I think it should only appear on the main Account edit page.
I have modified the glossary_user() function in the glossary.module file to be category aware. I have also made the function use standard D6 hook_user() variables.
ORIGINAL CODE
/**
* Implementation of hook_user().
*/
function glossary_user($type, $edit, $user) {
switch ($type) {
case 'form':
// Note: this requires a setting. Do we also need to clear cache if selected?
if (variable_get('glossary_disable_indicator', FALSE)) {
$form['content_glossary'] = array(
'#type' => 'fieldset',
'#title' => t('Glossary Indicators'),
);
$form['content_glossary']['glossary_disable_indicator'] = array(
'#type' => 'checkbox',
'#title' => t('Disable Glossary indicators'),
'#return_value' => 1,
'#default_value' => $user->glossary_disable_indicator,
'#description' => t('Check this box to disable the display of Glossary indicators.'),
);
return $form;
}
break;
}
}
NEW CODE
/**
* Implementation of hook_user().
*/
function glossary_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'form':
// Note: this requires a setting. Do we also need to clear cache if selected?
if (variable_get('glossary_disable_indicator', FALSE) && $category == 'account') {
$form['content_glossary'] = array(
'#type' => 'fieldset',
'#title' => t('Glossary Indicators'),
);
$form['content_glossary']['glossary_disable_indicator'] = array(
'#type' => 'checkbox',
'#title' => t('Disable Glossary indicators'),
'#return_value' => 1,
'#default_value' => $account->glossary_disable_indicator,
'#description' => t('Check this box to disable the display of Glossary indicators.'),
);
return $form;
}
break;
}
}
I have tested this code on Glossary 6.x-1.6 and it works great. Thanks again for the great module.
Comment | File | Size | Author |
---|---|---|---|
#2 | glossary_in_all_profile_categories-816402-2.patch | 591 bytes | tinker |
Comments
Comment #1
tinker CreditAttribution: tinker commentedAny chance this can get committed?
Comment #2
tinker CreditAttribution: tinker commentedThis bug still exists in 6.x-1.x-dev. I have attached a one line patch. This bug has been in queue with a solution for over a year during which time the fix has been running on multiple sites without issue. Any chance it could be committed?
Comment #3
NancyDru