Making WordPress.org

Changeset 5776


Ignore:
Timestamp:
08/08/2017 02:39:46 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Don't save or display a site URL for reviews.

Props sterndata.
Fixes #363.

File:
1 edited

Legend:

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

    r5764 r5776  
    377377     */
    378378    public function display_extra_topic_fields() {
    379         $site_url = get_post_meta( bbp_get_topic_id(), self::SITE_URL_META, true );
    380 
    381         // Display site URL for logged-in users.
    382         if ( is_user_logged_in() && $site_url ) {
    383             printf( '<p>%1$s <a href="%2$s" rel="nofollow">%2$s</a></p>',
    384                 __( 'Site URL:', 'wporg-forums' ),
    385                 esc_url( $site_url )
    386             );
     379        $topic_id = bbp_get_topic_id();
     380
     381        if ( Plugin::REVIEWS_FORUM_ID != bbp_get_topic_forum_id( $topic_id ) ) {
     382            $site_url = get_post_meta( $topic_id, self::SITE_URL_META, true );
     383
     384            // Display site URL for logged-in users.
     385            if ( is_user_logged_in() && $site_url ) {
     386                printf( '<p>%1$s <a href="%2$s" rel="nofollow">%2$s</a></p>',
     387                    __( 'Site URL:', 'wporg-forums' ),
     388                    esc_url( $site_url )
     389                );
     390            }
    387391        }
    388392    }
     
    392396     */
    393397    public function add_extra_topic_fields() {
    394         $site_url = ( bbp_is_topic_edit() ) ? get_post_meta( bbp_get_topic_id(), self::SITE_URL_META, true ) : '';
    395         ?>
    396         <p>
    397             <label for="site_url"><?php _e( 'URL of the site or page you need help with:', 'wporg-forums' ) ?></label><br />
    398             <input type="text" id="site_url" value="<?php echo esc_attr( $site_url ); ?>" size="40" name="site_url" maxlength="100" />
    399         </p>
    400         <?php
     398        $topic_id = bbp_get_topic_id();
     399
     400        if ( Plugin::REVIEWS_FORUM_ID != bbp_get_topic_forum_id( $topic_id ) ) :
     401            $site_url = ( bbp_is_topic_edit() ) ? get_post_meta( $topic_id, self::SITE_URL_META, true ) : '';
     402            ?>
     403            <p>
     404                <label for="site_url"><?php _e( 'URL of the site or page you need help with:', 'wporg-forums' ) ?></label><br />
     405                <input type="text" id="site_url" value="<?php echo esc_attr( $site_url ); ?>" size="40" name="site_url" maxlength="100" />
     406            </p>
     407            <?php
     408        endif;
    401409    }
    402410
     
    409417        // Handle "URL of the site or page you need help with" field.
    410418        if ( isset( $_POST['site_url'] ) ) {
     419            if ( Plugin::REVIEWS_FORUM_ID == bbp_get_topic_forum_id( $topic_id ) ) {
     420                return;
     421            }
     422
    411423            $site_url = esc_url_raw( apply_filters( 'pre_user_url', $_POST['site_url'] ) );
    412424
Note: See TracChangeset for help on using the changeset viewer.