Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/10/2021 03:07:41 PM (3 years ago)
Author:
dcavins
Message:

Member Invites: Centralize access logic.

  • User must be logged in to pass bp_members_send_invitation cap.
  • Add new capabilities bp_members_invitations_view_screens

and bp_members_invitations_view_send_screen.

  • Use new capabilities in bp_members_admin_bar_add_invitations_menu()

and bp_members_invitations_setup_nav() so that the logic is
consistent in both places.

See #8139.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-filters.php

    r12930 r12945  
    150150
    151151        case 'bp_members_send_invitation':
    152             if ( bp_get_members_invitations_allowed() ) {
     152            if ( is_user_logged_in() && bp_get_members_invitations_allowed() ) {
    153153                $retval = true;
    154154            }
     
    167167                }
    168168            }
     169            break;
     170
     171        case 'bp_members_invitations_view_screens':
     172            $retval = bp_get_members_invitations_allowed() && ( bp_user_can( $user_id, 'bp_members_send_invitation' ) || bp_members_invitations_user_has_sent_invites( $user_id ) );
     173            break;
     174
     175        case 'bp_members_invitations_view_send_screen':
     176            $retval = is_user_logged_in() && bp_get_members_invitations_allowed();
    169177            break;
    170178    }
Note: See TracChangeset for help on using the changeset viewer.