You are here

function twitter_user in Twitter 5

Same name and namespace in other branches
  1. 6.5 twitter.module \twitter_user()
  2. 6.2 twitter.module \twitter_user()
  3. 6.3 twitter.module \twitter_user()
  4. 6.4 twitter.module \twitter_user()

Implementation of hook_user()

File

./twitter.module, line 8

Code

function twitter_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'form':
      $form['twitter'] = array(
        '#type' => 'fieldset',
        '#title' => t('Twitter settings'),
      );
      $form['twitter']['twitter_user'] = array(
        '#type' => 'textfield',
        '#title' => t('Username'),
        '#default_value' => $edit['twitter_user'],
        '#description' => t('The username (email address) associated with your twitter.com account'),
      );
      $form['twitter']['twitter_pass'] = array(
        '#type' => 'password',
        '#title' => t('Password'),
      );
      $form['twitter']['twitter_text'] = array(
        '#type' => 'textfield',
        '#title' => t('Text format'),
        '#default_value' => $edit['twitter_text'],
        '#description' => t('Format of the text to submit. Use !title and !url for the post title and url respectively.'),
      );
      return $form;
    case 'insert':
    case 'update':
      if (!empty($edit['twitter_user']) && !empty($edit['twitter_pass'])) {
        $edit['twitter_encrypted'] = base64_encode($edit['twitter_user'] . ':' . $edit['twitter_pass']);
      }
      unset($edit['twitter_pass']);
  }
}