function profile_module_manager_bundle_confirm in Profile Module Manager 7
Same name and namespace in other branches
- 7.2 profile_module_manager.admin.inc \profile_module_manager_bundle_confirm()
Callback function for admin/settings/bundles/list/confirm/%
1 string reference to 'profile_module_manager_bundle_confirm'
- profile_module_manager_menu in ./
profile_module_manager.module - Implements hook_menu().
File
- ./
profile_module_manager.admin.inc, line 169
Code
function profile_module_manager_bundle_confirm($bundle_name) {
$output = '';
if (variable_get('profile_module_manager_disable_enabling', 0) == 1) {
$output = '<p>' . variable_get('profile_module_manager_disable_enabling_text', 'The ability to enable bundles has been turned off.') . '</p>';
return $output;
}
$bundle_path = drupal_get_path('module', $bundle_name);
$bundle = drupal_parse_info_file($bundle_path . '/' . $bundle_name . '.info');
// Only tell users about logout if bundle requires logout.
if (isset($bundle['bundle_logout']) && $bundle['bundle_logout'] == 1) {
// List all currently logged in users
$interval = REQUEST_TIME - 900;
$items = db_query('SELECT u.uid, u.name, MAX(s.timestamp) AS max_timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp >= :interval AND s.uid > 0 GROUP BY u.uid, u.name ORDER BY max_timestamp DESC', array(
':interval' => $interval,
))
->fetchAll();
$users = '';
$users_count = count($items) - 1;
foreach ($items as $key => $item) {
if ($key == $users_count && $users_count != 0) {
$users .= 'and ' . $item->name . ',';
}
else {
$users .= $item->name . ', ';
}
}
$output = '<p>You are about to enable the ' . $bundle['name'] . ' Bundle. <strong>NOTE: When this process starts it will logout all users, except: ' . $users . ' from editing the site until the process is complete.</strong></p>';
}
else {
$output = '<p>You are about to enable the ' . $bundle['name'] . ' Bundle.</p>';
}
$output .= '<a href="' . $GLOBALS['base_url'] . '/admin/settings/bundles/list/enable/' . $bundle_name . '" title="Confirm"><div class="btn btn-primary">Confirm</div></a>';
$output .= '<a href="' . $GLOBALS['base_url'] . '/admin/settings/bundles/list/" title="Cancel"><div class="btn btn-default">Cancel</div></a>';
return $output;
}