diff --git src/bp-members/bp-members-adminbar.php src/bp-members/bp-members-adminbar.php
index 282be654c..c9ff861c0 100644
|
|
|
function bp_members_admin_bar_add_invitations_menu() { |
| 193 | 193 | return; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | | if ( is_user_logged_in() && bp_get_members_invitations_allowed() && ( bp_current_user_can( 'bp_members_send_invitation' ) || bp_members_invitations_user_has_sent_invites() ) ) { |
| | 196 | if ( bp_current_user_can( 'bp_members_invitations_view_screens' ) ) { |
| 197 | 197 | $bp = buddypress(); |
| 198 | 198 | $invitations_link = trailingslashit( bp_loggedin_user_domain() . bp_get_members_invitations_slug() ); |
| 199 | 199 | |
| … |
… |
function bp_members_admin_bar_add_invitations_menu() { |
| 209 | 209 | ) |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | | if ( bp_current_user_can( 'bp_members_send_invitation' ) ) { |
| | 212 | if ( bp_current_user_can( 'bp_members_invitations_view_send_screen' ) ) { |
| 213 | 213 | $wp_admin_bar->add_node( |
| 214 | 214 | array( |
| 215 | 215 | 'id' => $bp->my_account_menu_id . '-invitations-send', |
| 216 | 216 | 'parent' => $bp->my_account_menu_id . '-invitations', |
| 217 | 217 | 'title' => __( 'Send Invites', 'buddypress' ), |
| 218 | | 'href' => $invitations_link, |
| | 218 | 'href' => $invitations_link . 'send-invites/', |
| 219 | 219 | 'meta' => array( |
| 220 | 220 | 'class' => 'ab-sub-secondary' |
| 221 | 221 | ) |
diff --git src/bp-members/bp-members-filters.php src/bp-members/bp-members-filters.php
index d0d65e4fe..e244bf32d 100644
|
|
|
function bp_members_user_can_filter( $retval, $user_id, $capability, $site_id, $ |
| 149 | 149 | break; |
| 150 | 150 | |
| 151 | 151 | case 'bp_members_send_invitation': |
| 152 | | if ( bp_get_members_invitations_allowed() ) { |
| | 152 | if ( is_user_logged_in() && bp_get_members_invitations_allowed() ) { |
| 153 | 153 | $retval = true; |
| 154 | 154 | } |
| 155 | 155 | break; |
| … |
… |
function bp_members_user_can_filter( $retval, $user_id, $capability, $site_id, $ |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 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 = bp_user_can( $user_id, 'bp_members_send_invitation' ); |
| | 177 | break; |
| 170 | 178 | } |
| 171 | 179 | |
| 172 | 180 | return $retval; |
diff --git src/bp-members/bp-members-invitations.php src/bp-members/bp-members-invitations.php
index 2a04c3dbd..a89b9f54a 100644
|
|
|
function bp_members_invitations_setup_nav() { |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | | $user_has_access = bp_user_has_access(); |
| 19 | | $user_can_send = bp_user_can( bp_displayed_user_id(), 'bp_members_send_invitation' ); |
| 20 | | $user_has_invites = bp_members_invitations_user_has_sent_invites( bp_displayed_user_id() ); |
| | 18 | $user_has_access = bp_user_has_access(); |
| | 19 | $default_subnav_slug = ( bp_is_my_profile() && bp_user_can( bp_displayed_user_id(), 'bp_members_invitations_view_send_screen' ) ) ? 'send-invites' : 'list-invites'; |
| 21 | 20 | |
| 22 | 21 | /* Add 'Invitations' to the main user profile navigation */ |
| 23 | 22 | bp_core_new_nav_item( |
| … |
… |
function bp_members_invitations_setup_nav() { |
| 26 | 25 | 'slug' => bp_get_members_invitations_slug(), |
| 27 | 26 | 'position' => 80, |
| 28 | 27 | 'screen_function' => 'members_screen_send_invites', |
| 29 | | 'default_subnav_slug' => ( $user_can_send && bp_is_my_profile() ) ? 'send-invites' : 'list-invites', |
| 30 | | 'show_for_displayed_user' => $user_has_access && ( $user_can_send || $user_has_invites ) |
| | 28 | 'default_subnav_slug' => $default_subnav_slug, |
| | 29 | 'show_for_displayed_user' => $user_has_access && bp_user_can( bp_displayed_user_id(), 'bp_members_invitations_view_screens' ) |
| 31 | 30 | ) |
| 32 | 31 | ); |
| 33 | 32 | |
| … |
… |
function bp_members_invitations_setup_nav() { |
| 42 | 41 | 'parent_url' => $parent_link, |
| 43 | 42 | 'screen_function' => 'members_screen_send_invites', |
| 44 | 43 | 'position' => 10, |
| 45 | | 'user_has_access' => $user_has_access && $user_can_send && bp_is_my_profile() |
| | 44 | 'user_has_access' => $user_has_access && bp_is_my_profile() && bp_user_can( bp_displayed_user_id(), 'bp_members_invitations_view_send_screen' ) |
| 46 | 45 | ) |
| 47 | 46 | ); |
| 48 | 47 | |
| … |
… |
function bp_members_invitations_setup_nav() { |
| 54 | 53 | 'parent_url' => $parent_link, |
| 55 | 54 | 'screen_function' => 'members_screen_list_sent_invites', |
| 56 | 55 | 'position' => 20, |
| 57 | | 'user_has_access' => $user_has_access && ( $user_can_send || $user_has_invites ) |
| | 56 | 'user_has_access' => $user_has_access && bp_user_can( bp_displayed_user_id(), 'bp_members_invitations_view_screens' ) |
| 58 | 57 | ) |
| 59 | 58 | ); |
| 60 | 59 | } |
diff --git src/bp-templates/bp-legacy/buddypress/members/single/invitations/send-invites.php src/bp-templates/bp-legacy/buddypress/members/single/invitations/send-invites.php
index 6eeb3b62f..5cd0af16c 100644
|
|
|
|
| 14 | 14 | ?> |
| 15 | 15 | </h2> |
| 16 | 16 | |
| | 17 | <?php if ( bp_user_can( bp_displayed_user_id(), 'bp_members_send_invitation' ) ) : ?> |
| | 18 | |
| 17 | 19 | <form class="standard-form members-invitation-form" id="members-invitation-form" method="post"> |
| 18 | 20 | <p class="description"><?php esc_html_e( 'Fill out the form below to invite a new user to join this site. Upon submission of the form, an email will be sent to the invitee containing a link to accept your invitation. You may also add a custom message to the email.', 'buddypress' ); ?></p> |
| 19 | 21 | |
| … |
… |
|
| 30 | 32 | <input id="submit" type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Send Invitation', 'buddypress' ) ?>" /> |
| 31 | 33 | </p> |
| 32 | 34 | </form> |
| | 35 | |
| | 36 | <?php else : ?> |
| | 37 | |
| | 38 | <p class="bp-feedback error"> |
| | 39 | <span class="bp-icon" aria-hidden="true"></span> |
| | 40 | <span class="bp-help-text"> |
| | 41 | <?php echo apply_filters( 'members_invitations_form_access_restricted', esc_html__( 'Sorry, you are not allowed to send invitations.', 'buddypress' ) ); ?> |
| | 42 | </span> |
| | 43 | </p> |
| | 44 | |
| | 45 | <?php endif; ?> |
diff --git src/bp-templates/bp-nouveau/buddypress/members/single/invitations/send-invites.php src/bp-templates/bp-nouveau/buddypress/members/single/invitations/send-invites.php
index 077c1fa24..b9b80f707 100644
|
|
|
|
| 13 | 13 | ?> |
| 14 | 14 | </h2> |
| 15 | 15 | |
| | 16 | <?php if ( bp_user_can( bp_displayed_user_id(), 'bp_members_send_invitation' ) ) : ?> |
| | 17 | |
| 16 | 18 | <p class="bp-feedback info"> |
| 17 | 19 | <span class="bp-icon" aria-hidden="true"></span> |
| 18 | 20 | <span class="bp-help-text"> |
| … |
… |
|
| 36 | 38 | |
| 37 | 39 | <?php bp_nouveau_submit_button( 'member-send-invite' ); ?> |
| 38 | 40 | </form> |
| | 41 | |
| | 42 | <?php else : ?> |
| | 43 | |
| | 44 | <p class="bp-feedback error"> |
| | 45 | <span class="bp-icon" aria-hidden="true"></span> |
| | 46 | <span class="bp-help-text"> |
| | 47 | <?php echo apply_filters( 'members_invitations_form_access_restricted', esc_html__( 'Sorry, you are not allowed to send invitations.', 'buddypress' ) ); ?> |
| | 48 | </span> |
| | 49 | </p> |
| | 50 | |
| | 51 | <?php endif; ?> |