You are here

function dialog_user_block in Dialog 6

Implementation of hook_block().

File

modules/dialog_user/dialog_user.module, line 43

Code

function dialog_user_block($op = 'list', $delta = 0, $edit = array()) {
  global $user;
  if ($op == 'list') {
    $blocks[0]['info'] = t('Dialog user login');

    // Not worth caching.
    $blocks[0]['cache'] = BLOCK_NO_CACHE;
    return $blocks;
  }
  else {
    if ($op == 'view') {
      $block = array();
      switch ($delta) {
        case 0:
          if (user_is_anonymous()) {
            dialog_add_js();
            $links = array();
            $links[] = l(t('Log in'), 'user/login/nojs', array(
              'attributes' => array(
                'class' => 'ctools-use-dialog',
              ),
            ));
            $links[] = l(t('Create a new account'), 'user/register/nojs', array(
              'attributes' => array(
                'class' => 'ctools-use-dialog',
              ),
            ));
            $block = array(
              'subject' => t('User login'),
              'content' => theme('item_list', $links),
            );
            return $block;
          }
      }
    }
  }
}