Skip to:
Content

BuddyPress.org

Changeset 12928


Ignore:
Timestamp:
04/28/2021 11:52:27 PM (3 years ago)
Author:
dcavins
Message:

Member Invites: Add setting to enable member invites.

Member invites are enabled on two levels:

  • Invites can be disabled in code by filtering

bp_is_active( 'members', 'invitations' ).

by visiting the BP settings > options and checking
"Allow registered members to invite people to join this network"

See #8139.

Location:
trunk/src/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/admin/bp-core-admin-settings.php

    r12725 r12928  
    183183}
    184184
     185/**
     186 * Allow members to invite non-members to the network.
     187 *
     188 * @since 8.0.0
     189 */
     190function bp_admin_setting_callback_members_invitations() {
     191?>
     192    <input id="bp-enable-members-invitations" name="bp-enable-members-invitations" type="checkbox" value="1" <?php checked( bp_get_members_invitations_allowed() ); ?> />
     193    <label for="bp-enable-members-invitations"><?php _e( 'Allow registered members to invite people to join this network', 'buddypress' ); ?></label>
     194    <?php if ( ! bp_get_signup_allowed() ) : ?>
     195        <p class="description"><?php _e( 'Public registration is currently disabled. However, invitees will still be able to register if network invitations are enabled.', 'buddypress' ); ?></p>
     196    <?php endif; ?>
     197    <?php
     198    /**
     199     * Fires after the output of the invitations settings section.
     200     *
     201     * @since 8.0.0
     202     */
     203    do_action( 'bp_admin_settings_after_members_invitations' );
     204}
     205
    185206/** XProfile ******************************************************************/
    186207
  • trunk/src/bp-core/classes/class-bp-admin.php

    r12899 r12928  
    410410            add_settings_field( 'bp-disable-cover-image-uploads', __( 'Cover Image Uploads', 'buddypress' ), 'bp_admin_setting_callback_cover_image_uploads', 'buddypress', 'bp_members' );
    411411            register_setting( 'buddypress', 'bp-disable-cover-image-uploads', 'intval' );
     412        }
     413
     414        // Community Invitations.
     415        if ( bp_is_active( 'members', 'invitations' ) ) {
     416            add_settings_field( 'bp-enable-members-invitations', __( 'Invitations', 'buddypress' ), 'bp_admin_setting_callback_members_invitations', 'buddypress', 'bp_members' );
     417            register_setting( 'buddypress', 'bp-enable-members-invitations', 'intval' );
    412418        }
    413419
Note: See TracChangeset for help on using the changeset viewer.