For anonymous users change the 'Join' link to 'Login to join' with Login as a link.

Comments

sapark’s picture

Here's how I got it to work. I changed the og_subscribe_link function in og.module to make the Join link for anonymous users go to the user login:


function og_subscribe_link($node) {
  if ($node->og_selective == OG_MODERATED) {
    $txt = t('Request membership');
  }
  elseif ($node->og_selective == OG_OPEN) {
    if (user_is_anonymous()) {
      $txt = t('<a href="user">Join</a>');
      }
    else {
      $txt = t('Join');
    }
  }

  if(isset($txt) && !user_is_anonymous()) {
    return l($txt, "og/subscribe/$node->nid", array('attributes' => array('rel' => 'nofollow'), 'query' => drupal_get_destination()));
  } 
  elseif (isset($txt) && user_is_anonymous()) {
    return $txt;
  }
}

and commented out the user message in ob_subscribe function:

function og_subscribe($node, $uid = NULL) {
  global $user;
  if (is_null($uid)) {
    if ($user->uid) {
      $account = $user;
    }
//    else {
//      drupal_set_message(t('In order to join this group, you must login or register a new account. After you have successfully done so, you will need to request membership again.'));
//      drupal_goto('user');
//    }
  }
  else {
    $account = user_load(array('uid' => $uid));
  }

  if ($node->og_selective >= OG_INVITE_ONLY || $node->status == 0 || !og_is_group_type($node->type)) {
    drupal_access_denied();
    exit();
  }
Equ’s picture

Are there any different ways to do that? I also need this...

jackbravo’s picture

Version: 6.x-1.0 » 6.x-1.3

is there a way to do this by not modifying the og module?

like with a theme function or an override or something?

Grayside’s picture

Status: Active » Closed (fixed)

You can use the String Overrides module, or the locale variable in the settings.php file that it uses to do string conversions.

Since it has been several years since the last post, and it is a general support question, marking this as closed.