Skip to:
Content

BuddyPress.org


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

Manage Signups Screen: Change labels and behavior for requests.

Change many labels in the WP Admin Signups Screen
to reflect the membership requests capability when enabled.

Add new "Profile Info" action link to User List Tables
so that the site admin can see submitted extended profile
info and any blog requests.

See #8582.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/classes/class-bp-members-admin.php

    r13165 r13169  
    515515        if ( ( ! bp_is_network_activated() && ! is_network_admin() ) || ( is_network_admin() && bp_is_network_activated() ) ) {
    516516
     517            $signups_menu_label = __( 'Manage Signups',  'buddypress' );
     518
     519            if ( bp_get_membership_requests_required() ) {
     520                $signups_menu_label = __( 'Manage Pending Memberships',  'buddypress' );
     521            }
     522
    517523            // Manage signups.
    518524            $hooks['signups'] = $this->signups_page = add_users_page(
    519                 __( 'Manage Signups',  'buddypress' ),
    520                 __( 'Manage Signups',  'buddypress' ),
     525                $signups_menu_label,
     526                $signups_menu_label,
    521527                $this->capability,
    522528                'bp-signups',
     
    16881694        $allowed_actions = apply_filters( 'bp_signups_admin_allowed_actions', array( 'do_delete', 'do_activate', 'do_resend' ) );
    16891695
    1690         // Prepare the display of the Community Profile screen.
     1696        // Prepare the display of the Signups screen.
    16911697        if ( ! in_array( $doaction, $allowed_actions ) || ( -1 == $doaction ) ) {
    16921698
     
    17101716            ) );
    17111717
     1718            $signup_help_content = '<p>' . esc_html__( 'Hovering over a row in the pending accounts list will display action links that allow you to manage pending accounts. You can perform the following actions:', 'buddypress' ) . '</p>';
     1719
     1720            if ( bp_get_membership_requests_required() ) {
     1721                $signup_help_content .= '<ul><li>' . esc_html__( '"Activate" will activate the user immediately without requiring that they validate their email.', 'buddypress' ) .'</li>' .
     1722                    '<li>' . esc_html__( '"Approve Request" or "Resend Approval" takes you to the confirmation screen before being able to send the activation link to the desired pending request. You can only send the activation email once per day.', 'buddypress' ) . '</li>';
     1723
     1724                if ( bp_is_active( 'xprofile' ) ) {
     1725                    $signup_help_content .= '<li>' . esc_html__( '"Profile Info" will display extended profile information for the request.', 'buddypress' ) . '</li>';
     1726                }
     1727
     1728                $signup_help_content .= '<li>' . esc_html__( '"Delete" allows you to delete a pending account from your site. You will be asked to confirm this deletion.', 'buddypress' ) . '</li></ul>';
     1729            } else {
     1730                $signup_help_content .= '<ul><li>' . esc_html__( '"Email" takes you to the confirmation screen before being able to send the activation link to the desired pending account. You can only send the activation email once per day.', 'buddypress' ) . '</li>' .
     1731                    '<li>' . __( '"Delete" allows you to delete a pending account from your site. You will be asked to confirm this deletion.', 'buddypress' ) . '</li></ul>';
     1732            }
     1733
     1734            $signup_help_content .= '<p>' . esc_html__( 'By clicking on a Username you will be able to activate a pending account from the confirmation screen.', 'buddypress' ) . '</p>' .
     1735                '<p>' . __( 'Bulk actions allow you to perform these 3 actions for the selected rows.', 'buddypress' ) . '</p>';
     1736
    17121737            get_current_screen()->add_help_tab( array(
    17131738                'id'      => 'bp-signups-actions',
    17141739                'title'   => __( 'Actions', 'buddypress' ),
    1715                 'content' =>
    1716                 '<p>' . __( 'Hovering over a row in the pending accounts list will display action links that allow you to manage pending accounts. You can perform the following actions:', 'buddypress' ) . '</p>' .
    1717                 '<ul><li>' . __( '"Email" takes you to the confirmation screen before being able to send the activation link to the desired pending account. You can only send the activation email once per day.', 'buddypress' ) . '</li>' .
    1718                 '<li>' . __( '"Delete" allows you to delete a pending account from your site. You will be asked to confirm this deletion.', 'buddypress' ) . '</li></ul>' .
    1719                 '<p>' . __( 'By clicking on a Username you will be able to activate a pending account from the confirmation screen.', 'buddypress' ) . '</p>' .
    1720                 '<p>' . __( 'Bulk actions allow you to perform these 3 actions for the selected rows.', 'buddypress' ) . '</p>'
     1740                'content' => $signup_help_content
    17211741            ) );
    17221742
    17231743            // Help panel - sidebar links.
    17241744            get_current_screen()->set_help_sidebar(
    1725                 '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
     1745                '<p><strong>' . esc_html__( 'For more information:', 'buddypress' ) . '</strong></p>' .
    17261746                '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
    17271747            );
     
    17361756                'heading_list'       => __( 'Pending users list', 'buddypress' ),
    17371757            ) );
     1758
     1759            // Use thickbox to display the extended profile information.
     1760            if ( bp_is_active( 'xprofile' ) || bp_members_site_requests_enabled() ) {
     1761                wp_enqueue_style( 'thickbox' );
     1762                wp_enqueue_script(
     1763                    'bp-signup-preview',
     1764                    $this->js_url . 'signup-preview' . bp_core_get_minified_asset_suffix() . '.js',
     1765                    array( 'bp-thickbox', 'jquery' ),
     1766                    bp_get_version(),
     1767                    true
     1768                );
     1769                wp_localize_script(
     1770                    'bp-signup-preview',
     1771                    'bpSignupPreview',
     1772                    array(
     1773                        'modalLabel' => __( 'Profile info preview', 'buddypress' ),
     1774                    )
     1775                );
     1776            }
    17381777
    17391778        } else {
     
    22282267
    22292268            case 'resend' :
    2230                 $header_text = __( 'Resend Activation Emails', 'buddypress' );
    2231                 if ( 1 == count( $signup_ids ) ) {
    2232                     $helper_text = __( 'You are about to resend an activation email to the following account:', 'buddypress' );
     2269
     2270                if ( bp_get_membership_requests_required() ) {
     2271                    $header_text = __( 'Approve Membership Requests', 'buddypress' );
     2272                    if ( 1 === count( $signup_ids ) ) {
     2273                        $helper_text = __( 'You are about to send an approval email to the following user:', 'buddypress' );
     2274                    } else {
     2275                        $helper_text = __( 'You are about to send approval emails to the following users:', 'buddypress' );
     2276                    }
    22332277                } else {
    2234                     $helper_text = __( 'You are about to resend an activation email to the following accounts:', 'buddypress' );
     2278                    $header_text = __( 'Resend Activation Emails', 'buddypress' );
     2279                    if ( 1 === count( $signup_ids ) ) {
     2280                        $helper_text = __( 'You are about to resend an activation email to the following account:', 'buddypress' );
     2281                    } else {
     2282                        $helper_text = __( 'You are about to resend an activation email to the following accounts:', 'buddypress' );
     2283                    }
    22352284                }
    22362285                break;
     2286
    22372287        }
    22382288
     
    22632313        // Prefetch registration field data.
    22642314        $fdata = array();
    2265         if ( 'activate' === $action && bp_is_active( 'xprofile' ) ) {
     2315        if ( bp_is_active( 'xprofile' ) && ( 'activate' == $action || ( 'resend' == $action && bp_get_membership_requests_required() ) ) ) {
    22662316            $field_groups = bp_xprofile_get_groups( array(
    22672317                'exclude_fields'    => 1,
     
    22872337            <ol class="bp-signups-list">
    22882338            <?php foreach ( $signups as $signup ) :
    2289                 $last_notified = mysql2date( 'Y/m/d g:i:s a', $signup->date_sent );
     2339                if ( $signup->count_sent > 0 ) {
     2340                    $last_notified = mysql2date( 'Y/m/d g:i:s a', $signup->date_sent );
     2341                } else {
     2342                    $last_notified = __( 'Not yet notified', 'buddypress' );
     2343                }
    22902344                $profile_field_ids = array();
    22912345
     
    22992353                    <strong><?php echo esc_html( $signup->user_login ) ?></strong>
    23002354
    2301                     <?php if ( 'activate' == $action ) : ?>
     2355                    <?php if ( 'activate' == $action || ( 'resend' == $action && bp_get_membership_requests_required() ) ) : ?>
    23022356                        <table class="wp-list-table widefat fixed striped">
    23032357                            <tbody>
     
    23172371                                        <tr>
    23182372                                            <td class="column-fields"><?php echo esc_html( $fdata[ $pid ] ); ?></td>
    2319                                             <td><?php echo $this->format_xprofile_field_for_display( $field_value ); ?></td>
     2373                                            <td><?php echo bp_members_admin_format_xprofile_field_for_display( $field_value ); ?></td>
    23202374                                        </tr>
    23212375
     
    26232677     *
    26242678     * @since 2.8.0
     2679     * @deprecated 10.0.0
    26252680     *
    26262681     * @param string|array $value Field value.
     
    26282683     */
    26292684    protected function format_xprofile_field_for_display( $value ) {
    2630         if ( is_array( $value ) ) {
    2631             $value = array_map( array( $this, 'format_xprofile_field_for_display' ), $value );
    2632             $value = implode( ', ', $value );
    2633         } else {
    2634             $value = stripslashes( $value );
    2635             $value = esc_html( $value );
    2636         }
    2637 
    2638         return $value;
     2685        _deprecated_function( __METHOD__, '10.0.0', 'bp_members_admin_format_xprofile_field_for_display' );
     2686
     2687        return bp_members_admin_format_xprofile_field_for_display( $value );
    26392688    }
    26402689
Note: See TracChangeset for help on using the changeset viewer.