WordPress.org

Making WordPress.org


Ignore:
Timestamp:
03/31/2020 11:17:28 PM (14 months ago)
Author:
coffee2code
Message:

Support Forums: Output search form and button for creating topic/review next to each other above topics table.

Props valentinbora, bcworkz, melchoyce, coffee2code.
See #4659.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r9612 r9663  
    607607            bbp_is_single_view() && in_array( bbp_get_view_id(), array( 'plugin', 'reviews', 'theme' ) )
    608608        ) {
     609            $btn = null;
    609610            $is_reviews = 'reviews' === bbp_get_view_id();
     611
    610612            if ( bbp_current_user_can_access_create_topic_form() ) {
    611                 printf(
    612                     '<a class="button create-topic" href="#new-topic-0">%s</a>',
     613                $btn = sprintf(
     614                    '<a class="button button-secondary create-topic" href="#new-topic-0">%s</a>',
    613615                    $is_reviews ? __( 'Create Review', 'wporg-forums' ) : __( 'Create Topic', 'wporg-forums' )
    614616                );
    615617            } elseif ( ! bbp_is_forum_closed() && ! is_user_logged_in() ) {
    616                 printf(
    617                     '<a class="button create-topic login" href="%s">%s</a>',
     618                $btn = sprintf(
     619                    '<a class="button button-secondary create-topic login" href="%s">%s</a>',
    618620                    wp_login_url(),
    619621                    $is_reviews ? __( 'Log in to Create a Review', 'wporg-forums' ) : __( 'Log in to Create a Topic', 'wporg-forums' )
    620622                );
     623            }
     624
     625            if ( $btn ) {
     626                $searchform = get_search_form( [ 'echo' => false ] );
     627
     628                echo '<div class="bbp-create-topic-wrapper">';
     629                if ( $searchform ) {
     630                    printf(
     631                        /* translators: 1: markup for forums search field which is primary action, 2: markup for button to create topic */
     632                        __( '%1$s or %2$s', 'wporg-forums' ),
     633                        $searchform,
     634                        $btn
     635                    );
     636                } else {
     637                    echo $btn;
     638                }
     639                echo "</div>\n";
    621640            }
    622641
Note: See TracChangeset for help on using the changeset viewer.