Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/10/2021 04:14:51 PM (4 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/bp-members-membership-requests.php

    r13168 r13169  
    259259add_action( 'bp_core_signup_after_delete',   'bp_members_membership_requests_delete_notifications_on_change' );
    260260
     261/**
     262 * Administration: Change certain behavior and labels
     263 * on the WP Admin > Users > Manage Signups screen.
     264 *********************************************************************/
     265
     266/**
     267 * Filter the actions available on the signups list table.
     268 *
     269 * @since 10.0.0
     270 *
     271 * @param array  $actions       Array of actions and corresponding links.
     272 * @param object $signup_object The signup data object.
     273 */
     274function bp_members_membership_requests_filter_signup_row_actions( $actions, $signup_object ) {
     275
     276    // Rename the "email" resend option when membership requests are active.
     277    $email_link = add_query_arg(
     278        array(
     279            'page'      => 'bp-signups',
     280            'signup_id' => $signup_object->id,
     281            'action'    => 'resend',
     282        ),
     283        bp_get_admin_url( 'users.php' )
     284    );
     285
     286    $resend_label = ( 0 === $signup_object->count_sent ) ? __( 'Approve Request', 'buddypress' ) : __( 'Resend Approval', 'buddypress' );
     287
     288    $actions['resend'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $email_link ), esc_html( $resend_label ) );
     289
     290    // Add a link to view profile info when membership requests and xprofile are active.
     291    if ( bp_is_active( 'xprofile' ) || bp_members_site_requests_enabled() ) {
     292        $profile_link = add_query_arg(
     293            array(
     294                'page'     => 'bp-signups#TB_inline',
     295                'inlineId' => 'signup-info-modal-' . $signup_object->id,
     296            ),
     297            bp_get_admin_url( 'users.php' )
     298        );
     299
     300        $actions['profile'] = sprintf( '<a href="%1$s" class="bp-thickbox">%2$s</a>', esc_url( $profile_link ), esc_html__( 'Profile Info', 'buddypress' ) );
     301    }
     302
     303    return $actions;
     304}
     305add_filter( 'bp_members_ms_signup_row_actions', 'bp_members_membership_requests_filter_signup_row_actions', 10, 2 );
     306
     307/**
     308 * Filter the bulk actions available on the signups list table.
     309 *
     310 * @since 10.0.0
     311 *
     312 * @param array $actions Array of actions and corresponding links.
     313 * @return array         List of actions and corresponding links.
     314 */
     315function bp_members_membership_requests_filter_signup_bulk_actions( $actions ) {
     316    // Rename the "email" resend option when membership requests are active.
     317    $actions['resend'] = esc_html_x( 'Approve', 'Pending signup action', 'buddypress' );
     318    return $actions;
     319}
     320add_filter( 'bp_members_ms_signup_bulk_actions', 'bp_members_membership_requests_filter_signup_bulk_actions' );
     321
     322/**
     323 * Filter the "Last Sent" column header on the pending users table.
     324 *
     325 * @since 10.0.0
     326 *
     327 * @param array $columns Array of columns to display.
     328 * @return array List of columns to display.
     329 */
     330function bp_members_membership_requests_filter_signup_table_date_sent_header( $columns ) {
     331    $columns['date_sent'] = esc_html__( 'Approved', 'buddypress' );
     332    return $columns;
     333}
     334add_filter( 'bp_members_signup_columns', 'bp_members_membership_requests_filter_signup_table_date_sent_header' );
     335add_filter( 'bp_members_ms_signup_columns', 'bp_members_membership_requests_filter_signup_table_date_sent_header' );
     336
     337/**
     338 * Filter the "Last Sent" column message on the pending users table.
     339 *
     340 * @since 10.0.0
     341 *
     342 * @param string      $message "Not yet sent" message.
     343 * @param object|null $signup  Signup object instance.
     344 * @return string              "Not yet approved" message, if needed. Unchanged message otherwise.
     345 */
     346function bp_members_membership_requests_filter_signup_table_unsent_message( $message, $signup ) {
     347    if ( 0 === $signup->count_sent ) {
     348        $message = esc_html__( 'Not yet approved', 'buddypress' );
     349    }
     350
     351    return $message;
     352}
     353add_filter( 'bp_members_signup_date_sent_unsent_message', 'bp_members_membership_requests_filter_signup_table_unsent_message', 10, 2 );
     354add_filter( 'bp_members_ms_signup_date_sent_unsent_message', 'bp_members_membership_requests_filter_signup_table_unsent_message', 10, 2 );
     355
Note: See TracChangeset for help on using the changeset viewer.