Making WordPress.org


Ignore:
Timestamp:
07/11/2017 03:28:02 PM (9 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Store site ID in addition to post ID associated with a note, as post IDs are not unique across Rosetta forums.

See #2272.

File:
1 edited

Legend:

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

    r5645 r5646  
    100100                        'date'      => current_time( 'mysql' ),
    101101                        'post_id'   => $post_id,
     102                        'site_id'   => get_current_blog_id(),
    102103                        'moderator' => wp_get_current_user()->user_nicename
    103104                );
    … …  
    212213         *
    213214         * @param int $post_id Post ID. Default 0.
    214          * @param int $user_id User ID. Defaults to the current post author.
     215         * @param int $user_id User ID. Default 0.
     216         * @param int $site_id Site ID. Default 0.
    215217         * @return string Post permalink or user profile URL.
    216218         */
    217         function get_user_note_post_permalink( $post_id = 0, $user_id = 0 ) {
     219        function get_user_note_post_permalink( $post_id = 0, $user_id = 0, $site_id = 0 ) {
     220                switch_to_blog( $site_id );
     221
    218222                $post_type = $post_id ? get_post_type( $post_id ) : '';
    219223
    … …  
    228232                }
    229233
     234                restore_current_blog();
     235
    230236                return $permalink;
    231237        }
    … …  
    250256                        }
    251257
    252                         $post_permalink     = $this->get_user_note_post_permalink( $note->post_id, $user_id );
    253                         $redirect_on_delete = $this->get_user_note_post_permalink( get_the_ID(), $user_id );
     258                        $post_site_id       = isset( $note->site_id ) ? (int) $note->site_id : get_current_blog_id();
     259                        $post_permalink     = $this->get_user_note_post_permalink( $note->post_id, $user_id, $post_site_id );
     260                        $redirect_on_delete = $this->get_user_note_post_permalink( get_the_ID(), $user_id, get_current_blog_id() );
    254261
    255262                        printf( '<div class="bbp-template-notice warning"><p>%s</p> %s</div>' . "\n",
Note: See TracChangeset for help on using the changeset viewer.