Skip to:
Content

BuddyPress.org

Changeset 13170


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

Membership Requests: Change labels on register page.

We are using the standard "register" form to collect
membership requests, so we need to change the labels
in many cases to avoid confusion. Also ensure that users
can access the registration page when membership
requests are enabled.

See #8582.

Location:
trunk/src
Files:
7 edited

Legend:

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

    r13140 r13170  
    31933193    // Sign up page.
    31943194    } elseif ( bp_is_register_page() ) {
    3195         $bp_title_parts = array( __( 'Create an Account', 'buddypress' ) );
     3195        if ( bp_get_membership_requests_required() ) {
     3196            $bp_title_parts = array( __( 'Request Membership', 'buddypress' ) );
     3197        } else {
     3198            $bp_title_parts = array( __( 'Create an Account', 'buddypress' ) );
     3199        }
    31963200
    31973201    // Activation page.
  • trunk/src/bp-members/bp-members-functions.php

    r13165 r13170  
    24452445
    24462446    // Unactivated user account found!
    2447     // Set up the feedback message.
    2448     $signup_id = $signup['signups'][0]->signup_id;
    2449 
    2450     $resend_url_params = array(
    2451         'action' => 'bp-resend-activation',
    2452         'id'     => $signup_id,
    2453     );
    2454 
    2455     $resend_url = wp_nonce_url(
    2456         add_query_arg( $resend_url_params, wp_login_url() ),
    2457         'bp-resend-activation'
    2458     );
    2459 
    2460     $resend_string = '<br /><br />';
    2461 
    2462     /* translators: %s: the activation url */
    2463     $resend_string .= sprintf( __( 'If you have not received an email yet, <a href="%s">click here to resend it</a>.', 'buddypress' ), esc_url( $resend_url ) );
    2464 
    2465     return new WP_Error( 'bp_account_not_activated', __( '<strong>Error</strong>: Your account has not been activated. Check your email for the activation link.', 'buddypress' ) . $resend_string );
     2447    /*
     2448     * Don't allow users to resend their own activation email
     2449     * when membership requests are enabled.
     2450     */
     2451    if ( bp_get_membership_requests_required() ) {
     2452        $error_message = sprintf(
     2453            '<strong>%1$s</strong> %2$s',
     2454            esc_html_x( 'Error:', 'Warning displayed on the WP Login screen', 'buddypress' ),
     2455            esc_html_x( 'Your membership request has not yet been approved.', 'Error message displayed on the WP Login screen', 'buddypress' )
     2456        );
     2457    } else {
     2458        // Set up the feedback message.
     2459        $signup_id = $signup['signups'][0]->signup_id;
     2460
     2461        $resend_url_params = array(
     2462            'action' => 'bp-resend-activation',
     2463            'id'     => $signup_id,
     2464        );
     2465
     2466        $resend_url = wp_nonce_url(
     2467            add_query_arg( $resend_url_params, wp_login_url() ),
     2468            'bp-resend-activation'
     2469        );
     2470
     2471        $error_message = sprintf(
     2472            '<strong>%1$s</strong> %2$s<br /><br />%3$s',
     2473            esc_html_x( 'Error:', 'Warning displayed on the WP Login screen', 'buddypress' ),
     2474            esc_html_x( 'Your account has not been activated. Check your email for the activation link.', 'Error message displayed on the WP Login screen', 'buddypress' ),
     2475            sprintf(
     2476                /* translators: %s: the link to resend the activation email. */
     2477                esc_html_x( 'If you have not received an email yet, %s.', 'WP Login screen message', 'buddypress' ),
     2478                sprintf(
     2479                    '<a href="%1$s">%2$s</a>',
     2480                    esc_url( $resend_url ),
     2481                    esc_html_x( 'click here to resend it', 'Text of the link to resend the activation email', 'buddypress' )
     2482                )
     2483            )
     2484        );
     2485    }
     2486
     2487    return new WP_Error( 'bp_account_not_activated', $error_message );
    24662488}
    24672489add_filter( 'authenticate', 'bp_core_signup_disable_inactive', 30, 3 );
  • trunk/src/bp-members/bp-members-membership-requests.php

    r13169 r13170  
    260260
    261261/**
     262 * In the Nouveau template pack, when membership requests are required,
     263 * change registration form submit button label to "Submit Request".
     264 *
     265 * @since 10.0.0
     266 *
     267 * @return string $retval the HTML for the request membership link.
     268 */
     269function bp_members_membership_requests_filter_complete_signup_button( $buttons ) {
     270
     271    $buttons['register']['attributes']['value'] = __( 'Submit Request', 'buddypress' );
     272    return $buttons;
     273}
     274add_filter( 'bp_nouveau_get_submit_button', 'bp_members_membership_requests_filter_complete_signup_button' );
     275
     276/**
    262277 * Administration: Change certain behavior and labels
    263278 * on the WP Admin > Users > Manage Signups screen.
  • trunk/src/bp-members/classes/class-bp-registration-theme-compat.php

    r10521 r13170  
    9898        // Registration page.
    9999        if ( bp_is_register_page() ) {
    100             $title = __( 'Create an Account', 'buddypress' );
     100            if ( bp_get_membership_requests_required() ) {
     101                $title = __( 'Request Membership', 'buddypress' );
     102            } else {
     103                $title = __( 'Create an Account', 'buddypress' );
     104            }
    101105
    102106            if ( 'completed-confirmation' == bp_get_current_signup_step() ) {
    103                 $title = __( 'Check Your Email To Activate Your Account!', 'buddypress' );
     107                if ( bp_get_membership_requests_required() ) {
     108                    $title = __( 'Your Membership Request has been submitted.', 'buddypress' );
     109                } else {
     110                    $title = __( 'Check Your Email To Activate Your Account!', 'buddypress' );
     111                }
    104112            }
    105113
  • trunk/src/bp-members/screens/register.php

    r12920 r13170  
    6262    }
    6363
    64     if ( ! bp_get_signup_allowed() && ! $active_invite ) {
     64    $requests_enabled = bp_get_membership_requests_required();
     65
     66    if ( ! bp_get_signup_allowed() && ! $active_invite && ! $requests_enabled ) {
    6567        $bp->signup->step = 'registration-disabled';
    6668        // If the signup page is submitted, validate and save.
     
    198200            $active_signup = bp_core_get_root_option( 'registration' );
    199201
    200             if ( 'none' != $active_signup ) {
     202            if ( 'none' != $active_signup || $requests_enabled ) {
    201203
    202204                // Make sure the extended profiles module is enabled.
  • trunk/src/bp-templates/bp-legacy/buddypress/members/register.php

    r12887 r13170  
    352352             * @since 1.1.0
    353353             */
    354             do_action( 'bp_before_registration_submit_buttons' ); ?>
     354            do_action( 'bp_before_registration_submit_buttons' );
     355
     356            if ( bp_get_membership_requests_required() ) {
     357                $button_text = __( 'Submit Request', 'buddypress' );
     358            } else {
     359                $button_text = __( 'Complete Sign Up', 'buddypress' );
     360            }
     361            ?>
    355362
    356363            <div class="submit">
    357                 <input type="submit" name="signup_submit" id="signup_submit" value="<?php esc_attr_e( 'Complete Sign Up', 'buddypress' ); ?>" />
     364                <input type="submit" name="signup_submit" id="signup_submit" value="<?php echo esc_attr( $button_text ); ?>" />
    358365            </div>
    359366
     
    391398
    392399            <div id="template-notices" role="alert" aria-atomic="true">
    393                 <?php if ( bp_registration_needs_activation() ) : ?>
     400                <?php if ( bp_get_membership_requests_required() ) : ?>
     401                    <p><?php _e( 'You have successfully submitted your membership request! Our site moderators will review your submission and send you an activation email if your request is approved.', 'buddypress' ); ?></p>
     402                <?php elseif ( bp_registration_needs_activation() ) : ?>
    394403                    <p><?php _e( 'You have successfully created your account! To begin using this site you will need to activate your account via the email we have just sent to your address.', 'buddypress' ); ?></p>
    395404                <?php else : ?>
  • trunk/src/bp-templates/bp-nouveau/includes/functions.php

    r13145 r13170  
    11231123     * Adjust some messages to the context.
    11241124     */
    1125     if ( 'completed-confirmation' === $feedback_id && bp_registration_needs_activation() ) {
     1125    if ( 'completed-confirmation' === $feedback_id && bp_get_membership_requests_required() ) {
     1126        $feedback_messages['completed-confirmation']['message'] = __( 'You have successfully submitted your membership request! Our site moderators will review your submission and send you an activation email if your request is approved.', 'buddypress' );
     1127    } elseif ( 'completed-confirmation' === $feedback_id && bp_registration_needs_activation() ) {
    11261128        $feedback_messages['completed-confirmation']['message'] = __( 'You have successfully created your account! To begin using this site you will need to activate your account via the email we have just sent to your address.', 'buddypress' );
    11271129    } elseif ( 'member-notifications-none' === $feedback_id ) {
Note: See TracChangeset for help on using the changeset viewer.