Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/10/2021 04:14:11 PM (3 years ago)
Author:
dcavins
Message:

Introduce bp_get_membership_requests_required().

Introduce a new function to determine if membership
requests are enabled and add the toggle to the admin
form at BuddyPress Settings > Options.

See #8582.

File:
1 edited

Legend:

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

    r13137 r13166  
    193193    <label for="bp-enable-members-invitations"><?php _e( 'Allow registered members to invite people to join this network', 'buddypress' ); ?></label>
    194194    <?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>
     195        <?php if ( is_multisite() ) : ?>
     196            <p class="description"><?php esc_html_e( 'With a WP multisite setup, to require membership requests for new signups, choose one of the following two options from the Network Settings > Registration Settings pane:' ); ?><p>
     197                <ul>
     198                    <li><p class="description"><?php esc_html_e( 'To allow the submission of membership requests but not allow site creation requests, select "Registration is disabled".' ) ?></p></li>
     199                    <li><p class="description"><?php esc_html_e( 'To allow the submission of membership requests and to allow new sites to be created by your users, choose "Logged in users may register new sites".' ) ?></p></li>
     200                </ul>
     201            <p class="description"><?php esc_html_e( 'The other two options, "User accounts may be registered" and "Both sites and user accounts can be registered," are open in nature and membership requests will not be enabled if one of those options is selected.' ); ?><p>
     202        <?php else : ?>
     203        <p class="description"><?php esc_html_e( 'Public registration is currently disabled. However, invitees will still be able to register if network invitations are enabled.', 'buddypress' ); ?></p>
     204        <?php endif; ?>
    196205    <?php endif; ?>
    197206    <?php
     
    202211     */
    203212    do_action( 'bp_admin_settings_after_members_invitations' );
     213}
     214
     215/**
     216 * Allow new users to request membership to the network.
     217 *
     218 * @since 10.0.0
     219 */
     220function bp_admin_setting_callback_membership_requests() {
     221?>
     222    <input id="bp-enable-membership-requests" name="bp-enable-membership-requests" type="checkbox" value="1" <?php checked( bp_get_membership_requests_required( 'raw' ) ); ?> <?php disabled( bp_get_signup_allowed() ); ?> />
     223    <label for="bp-enable-membership-requests"><?php esc_html_e( 'Allow visitors to request site membership. If enabled, an administrator must approve each new site membership request.', 'buddypress' ); ?></label>
     224    <?php if ( bp_get_signup_allowed() ) : ?>
     225        <p class="description"><?php esc_html_e( 'Public registration is currently enabled. If you wish to require approval for new memberships, disable public registration and enable the membership requests feature.', 'buddypress' ); ?></p>
     226    <?php endif; ?>
     227    <?php
     228    /**
     229     * Fires after the output of the membership requests settings section.
     230     *
     231     * @since 10.0.0
     232     */
     233    do_action( 'bp_admin_settings_after_membership_requests' );
    204234}
    205235
Note: See TracChangeset for help on using the changeset viewer.