function nodewords_user in Nodewords: D6 Meta Tags 6
Same name and namespace in other branches
- 6.3 nodewords.module \nodewords_user()
- 6.2 nodewords.module \nodewords_user()
Implements hook_user().
File
- ./
nodewords.module, line 678 - Implement an API that other modules can use to implement meta tags.
Code
function nodewords_user($op, &$edit, &$account, $category = NULL) {
global $user;
switch ($op) {
case 'load':
if (arg(0) == 'user' && !empty($account->uid) && variable_get('nodewords_enable_user_metatags', TRUE)) {
$account->nodewords = nodewords_load_tags(NODEWORDS_TYPE_USER, $account->uid);
}
break;
case 'delete':
nodewords_delete_tags(NODEWORDS_TYPE_USER, $account->uid);
break;
case 'insert':
case 'update':
if (isset($edit['nodewords'])) {
nodewords_save_tags(NODEWORDS_TYPE_USER, $account->uid, $edit['nodewords'], TRUE);
}
$edit['nodewords'] = NULL;
break;
case 'form':
$bool = (user_access('administer meta tags') || $user->uid == $account->uid) && variable_get('nodewords_enable_user_metatags', TRUE) && $category == 'account';
if ($bool) {
$tags = nodewords_load_tags(NODEWORDS_TYPE_USER, $account->uid);
$form['nodewords'] = nodewords_form(NODEWORDS_TYPE_USER, $tags);
return $form;
}
return array();
}
}