Skip to:
Content

BuddyPress.org

Ticket #8959: 8959.2.patch

File 8959.2.patch, 5.9 KB (added by imath, 16 months ago)
  • src/bp-core/admin/bp-core-admin-functions.php

    diff --git src/bp-core/admin/bp-core-admin-functions.php src/bp-core/admin/bp-core-admin-functions.php
    index e47889d2b..28ace183d 100644
    add_action( 'bp_admin_tabs', 'bp_backcompat_admin_tabs', 1, 2 ); 
    670670 */
    671671function bp_core_add_contextual_help( $screen = '' ) {
    672672
    673         $screen = get_current_screen();
     673        $screen   = get_current_screen();
     674        $bp_forum = sprintf(
     675                '<a href="%1$s">%2$s</a>',
     676                esc_url( 'https://buddypress.org/support/' ),
     677                esc_html__( 'Support Forums', 'buddypress' )
     678        );
    674679
    675680        switch ( $screen->id ) {
    676681
    function bp_core_add_contextual_help( $screen = '' ) { 
    685690                                )
    686691                        );
    687692
     693                        $manage_components = sprintf(
     694                                '<a href="%1$s">%2$s</a>',
     695                                esc_url( 'https://codex.buddypress.org/getting-started/configure-components/' ),
     696                                esc_html__( 'Managing Components', 'buddypress' )
     697                        );
     698
     699                        // Help panel - sidebar links.
     700                        $screen->set_help_sidebar(
     701                                '<p><strong>' . esc_html__( 'For more information:', 'buddypress' ) . '</strong></p>' .
     702                                '<p>' . $manage_components . '</p>' .
     703                                '<p>' . $bp_forum . '</p>'
     704                        );
     705                        break;
     706
     707                // Component page.
     708                case 'settings_page_bp-rewrites':
     709                        // Help tabs.
     710                        $screen->add_help_tab(
     711                                array(
     712                                        'id'      => 'bp-rewrites-overview',
     713                                        'title'   => esc_html__( 'Overview', 'buddypress' ),
     714                                        'content' => bp_core_add_contextual_help_content( 'bp-rewrites-overview' ),
     715                                )
     716                        );
     717
    688718                        // Help panel - sidebar links.
    689719                        $screen->set_help_sidebar(
    690                                 '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
    691                                 '<p>' . __( '<a href="https://codex.buddypress.org/getting-started/configure-components/">Managing Components</a>', 'buddypress' ) . '</p>' .
    692                                 '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
     720                                '<p><strong>' . esc_html__( 'For more information:', 'buddypress' ) . '</strong></p>' .
     721                                '<p>' . $bp_forum . '</p>'
    693722                        );
    694723                        break;
    695724
    function bp_core_add_contextual_help( $screen = '' ) { 
    699728                        $screen->add_help_tab(
    700729                                array(
    701730                                        'id'      => 'bp-settings-overview',
    702                                         'title'   => __( 'Overview', 'buddypress' ),
     731                                        'title'   => esc_html__( 'Overview', 'buddypress' ),
    703732                                        'content' => bp_core_add_contextual_help_content( 'bp-settings-overview' ),
    704733                                )
    705734                        );
    706735
     736                        $manage_settings = sprintf(
     737                                '<a href="%1$s">%2$s</a>',
     738                                esc_url( 'https://codex.buddypress.org/getting-started/configure-components/#settings-buddypress-settings' ),
     739                                esc_html__( 'Managing Settings', 'buddypress' )
     740                        );
     741
    707742                        // Help panel - sidebar links.
    708743                        $screen->set_help_sidebar(
    709                                 '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
    710                                 '<p>' . __( '<a href="https://codex.buddypress.org/getting-started/configure-components/#settings-buddypress-settings">Managing Settings</a>', 'buddypress' ) . '</p>' .
    711                                 '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
     744                                '<p><strong>' . esc_html__( 'For more information:', 'buddypress' ) . '</strong></p>' .
     745                                '<p>' . $manage_settings . '</p>' .
     746                                '<p>' . $bp_forum . '</p>'
    712747                        );
    713748
    714749                        break;
    function bp_core_add_contextual_help( $screen = '' ) { 
    724759                                )
    725760                        );
    726761
     762                        $manage_profile_fields = sprintf(
     763                                '<a href="%1$s">%2$s</a>',
     764                                esc_url( 'https://codex.buddypress.org/administrator-guide/extended-profiles/' ),
     765                                esc_html__( 'Managing Profile Fields', 'buddypress' )
     766                        );
     767
    727768                        // Help panel - sidebar links.
    728769                        $screen->set_help_sidebar(
    729                                 '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
    730                                 '<p>' . __( '<a href="https://codex.buddypress.org/administrator-guide/extended-profiles/">Managing Profile Fields</a>', 'buddypress' ) . '</p>' .
    731                                 '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
     770                                '<p><strong>' . esc_html__( 'For more information:', 'buddypress' ) . '</strong></p>' .
     771                                '<p>' . $manage_profile_fields . '</p>' .
     772                                '<p>' . $bp_forum . '</p>'
    732773                        );
    733774
    734775                        break;
    735776        }
    736777}
    737778add_action( 'load-settings_page_bp-components', 'bp_core_add_contextual_help' );
     779add_action( 'load-settings_page_bp-rewrites', 'bp_core_add_contextual_help' );
    738780add_action( 'load-settings_page_bp-settings', 'bp_core_add_contextual_help' );
    739781add_action( 'load-users_page_bp-profile-setup', 'bp_core_add_contextual_help' );
    740782
    function bp_core_add_contextual_help_content( $tab = '' ) { 
    761803                        $retval = __( 'Your users will distinguish themselves through their profile page. Create relevant profile fields that will show on each users profile.', 'buddypress' ) . '<br /><br />' . __( 'Note: Drag fields from other groups and drop them on the "Signup Fields" tab to include them into your registration form.', 'buddypress' );
    762804                        break;
    763805
     806                case 'bp-rewrites-overview':
     807                        $retval = __( 'Customize the page titles and URL slugs for the BuddyPress screens on your site.', 'buddypress' ) . '<br /><br />' . __( 'The <strong>title</strong> is the page title displayed above the BuddyPress content. For example, the page title "Members" is shown above the members directory.', 'buddypress' ) . '<br /><br />' . __( 'A <strong>slug</strong> is a portion of the URL itself. For instance, "members" is the members directory slug in the following example URL: <code>https://mysite.org/members</code>. Slugs should only include lowercase letters, numbers, and hyphens.', 'buddypress' );
     808                        break;
     809
    764810                default:
    765811                        $retval = false;
    766812                        break;
    function bp_core_add_contextual_help_content( $tab = '' ) { 
    768814
    769815        // Wrap text in a paragraph tag.
    770816        if ( ! empty( $retval ) ) {
    771                 $retval = '<p>' . $retval . '</p>';
     817                $allowed_tags = array(
     818                        'br'     => true,
     819                        'code'   => true,
     820                        'strong' => true,
     821                );
     822
     823                $retval = '<p>' . wp_kses( $retval, $allowed_tags ) . '</p>';
    772824        }
    773825
    774826        return $retval;