Making WordPress.org

Changeset 4721


Ignore:
Timestamp:
01/18/2017 07:20:06 PM (8 years ago)
Author:
coffee2code
Message:

Support Forums: For plugin/theme support forum sidebars, add link to "Create Topic", "Add Review", or "Edit Review" based on context.

Adds an above-the-fold link that leads to the down-page form (which is otherwise only discoverable by scrolling).

Fixes #169.
See #1977.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc
Files:
2 edited

Legend:

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

    r4553 r4721  
    9999        $active  = sprintf( '<a href="//wordpress.org/support/plugin/%s/active">%s</a>', esc_attr( $this->slug() ), __( 'Active Topics', 'wporg-forums' ) );
    100100        $reviews = sprintf( '<a href="//wordpress.org/support/plugin/%s/reviews/">Reviews</a>', esc_attr( $this->slug() ) );
     101        $create  = '';
     102
     103        $create_label = '';
     104        if ( $this->ratings && $this->ratings->is_rating_view() && bbp_current_user_can_access_create_reply_form() ) {
     105            $create_label = \WPORG_Ratings::get_user_rating( 'plugin', $this->slug(), get_current_user_id() ) ?
     106                __( 'Edit Review', 'wporg-forums' ) :
     107                __( 'Add Review', 'wporg-forums' );
     108        } else {
     109            $create_label = __( 'Create Topic', 'wporg-forums' );
     110        }
     111        if ( $create_label ) {
     112            $create = sprintf( '<a href="#new-post">%s</a>', $create_label );
     113        }
    101114        ?>
     115
    102116        <div>
    103117            <h3>About this Plugin</h3>
     
    111125                <li><?php echo $active; ?></li>
    112126                <li><?php echo $reviews; ?></li>
     127                <li class="create-topic"><?php echo $create; ?></li>
    113128            </ul>
    114129        </div>
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-theme-directory-compat.php

    r4553 r4721  
    9797        $active  = sprintf( '<a href="//wordpress.org/support/theme/%s/active">%s</a>', esc_attr( $this->slug() ), __( 'Active Topics', 'wporg-forums' ) );
    9898        $reviews = sprintf( '<a href="//wordpress.org/support/theme/%s/reviews/">Reviews</a>', esc_attr( $this->slug() ) );
     99        $create  = '';
     100
     101        $create_label = '';
     102        if ( $this->ratings && $this->ratings->is_rating_view() && bbp_current_user_can_access_create_reply_form() ) {
     103            $create_label = \WPORG_Ratings::get_user_rating( 'theme', $this->slug(), get_current_user_id() ) ?
     104                __( 'Edit Review', 'wporg-forums' ) :
     105                __( 'Add Review', 'wporg-forums' );
     106        } elseif ( bbp_current_user_can_access_create_topic_form() ) {
     107            $create_label = __( 'Create Topic', 'wporg-forums' );
     108        }
     109        if ( $create_label ) {
     110            $create = sprintf( '<a href="#new-post">%s</a>', $create_label );
     111        }
    99112        ?>
    100113        <div>
     
    105118                <li><?php echo $active; ?></li>
    106119                <li><?php echo $reviews; ?></li>
     120                <li class="create-topic"><?php echo $create; ?></li>
    107121            </ul>
    108122        </div>
Note: See TracChangeset for help on using the changeset viewer.