Skip to:
Content

BuddyPress.org

Changeset 12946


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

Member Invites: Add "not allowed" message to invite send form.

BuddyPress Core will not allow you to access the send form
unless you have the bp_members_send_invitation
capability, so this message will generally not be accessed.
However, if a plugin wishes to allow access to the "send"
screen but prevent sending in order to display an error
message, this message will be used.

Props imath.

See #8139.

Location:
trunk/src/bp-templates
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/send-invites.php

    r12922 r12946  
    1414        ?>
    1515</h2>
     16
     17<?php if ( bp_user_can( bp_displayed_user_id(), 'bp_members_send_invitation' ) ) : ?>
    1618
    1719<form class="standard-form members-invitation-form" id="members-invitation-form" method="post">
     
    3133        </p>
    3234</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; ?>
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/send-invites.php

    r12921 r12946  
    1414</h2>
    1515
    16 <p class="bp-feedback info">
    17         <span class="bp-icon" aria-hidden="true"></span>
    18         <span class="bp-help-text">
    19                 <?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' ); ?>
    20         </span>
    21 </p>
     16<?php if ( bp_user_can( bp_displayed_user_id(), 'bp_members_send_invitation' ) ) : ?>
    2217
    23 <form class="standard-form network-invitation-form" id="network-invitation-form" method="post">
    24         <label for="bp_members_invitation_invitee_email">
    25                 <?php esc_html_e( 'Email', 'buddypress' ); ?>
    26                 <span class="bp-required-field-label"><?php esc_html_e( '(required)', 'buddypress' ); ?></span>
    27         </label>
    28         <input id="bp_members_invitation_invitee_email" type="email" name="invitee_email" required="required">
     18        <?php bp_nouveau_user_feedback( 'member-invitations-help' ); ?>
    2919
    30         <label for="bp_members_invitation_message">
    31                 <?php esc_html_e( 'Add a personalized message to the invitation (optional)', 'buddypress' ); ?>
    32         </label>
    33         <textarea id="bp_members_invitation_message" name="invite_message"></textarea>
     20        <form class="standard-form network-invitation-form" id="network-invitation-form" method="post">
     21                <label for="bp_members_invitation_invitee_email">
     22                        <?php esc_html_e( 'Email', 'buddypress' ); ?>
     23                        <span class="bp-required-field-label"><?php esc_html_e( '(required)', 'buddypress' ); ?></span>
     24                </label>
     25                <input id="bp_members_invitation_invitee_email" type="email" name="invitee_email" required="required">
    3426
    35         <input type="hidden" name="action" value="send-invite">
     27                <label for="bp_members_invitation_message">
     28                        <?php esc_html_e( 'Add a personalized message to the invitation (optional)', 'buddypress' ); ?>
     29                </label>
     30                <textarea id="bp_members_invitation_message" name="invite_message"></textarea>
    3631
    37         <?php bp_nouveau_submit_button( 'member-send-invite' ); ?>
    38 </form>
     32                <input type="hidden" name="action" value="send-invite">
     33
     34                <?php bp_nouveau_submit_button( 'member-send-invite' ); ?>
     35        </form>
     36
     37<?php else : ?>
     38
     39        <?php bp_nouveau_user_feedback( 'member-invitations-not-allowed' ); ?>
     40
     41<?php endif; ?>
  • trunk/src/bp-templates/bp-nouveau/includes/functions.php

    r12921 r12946  
    10911091                                'message' => __( 'Currently only your friends can invite you to groups. Uncheck the box to allow any member to send invites.', 'buddypress' ),
    10921092                        ),
    1093                         'member-invites-none'               => array(
     1093                        'member-invitations-help'           => array(
     1094                                'type'    => 'info',
     1095                                'message' => __( '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' ),
     1096                        ),
     1097                        'member-invitations-none'           => array(
    10941098                                'type'    => 'info',
    10951099                                'message' => __( 'There are no invitations to display.', 'buddypress' ),
     1100                        ),
     1101                        'member-invitations-not-allowed'    => array(
     1102                                'type'    => 'error',
     1103                                /**
     1104                                 * Use this filter to edit the restricted feedback message displayed into the Send invitation form.
     1105                                 *
     1106                                 * @since 8.0.0
     1107                                 *
     1108                                 * @param string $value The restricted feedback message displayed into the Send invitation form.
     1109                                 */
     1110                                'message' => apply_filters(
     1111                                        'members_invitations_form_access_restricted',
     1112                                        __( 'Sorry, you are not allowed to send invitations.', 'buddypress' )
     1113                                ),
    10961114                        ),
    10971115                )
Note: See TracChangeset for help on using the changeset viewer.