Changeset 11383
- Timestamp:
- 12/16/2021 07:37:44 AM (3 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
r11382 r11383 342 342 /** 343 343 * Replace warnings about 'topics' with warnings about 'reviews' when submitting a new review. 344 * Add warnings about reviews containing links. 344 345 */ 345 346 public function topic_pre_extras( $forum_id ) { 346 347 if ( Plugin::REVIEWS_FORUM_ID != $forum_id ) { 347 348 return; 349 } 350 351 if ( 352 ! empty( $_POST['bbp_topic_content'] ) && 353 ( 354 false !== stripos( $_POST['bbp_topic_content'], 'https://' ) || 355 false !== stripos( $_POST['bbp_topic_content'], 'http://' ) 356 ) 357 ) { 358 // Send this review to pending after it gets published. 359 setcookie( 'wporg_review_to_pending', 'links_blocked', time() + HOUR_IN_SECONDS, '/support/', 'wordpress.org', true, true ); 360 361 bbp_add_error( 362 'no_links_please', 363 sprintf( 364 /* translators: %s: Link to forum user guide explaining this. */ 365 __( '<strong>Error</strong>: Please <a href="%s">do not add links to your review</a>, keep the review about your experience in text only.', 'wporg-forums' ), 366 'https://wordpress.org/support/forum-user-guide/faq/#why-are-links-not-allowed-in-reviews' 367 ) 368 ); 369 } elseif ( ! empty( $_COOKIE['wporg_review_to_pending'] ) ) { 370 add_filter( 'bbp_new_topic_pre_insert', function( $data ) { 371 // If this is still for a review.. 372 if ( Plugin::REVIEWS_FORUM_ID == $data['post_parent'] ) { 373 // Clear the cookie. 374 setcookie( 'wporg_review_to_pending', '', time() - HOUR_IN_SECONDS, '/support/', 'wordpress.org', true, true ); 375 376 $data['post_status'] = bbp_get_pending_status_id(); 377 } 378 379 return $data; 380 } ); 348 381 } 349 382
Note: See TracChangeset
for help on using the changeset viewer.