function wysiwyg_user_get_status in Wysiwyg 7.2
Same name and namespace in other branches
- 5.2 wysiwyg.module \wysiwyg_user_get_status()
- 5 wysiwyg.module \wysiwyg_user_get_status()
- 6.2 wysiwyg.module \wysiwyg_user_get_status()
- 6 wysiwyg.module \wysiwyg_user_get_status()
2 calls to wysiwyg_user_get_status()
- wysiwyg_form_user_profile_form_alter in ./
wysiwyg.module - Implements hook_form_FORM_ID_alter().
- wysiwyg_pre_render_text_format in ./
wysiwyg.module - Process a text format widget to load and attach editors.
File
- ./
wysiwyg.module, line 1034
Code
function wysiwyg_user_get_status($profile, $account = NULL) {
global $user;
if (!isset($account)) {
$account = $user;
}
// Default wysiwyg editor status information is only required on forms, so we
// do not pre-emptively load and attach this information on every user_load().
if (!isset($account->wysiwyg_status)) {
$account->wysiwyg_status = db_query("SELECT format, status FROM {wysiwyg_user} WHERE uid = :uid", array(
':uid' => $account->uid,
))
->fetchAllKeyed();
}
if (!empty($profile->preferences['user_choose']) && isset($account->wysiwyg_status[$profile->format])) {
$status = $account->wysiwyg_status[$profile->format];
}
else {
$status = isset($profile->preferences['default']) ? $profile->preferences['default'] : TRUE;
}
return (bool) $status;
}