diff --git a/modules/og_views/includes/og_views_handler_field_og_subscribe.inc b/modules/og_views/includes/og_views_handler_field_og_subscribe.inc index 3e549eb..e5f3a6b 100644 --- a/modules/og_views/includes/og_views_handler_field_og_subscribe.inc +++ b/modules/og_views/includes/og_views_handler_field_og_subscribe.inc @@ -25,7 +25,7 @@ class og_views_handler_field_og_subscribe extends views_handler_field { case OG_INVITE_ONLY: return ''. t('Invite only'). ''; default: - return og_subscribe_link(node_load((int)$values->{$this->aliases['nid']})); + return theme('og_subscribe_link', node_load((int)$values->{$this->aliases['nid']})); } } } diff --git a/og.module b/og.module index df159c5..09b7ea8 100644 --- a/og.module +++ b/og.module @@ -426,6 +426,7 @@ function og_theme() { 'opml_icon' => array('arguments' => array('url')), 'og_format_subscriber_status' => array('arguments' => array('group')), 'og_mission' => array('template' => 'og-mission', 'arguments' => array('form' => NULL), 'path' => drupal_get_path('module', 'og'). '/theme'), + 'og_subscribe_link' => array('arguments' => array('node')), ); } @@ -2598,7 +2599,7 @@ function og_block_details() { $links['manager'] = t('Manager: !name', array('!name' => theme('username', $account))); // Site admins get a Join link if they are not yet subscribed. - $subscribe = isset($subscription) && og_is_group_member($node->nid, FALSE) ? l(t('My membership'), "og/manage/$node->nid") : og_subscribe_link($node); + $subscribe = isset($subscription) && og_is_group_member($node->nid, FALSE) ? l(t('My membership'), "og/manage/$node->nid") : theme('og_subscribe_link', $node); if(isset($subscribe)) { $links['my_membership'] = $subscribe; } @@ -2617,7 +2618,7 @@ function og_block_details() { } } elseif ($node->og_selective < OG_INVITE_ONLY) { - $links['subscribe'] = og_subscribe_link($node); + $links['subscribe'] = theme('og_subscribe_link', $node); } elseif ($node->og_selective == OG_INVITE_ONLY) { $links['closed'] = t('This is an invite only group. The group administrators add/remove members as needed.'); @@ -2673,6 +2674,10 @@ function og_block_details() { * Node object of the group. * * @return string + * + * @deprecated + * This function is deprecated in favor of theme_og_subscribe_link(), which + * can be used to override the link's output. */ function og_subscribe_link($node) { if ($node->og_selective == OG_MODERATED) { @@ -2686,6 +2691,25 @@ function og_subscribe_link($node) { } /** + * Generate a link to join or request to join the specified group. + * + * @param $node + * Node object of the group. + * + * @return string + */ +function theme_og_subscribe_link($node) { + if ($node->og_selective == OG_MODERATED) { + $txt = t('Request membership'); + } + elseif ($node->og_selective == OG_OPEN) { + $txt = t('Join'); + } + if(isset($txt)) + return l($txt, "og/subscribe/$node->nid", array('attributes' => array('rel' => 'nofollow'), 'query' => drupal_get_destination())); +} + +/** * Implementation of hook_og_create_links(). * * @see og_details_block()