function sbp_users_sbp_settings in Search by Page 6
Same name and namespace in other branches
- 7 sbp_users.module \sbp_users_sbp_settings()
Implementation of Search by Page hook_sbp_settings().
Adds a user role selection form to the Search by Page settings page.
File
- ./
sbp_users.module, line 145 - Module file for Search by Page Users, a sub-module for Search by Page.
Code
function sbp_users_sbp_settings($environment) {
$form = array();
$form['sbp_users'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#weight' => -20,
'#title' => t('Users'),
);
$form['sbp_users']['sbp_users_roles_indexed'] = array(
'#type' => 'checkboxes',
'#title' => t('User roles to index'),
'#default_value' => search_by_page_setting_get('sbp_users_roles_indexed', $environment, array()),
'#options' => user_roles(TRUE),
'#weight' => 0,
'#description' => t('Choose which user roles you would like to have indexed by Search by Page. If you select "authenticated user", you will get all users registered on your site.'),
);
// Give language options if there is more than one language on the site.
$langs = language_list();
if (count($langs) > 1) {
$form['sbp_users']['sbp_users_language'] = array(
'#type' => 'radios',
'#title' => t('Language(s) to use when indexing user pages'),
'#default_value' => search_by_page_setting_get('sbp_users_language', $environment, 'all'),
'#options' => array(
'all' => t('All available languages'),
'user' => t("Each profile in that user's preferred language only"),
),
'#weight' => 2,
'#description' => t("If you choose <em>All available languages</em>, each profile will be indexed several times, with the viewing language set to each available language in turn, which may result in either content, field labels, or both changing to the viewing language. If you choose to index the profile in the user's preferred language only, each page will be indexed only in one language. In either case, when a search is done, only content in the current language will be selected."),
);
}
$form['sbp_users']['sbp_users_role'] = array(
'#type' => 'radios',
'#title' => t('Role for indexing'),
'#options' => user_roles(),
'#default_value' => search_by_page_setting_get('sbp_users_role', $environment, DRUPAL_ANONYMOUS_RID),
'#weight' => 4,
'#description' => t("When Search by Page indexes pages for searching, the pages will be viewed from the perspective and permissions of a user with this role."),
);
$times = array(
'1' => t('1 second'),
'3600' => t('1 hour'),
'86400' => t('1 day'),
'604800' => t('1 week'),
'31449600' => t('1 year'),
'0' => t('Never'),
);
$form['sbp_users']['sbp_users_min_time'] = array(
'#type' => 'select',
'#title' => t('Minimum reindexing time'),
'#options' => $times,
'#default_value' => search_by_page_setting_get('sbp_users_min_time', $environment, 1),
'#weight' => 5,
'#description' => t("After indexing any new and updated user pages, Search by Page also cycles through previously-indexed user pages, in case the rendered view of the user page has changed (even though the user account information has not been edited, other information displayed on the page may have changed, such as points, ratings, a list of content the user has created, a Twitter feed, or a Content Profile). On some sites, you may want to limit the amount of reindexing, by setting a minimum time -- user pages will not be reindexed until this time has passed, unless the user account information has been updated."),
);
$form['sbp_users']['sbp_users_max_time'] = array(
'#type' => 'select',
'#title' => t('Maximum reindexing time'),
'#options' => $times,
'#default_value' => search_by_page_setting_get('sbp_users_max_time', $environment, 0),
'#weight' => 6,
'#description' => t("Conversely to the minimum reindexing time (see above), Search by Page can be set to prioritize reindexing each user page (by marking it as needing immediate reindexing) after this amount of time has passed. This has higher priority than the cycle-through reindexing of the setting above.") . ' ' . t('But be careful with this setting! If you set it too small, it can interfere with new content being indexed, because the reindexed content will have equal priority to content that has never been indexed. So make sure your settings allow for enough time for new content to be indexed before forcing reindexing.'),
);
return $form;
}