Changeset 7379 for trunk/src/includes/topics/functions.php
- Timestamp:
- 11/24/2025 07:23:06 PM (6 months ago)
- File:
-
- 1 edited
-
trunk/src/includes/topics/functions.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/functions.php
r7378 r7379 469 469 return; 470 470 471 // Topic exists 471 // Check users ability to create new topic 472 } elseif ( ! bbp_is_topic_anonymous( $topic_id ) ) { 473 474 // User cannot edit this topic 475 if ( ! current_user_can( 'edit_topic', $topic_id ) ) { 476 bbp_add_error( 'bbp_edit_topic_permission', __( '<strong>Error</strong>: You do not have permission to edit that topic.', 'bbpress' ) ); 477 } 478 479 // Set topic author 480 $topic_author = bbp_get_topic_author_id( $topic_id ); 481 482 // It is an anonymous post 472 483 } else { 473 484 474 // Check users ability to create new topic 475 if ( ! bbp_is_topic_anonymous( $topic_id ) ) { 476 477 // User cannot edit this topic 478 if ( ! current_user_can( 'edit_topic', $topic_id ) ) { 479 bbp_add_error( 'bbp_edit_topic_permission', __( '<strong>Error</strong>: You do not have permission to edit that topic.', 'bbpress' ) ); 480 } 481 482 // Set topic author 483 $topic_author = bbp_get_topic_author_id( $topic_id ); 484 485 // It is an anonymous post 486 } else { 487 488 // Filter anonymous data 489 $anonymous_data = bbp_filter_anonymous_post_data(); 490 } 485 // Filter anonymous data 486 $anonymous_data = bbp_filter_anonymous_post_data(); 491 487 } 492 488 … … 1175 1171 bbp_add_error( 'bbp_merge_topic_nonce', __( '<strong>Error</strong>: Are you sure you wanted to do that?', 'bbpress' ) ); 1176 1172 return; 1173 } 1174 1175 // Get source topic 1176 $source_topic = bbp_get_topic( $source_topic_id ); 1177 1177 1178 1178 // Source topic not found 1179 } elseif ( ! $source_topic = bbp_get_topic( $source_topic_id) ) {1179 if ( empty( $source_topic ) ) { 1180 1180 bbp_add_error( 'bbp_merge_topic_source_not_found', __( '<strong>Error</strong>: The topic you want to merge was not found.', 'bbpress' ) ); 1181 1181 return; … … 1197 1197 } 1198 1198 1199 // Get the destination topic 1200 $destination_topic = bbp_get_topic( $destination_topic_id ); 1201 1199 1202 // Destination topic not found 1200 if ( ! $destination_topic = bbp_get_topic( $destination_topic_id) ) {1203 if ( empty( $destination_topic ) ) { 1201 1204 bbp_add_error( 'bbp_merge_topic_destination_not_found', __( '<strong>Error</strong>: The topic you want to merge to was not found.', 'bbpress' ) ); 1202 1205 } … … 1507 1510 case 'reply' : 1508 1511 default : 1509 1510 1512 // User needs to be able to publish topics 1511 1513 if ( current_user_can( 'publish_topics' ) ) { … … 1812 1814 1813 1815 // No tag name was provided 1814 if ( empty( $_POST['tag-name'] ) || ! $name = $_POST['tag-name']) {1816 if ( empty( $_POST['tag-name'] ) || ! is_scalar( $_POST['tag-name'] ) ) { 1815 1817 bbp_add_error( 'bbp_manage_topic_tag_update_name', __( '<strong>Error</strong>: You need to enter a tag name.', 'bbpress' ) ); 1816 1818 return; … … 1818 1820 1819 1821 // Attempt to update the tag 1822 $name = $_POST['tag-name']; 1820 1823 $slug = ! empty( $_POST['tag-slug'] ) ? $_POST['tag-slug'] : ''; 1821 1824 $description = ! empty( $_POST['tag-description'] ) ? $_POST['tag-description'] : ''; … … 1861 1864 1862 1865 // No tag name was provided 1863 if ( empty( $_POST['tag-existing-name'] ) || ! $name = $_POST['tag-existing-name']) {1866 if ( empty( $_POST['tag-existing-name'] ) || ! is_scalar( $_POST['tag-existing-name'] ) ) { 1864 1867 bbp_add_error( 'bbp_manage_topic_tag_merge_name', __( '<strong>Error</strong>: You need to enter a tag name.', 'bbpress' ) ); 1865 1868 return; 1866 1869 } 1867 1870 1871 // Unsanitized name of existing tag 1872 $name = $_POST['tag-existing-name']; 1873 1868 1874 // If term does not exist, create it 1869 if ( ! $tag = term_exists( $name, bbp_get_topic_tag_tax_id() ) ) { 1875 $tag = term_exists( $name, bbp_get_topic_tag_tax_id() ); 1876 if ( empty( $tag ) ) { 1870 1877 $tag = wp_insert_term( $name, bbp_get_topic_tag_tax_id() ); 1871 1878 } … … 3931 3938 <?php if ( bbp_has_topics( $topics_query ) ) : ?> 3932 3939 3933 <?php while ( bbp_topics() ) : bbp_the_topic(); ?> 3940 <?php while ( bbp_topics() ) : 3941 3942 bbp_the_topic(); ?> 3934 3943 3935 3944 <item>
Note: See TracChangeset
for help on using the changeset viewer.