You are here

function drupagram_account_form in Drupagram 6

Same name and namespace in other branches
  1. 7 drupagram.pages.inc \drupagram_account_form()

Form to add a Instagram account

If OAuth is not enabled, a text field lets users to add their Instagram screen name. If it is, a submit button redirects to Instagram.com asking for authorisation.

1 string reference to 'drupagram_account_form'
drupagram_user_settings in ./drupagram.pages.inc

File

./drupagram.pages.inc, line 139
Provieds drupagram forms.

Code

function drupagram_account_form() {
  global $user;
  if (empty($account)) {
    $account = $user;
  }
  $form['uid'] = array(
    '#type' => 'value',
    '#value' => $account->uid,
  );
  if (_drupagram_use_oauth()) {
    $form['#validate'] = array(
      'drupagram_account_oauth_validate',
    );
  }
  elseif ($user->uid == 1 || user_access('add drupagram accounts')) {
    $form['error_message'] = array(
      '#type' => 'item',
      '#title' => t('Link your Instagram to this account'),
      '#value' => t('oAuth Settings have not been set up. Please !fix this issue and try again.', array(
        '!fix' => l('fix', 'admin/config/services/drupagram'),
      )),
    );
  }
  $form['import'] = array(
    '#type' => 'checkbox',
    '#title' => t('Import statuses from this account'),
    '#default_value' => TRUE,
    '#access' => FALSE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add account'),
    '#access' => _drupagram_use_oauth(),
  );
  return $form;
}