Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/10/2014 02:03:21 AM (11 years ago)
Author:
boonebgorges
Message:

Introduce bp_group_is_invited(), and use it to improve private group message for non-members

When non-member visits a private group of which she is not a member, she now
sees a message that tells her to accept her pending invitation.

Fixes #5510

Props hnla

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-template.php

    r8397 r8411  
    16261626
    16271627/**
     1628 * Check whether the current user has an outstanding invite to the current group in the loop.
     1629 *
     1630 * @param object $group Optional. Group data object. Defaults to the current
     1631 *        group in the groups loop.
     1632 * @return bool True if the user has an outstanding invite, otherwise false.
     1633 */
     1634function bp_group_is_invited( $group = false ) {
     1635    global $groups_template;
     1636
     1637    if ( empty( $group ) ) {
     1638        $group =& $groups_template->group;
     1639    }
     1640
     1641    return apply_filters( 'bp_group_is_invited', ! empty( $group->is_invited ) );
     1642}
     1643
     1644/**
    16281645 * Checks if a user is banned from a group.
    16291646 *
     
    19561973    if ( 'private' == $group->status ) {
    19571974        if ( ! bp_group_has_requested_membership() ) {
    1958             if ( is_user_logged_in() )
     1975            if ( is_user_logged_in() && bp_group_is_invited() ) {
     1976                $message = __( 'You must accept your pending invitation before you can access this private group.', 'buddypress' );
     1977            } else if ( is_user_logged_in() ) {
    19591978                $message = __( 'This is a private group and you must request group membership in order to join.', 'buddypress' );
    1960             else
     1979            } else {
    19611980                $message = __( 'This is a private group. To join you must be a registered site member and request group membership.', 'buddypress' );
     1981            }
    19621982
    19631983        } else {
Note: See TracChangeset for help on using the changeset viewer.