Skip to:
Content

BuddyPress.org

Changeset 13976


Ignore:
Timestamp:
07/25/2024 02:04:23 PM (12 months ago)
Author:
imath
Message:

Administration: update Extend Profile screen’s help tab

  • Use the link to the new page of the user Handbook inside the sidebar
  • Adapt the help tab content according to available features, current user & the one being viewed.

Fixes #9217

File:
1 edited

Legend:

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

    r13975 r13976  
    977977        }
    978978
     979        if ( $user_id === $this->current_user_id && ! $this->is_self_profile ) {
     980            $this->is_self_profile = true;
     981        }
     982
    979983        // Build redirection URL.
    980984        $redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'spam', 'ham', 'delete_avatar' ), $_SERVER['REQUEST_URI'] );
     
    10121016            add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) );
    10131017
    1014             get_current_screen()->add_help_tab( array(
     1018            $show_avatars = buddypress()->avatar->show_avatars;
     1019            $member_types = bp_get_member_types();
     1020            $help_content = array(
     1021                'overview'     => __( 'This is the admin view of a user’s extended profile.', 'buddypress' ),
     1022                'main_column'  => __( 'In the main column, you can edit the fields of the user’s extended profile.', 'buddypress' ),
     1023                'right_column' => __( 'In the right-hand column, you can:', 'buddypress' ),
     1024            );
     1025
     1026            $available_actions = array(
     1027                'status' => __( 'update the user’s status', 'buddypress' ),
     1028                'avatar' => __( 'delete the user’s profile photo', 'buddypress' ),
     1029                'types'  => __( 'assign a user to one or more member types', 'buddypress' ),
     1030                'stats'  => __( 'view recent statistics', 'buddypress' ),
     1031            );
     1032
     1033            if ( ! bp_is_active( 'xprofile' ) ) {
     1034                $help_content['main_column'] = __( 'In the main column, you can view recent statistics about the user.', 'buddypress' );
     1035                unset( $available_actions['stats'] );
     1036            }
     1037
     1038            if ( ! $show_avatars )  {
     1039                unset( $available_actions['avatar'] );
     1040            }
     1041
     1042            if ( ! $member_types ) {
     1043                unset( $available_actions['types'] );
     1044            }
     1045
     1046            if ( true === $this->is_self_profile ) {
     1047                $help_content['overview']    = __( 'This is the admin view of your extended profile.', 'buddypress' );
     1048
     1049                if ( isset( $available_actions['stats'] ) ) {
     1050                    $help_content['main_column'] = __( 'In the main column, you can edit the fields of your extended profile.', 'buddypress' );
     1051                    $available_actions['stats']  = __( 'view your recent statistics', 'buddypress' );
     1052                } else {
     1053                    $help_content['main_column'] = __( 'In the main column, you can view your recent statistics.', 'buddypress' );
     1054                }
     1055
     1056                unset( $available_actions['status'] );
     1057
     1058                if ( isset( $available_actions['types'] ) ) {
     1059                    $available_actions['types'] = __( 'view the member types you’re assigned to', 'buddypress' );
     1060                }
     1061
     1062                if ( isset( $available_actions['avatar'] ) ) {
     1063                    $available_actions['avatar'] = __( 'edit or delete your profile photo', 'buddypress' );
     1064                }
     1065
     1066            } elseif ( is_multisite() && ! current_user_can( 'manage_network_users' ) ) {
     1067                unset( $available_actions['status'] );
     1068            }
     1069
     1070            if ( ! $available_actions ) {
     1071                unset( $help_content['right_column'] );
     1072            }
     1073
     1074            $help_tab_args = array(
    10151075                'id'      => 'bp-profile-edit-overview',
    10161076                'title'   => __( 'Overview', 'buddypress' ),
    1017                 'content' =>
    1018                 '<p>' . __( 'This is the admin view of a user&#39;s profile.', 'buddypress' ) . '</p>' .
    1019                 '<p>' . __( 'In the main column, you can edit the fields of the user&#39;s extended profile.', 'buddypress' ) . '</p>' .
    1020                 '<p>' . __( 'In the right-hand column, you can update the user&#39;s status, delete the user&#39;s avatar, and view recent statistics.', 'buddypress' ) . '</p>'
    1021             ) );
     1077                'content' => '<p>' . implode( '&nbsp;', $help_content ) . '</p>',
     1078            );
     1079
     1080            if ( isset( $help_content['right_column'] ) ) {
     1081                $help_tab_args['content'] .= '<ul><li>' . implode( '</li><li>', $available_actions ) . '</li></ul>';
     1082            }
     1083
     1084            get_current_screen()->add_help_tab( $help_tab_args );
    10221085
    10231086            // Help panel - sidebar links.
    10241087            get_current_screen()->set_help_sidebar(
    10251088                '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
    1026                 '<p>' . __( '<a href="https://codex.buddypress.org/administrator-guide/extended-profiles/">Managing Profiles</a>', 'buddypress' ) . '</p>' .
     1089                '<p>' . __( '<a href="https://github.com/buddypress/buddypress/blob/master/docs/user/administration/users/profile.md">Using Extended Profile</a>', 'buddypress' ) . '</p>' .
    10271090                '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
    10281091            );
     
    10791142            );
    10801143
    1081             if ( buddypress()->avatar->show_avatars ) {
     1144            if ( $show_avatars ) {
    10821145                // Avatar Metabox.
    10831146                add_meta_box(
     
    10921155
    10931156            // Member Type metabox. Only added if member types have been registered.
    1094             $member_types = bp_get_member_types();
    10951157            if ( ! empty( $member_types ) ) {
    10961158                add_meta_box(
Note: See TracChangeset for help on using the changeset viewer.