You are here

function login_shadowbox_block_view in Shadowbox 7.4

Implementation of hook_block_view()

File

login_shadowbox/login_shadowbox.module, line 153

Code

function login_shadowbox_block_view($delta = '') {
  $block = array();
  $items = array();
  if ($delta == 'login_shadowbox_login_block' && !(arg(0) == 'user' && !is_numeric(arg(1)))) {
    if (user_is_anonymous()) {
      $block['subject'] = t('Login');
      $items[] = l(t('Login'), 'user/login', array(
        'attributes' => array(
          'title' => t('Login'),
        ),
      ));
      if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
        $items[] = l(t('Create new account'), 'user/register', array(
          'attributes' => array(
            'title' => t('Create a new user account.'),
          ),
        ));
      }
      $items[] = l(t('Request new password'), 'user/password', array(
        'attributes' => array(
          'title' => t('Request new password via e-mail.'),
        ),
      ));
      $block['content'] = theme('item_list', array(
        'items' => $items,
      ));
    }
    else {
      if (variable_get('login_shadowbox_login_block_visibility', 0)) {
        $block['subject'] = t('Login');
        $items[] = l(t('My Account'), 'user', array(
          'attributes' => array(
            'title' => t('My Account'),
          ),
        ));
        $items[] = l(t('Log out'), 'user/logout', array(
          'attributes' => array(
            'title' => t('Log out'),
          ),
        ));
        $block['content'] = theme('item_list', array(
          'items' => $items,
        ));
      }
    }
    return $block;
  }
}