You are here

function user_avatar_block_block_view in Upload default avatar (user picture) 7

Implements hook_block_view().

File

user_avatar_block/user_avatar_block.module, line 98
user_avatar_block.module

Code

function user_avatar_block_block_view($delta) {
  $block = array();
  $block['subject'] = t('Anonymous');
  $settings = l(t('account settings'), 'admin/config/people/accounts');
  $smile = '<p>;)</p>';
  if (variable_get('user_pictures', 0) == 0) {
    $block['content'] = $smile;
    drupal_set_message(filter_xss(t('Go to !settings to enable user pictures, first.', array(
      '!settings' => $settings,
    )), $allowed_tags = array(
      'a',
    )), 'warning');
  }
  elseif (variable_get('upload_default_avatar_fid') == '') {
    $block['content'] = $smile;
    drupal_set_message(filter_xss(t('Go to !settings to upload default user picture.', array(
      '!settings' => $settings,
    )), $allowed_tags = array(
      'a',
    )), 'warning');
  }
  elseif (variable_get('user_avatar_block_style') == '0') {
    $block['content'] = $smile;
    drupal_set_message(filter_xss(t('!block_config to assign image style to user avatar showing in this block.', array(
      '!block_config' => l(t('Configure User avatar block'), 'admin/structure/block/manage/' . $delta . '/' . $delta . '/configure', array(
        'query' => drupal_get_destination(),
      )),
    )), $allowed_tags = array(
      'a',
    )), 'warning');
  }
  else {
    $block['content'] = user_avatar_block_contents($delta);
  }
  return $block;
}