You are here

function og_home_empty in Organic groups 6.2

Same name and namespace in other branches
  1. 5.8 og.module \og_home_empty()
  2. 5 og.module \og_home_empty()
  3. 5.2 og.module \og_home_empty()
  4. 5.3 og.module \og_home_empty()
  5. 5.7 og.module \og_home_empty()
  6. 6 og.module \og_home_empty()

Show a suitable message if there are no nodes posted to the current group.

Parameters

$node: Node object of the group.

See also

og_views_view_group()

1 call to og_home_empty()
og_views_view_group in modules/og_views/og_views.module
Embed the configured group homepage.

File

./og.module, line 1217
Code for the Organic Groups module.

Code

function og_home_empty($node) {
  global $user;
  $dest = drupal_get_destination();
  if (og_is_group_member($node->nid)) {
    $msg = t('No posts in this group.');
  }
  else {
    if (!$user->uid) {
      if (variable_get('user_register', 1) == 0) {
        $msg = t('No public posts in this group. You must <a href="!login">login</a> and become a member in order to post messages, and view any private posts.', array(
          '!login' => url("user/login", array(
            'query' => $dest,
          )),
        ));
      }
      else {
        $msg = t('No public posts in this group. You must <a href="!register">register</a> or <a href="!login">login</a> and become a member in order to post messages, and view any private posts.', array(
          '!register' => url("user/register", array(
            'query' => $dest,
          )),
          '!login' => url("user/login", array(
            'query' => $dest,
          )),
        ));
      }
    }
    elseif ($node->og_selective < OG_INVITE_ONLY) {
      $msg = t('No public posts in this group. Consider <a href="!url">joining this group</a> in order to view its posts.', array(
        '!url' => url("og/subscribe/{$node->nid}", array(
          'query' => $dest,
        )),
      ));
    }
    else {
      $msg = t('No public posts in this group.');
    }
  }
  drupal_set_message($msg);
}