You are here

function nodewords_user in Nodewords: D6 Meta Tags 6.3

Same name and namespace in other branches
  1. 6 nodewords.module \nodewords_user()
  2. 6.2 nodewords.module \nodewords_user()

Implements hook_user().

File

./nodewords.module, line 205
Implement an version that other modules can use to add meta tags.

Code

function nodewords_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'load':
      $account->nodewords['metatags'] = nodewords_load_tags(array(
        'type' => NODEWORDS_TYPE_USER,
        'id' => $account->uid,
      ));
      break;
    case 'delete':
      nodewords_delete_tags(array(
        'type' => NODEWORDS_TYPE_USER,
        'id' => $account->uid,
      ));
      break;
    case 'insert':
    case 'update':
      if (isset($edit['nodewords']['metatags'])) {
        nodewords_save_tags($edit['nodewords']['metatags'], array(
          'type' => NODEWORDS_TYPE_USER,
          'id' => $account->uid,
        ));
        unset($edit['nodewords']);
        unset($account->nodewords);
      }
      break;
  }
}