Posted by sapark on December 16, 2008 at 2:18pm
Jump to:
| Project: | Organic groups |
| Version: | 6.x-1.3 |
| Component: | og.module |
| Category: | feature request |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
For anonymous users change the 'Join' link to 'Login to join' with Login as a link.
Comments
#1
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:
<?php
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:
<?php
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();
}
?>
#2
Are there any different ways to do that? I also need this...
#3
is there a way to do this by not modifying the og module?
like with a theme function or an override or something?
#4
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.