Skip to:
Content

BuddyPress.org

Changeset 13167


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

Add key membership request functionality.

When membership requests are active, interrupt the
activation process by not sending the activation mail
upon submission of the registration form. This allows the
site admin an opportunity to look over the request and
send the activation email manually.

See #8582.

Location:
trunk/src
Files:
1 added
2 edited

Legend:

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

    r13165 r13167  
    462462 */
    463463function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key ) {
     464    $is_signup_resend = false;
     465    if ( is_admin() && buddypress()->members->admin->signups_page == get_current_screen()->id ) {
     466        // The admin is just approving/sending/resending the verification email.
     467        $is_signup_resend = true;
     468    }
     469
    464470    $args = array(
    465471        'tokens' => array(
     
    482488    }
    483489
    484     bp_send_email( 'core-user-registration-with-blog', array( array( $user_email => $salutation ) ), $args );
     490    /**
     491     * Filters if BuddyPress should send an activation key for a new multisite signup.
     492     *
     493     * @since 10.0.0
     494     *
     495     * @param string $user             The user's login name.
     496     * @param string $user_email       The user's email address.
     497     * @param string $key              The activation key created in wpmu_signup_blog().
     498     * @param bool   $is_signup_resend Is the site admin sending this email?
     499     * @param string $domain           The new blog domain.
     500     * @param string $path             The new blog path.
     501     * @param string $title            The site title.
     502     */
     503    if ( apply_filters( 'bp_core_signup_send_activation_key_multisite_blog', true, $user, $user_email, $key, $is_signup_resend, $domain, $path, $title ) ) {
     504        bp_send_email( 'core-user-registration-with-blog', array( array( $user_email => $salutation ) ), $args );
     505    }
    485506
    486507    // Return false to stop the original WPMU function from continuing.
     
    503524 */
    504525function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
     526    $is_signup_resend = false;
    505527    if ( is_admin() ) {
    506528
     
    516538            }
    517539
    518         /*
    519          * There can be a case where the user was created without the skip confirmation
    520          * And the super admin goes in pending accounts to resend it. In this case, as the
    521          * meta['password'] is not set, the activation url must be WordPress one.
    522          */
     540        // The site admin is approving/resending from the "manage signups" screen.
    523541        } elseif ( buddypress()->members->admin->signups_page == get_current_screen()->id ) {
     542            /*
     543             * There can be a case where the user was created without the skip confirmation
     544             * And the super admin goes in pending accounts to resend it. In this case, as the
     545             * meta['password'] is not set, the activation url must be WordPress one.
     546             */
    524547            $is_hashpass_in_meta = maybe_unserialize( $meta );
    525548
     
    527550                return $user;
    528551            }
     552
     553            // Or the admin is just approving/sending/resending the verification email.
     554            $is_signup_resend = true;
    529555        }
    530556    }
     
    551577        ),
    552578    );
    553     bp_send_email( 'core-user-registration', array( array( $user_email => $salutation ) ), $args );
     579
     580    /**
     581     * Filters if BuddyPress should send an activation key for a new multisite signup.
     582     *
     583     * @since 10.0.0
     584     *
     585     * @param string $user             The user's login name.
     586     * @param string $user_email       The user's email address.
     587     * @param string $key              The activation key created in wpmu_signup_blog().
     588     * @param bool   $is_signup_resend Is the site admin sending this email?
     589     */
     590    if ( apply_filters( 'bp_core_signup_send_activation_key_multisite', true, $user, $user_email, $key, $is_signup_resend ) ) {
     591        bp_send_email( 'core-user-registration', array( array( $user_email => $salutation ) ), $args );
     592    }
    554593
    555594    // Return false to stop the original WPMU function from continuing.
  • trunk/src/bp-members/classes/class-bp-members-component.php

    r13144 r13167  
    4141                'adminbar_myaccount_order' => 20,
    4242                'search_query_arg'         => 'members_search',
    43                 'features'                 => array( 'invitations' )
     43                'features'                 => array( 'invitations', 'membership_requests' ),
    4444            )
    4545        );
     
    7373        if ( bp_is_active( 'activity' ) ) {
    7474            $includes[] = 'activity';
     75        }
     76
     77        /**
     78         * Duplicate bp_get_membership_requests_required() and
     79         * bp_get_signup_allowed() logic here,
     80         * because those functions are not available yet.
     81         * The `bp_get_signup_allowed` filter is documented in
     82         * bp-members/bp-members-template.php.
     83         */
     84        $signup_allowed = apply_filters( 'bp_get_signup_allowed', (bool) bp_get_option( 'users_can_register' ) );
     85        $membership_requests_enabled = (bool) bp_get_option( 'bp-enable-membership-requests' );
     86        if ( bp_is_active( 'members', 'membership_requests' ) && ! $signup_allowed && $membership_requests_enabled ) {
     87            $includes[] = 'membership-requests';
    7588        }
    7689
Note: See TracChangeset for help on using the changeset viewer.