Changeset 4919
- Timestamp:
- 02/18/2017 04:15:26 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-ratings-compat.php
r4796 r4919 194 194 if ( is_user_logged_in() ) { 195 195 echo '<a href="#new-post" class="btn">'; 196 _e( 'Add your own review', 'wporg-forums' ); 196 if ( $this->review_exists() ) { 197 _e( 'Edit your own review', 'wporg-forums' ); 198 } else { 199 _e( 'Add your own review', 'wporg-forums' ); 200 } 197 201 echo '</a>'; 198 202 } else { … … 253 257 } 254 258 259 /** 260 * Check if the current user already has a review for the plugin being viewed. 261 * 262 * @return bool True if review already exists, false otherwise. 263 */ 264 public function review_exists() { 265 if ( ! isset( $this->review_exists ) ) { 266 $this->review_exists = bbp_has_topics( array( 267 'author' => get_current_user_id(), 268 'post_status' => 'any', 269 'post_type' => bbp_get_topic_post_type(), 270 'post_parent' => Plugin::REVIEWS_FORUM_ID, 271 'tax_query' => array( array( 272 'taxonomy' => $this->taxonomy, 273 'field' => 'slug', 274 'terms' => $this->slug, 275 ) ), 276 'no_found_rows' => true, 277 'orderby' => 'ID', 278 ) ); 279 } 280 281 return $this->review_exists; 282 } 283 255 284 public function add_topic_form() { 256 285 if ( ! $this->is_rating_view() ) { … … 274 303 } 275 304 276 if ( bbp_has_topics( array( 277 'author' => get_current_user_id(), 278 'post_status' => 'any', 279 'post_type' => bbp_get_topic_post_type(), 280 'post_parent' => Plugin::REVIEWS_FORUM_ID, 281 'tax_query' => array( array( 282 'taxonomy' => $this->taxonomy, 283 'field' => 'slug', 284 'terms' => $this->slug, 285 ) ), 286 'no_found_rows' => true, 287 'orderby' => 'ID', 288 ) ) ) { 305 if ( $this->review_exists() ) { 289 306 bbp_the_topic(); 290 307 add_filter( 'bbp_is_topic_edit', '__return_true' );
Note: See TracChangeset
for help on using the changeset viewer.