Changeset 5431
- Timestamp:
- 07/09/2014 10:21:52 PM (12 years ago)
- Location:
- trunk/src/includes/replies
- Files:
-
- 2 edited
-
functions.php (modified) (34 diffs)
-
template.php (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/replies/functions.php
r5399 r5431 109 109 110 110 // Bail if action is not bbp-new-reply 111 if ( 'bbp-new-reply' !== $action ) 111 if ( 'bbp-new-reply' !== $action ) { 112 112 return; 113 } 113 114 114 115 // Nonce check … … 261 262 /** Reply Title ***********************************************************/ 262 263 263 if ( !empty( $_POST['bbp_reply_title'] ) ) 264 if ( !empty( $_POST['bbp_reply_title'] ) ) { 264 265 $reply_title = esc_attr( strip_tags( $_POST['bbp_reply_title'] ) ); 266 } 265 267 266 268 // Filter and sanitize … … 269 271 /** Reply Content *********************************************************/ 270 272 271 if ( !empty( $_POST['bbp_reply_content'] ) ) 273 if ( !empty( $_POST['bbp_reply_content'] ) ) { 272 274 $reply_content = $_POST['bbp_reply_content']; 275 } 273 276 274 277 // Filter and sanitize … … 276 279 277 280 // No reply content 278 if ( empty( $reply_content ) ) 281 if ( empty( $reply_content ) ) { 279 282 bbp_add_error( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply cannot be empty.', 'bbpress' ) ); 283 } 280 284 281 285 /** Reply Flooding ********************************************************/ 282 286 283 if ( !bbp_check_for_flood( $anonymous_data, $reply_author ) ) 287 if ( !bbp_check_for_flood( $anonymous_data, $reply_author ) ) { 284 288 bbp_add_error( 'bbp_reply_flood', __( '<strong>ERROR</strong>: Slow down; you move too fast.', 'bbpress' ) ); 289 } 285 290 286 291 /** Reply Duplicate *******************************************************/ 287 292 288 if ( !bbp_check_for_duplicate( array( 'post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data ) ) ) 293 if ( !bbp_check_for_duplicate( array( 'post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data ) ) ) { 289 294 bbp_add_error( 'bbp_reply_duplicate', __( '<strong>ERROR</strong>: Duplicate reply detected; it looks as though you’ve already said that!', 'bbpress' ) ); 295 } 290 296 291 297 /** Reply Blacklist *******************************************************/ 292 298 293 if ( !bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) 299 if ( !bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) { 294 300 bbp_add_error( 'bbp_reply_blacklist', __( '<strong>ERROR</strong>: Your reply cannot be created at this time.', 'bbpress' ) ); 301 } 295 302 296 303 /** Reply Status **********************************************************/ … … 339 346 340 347 // Bail if errors 341 if ( bbp_has_errors() ) 348 if ( bbp_has_errors() ) { 342 349 return; 350 } 343 351 344 352 /** No Errors *************************************************************/ … … 491 499 492 500 // Bail if action is not bbp-edit-reply 493 if ( 'bbp-edit-reply' !== $action ) 501 if ( 'bbp-edit-reply' !== $action ) { 494 502 return; 503 } 495 504 496 505 // Define local variable(s) … … 593 602 /** Reply Title ***********************************************************/ 594 603 595 if ( !empty( $_POST['bbp_reply_title'] ) ) 604 if ( !empty( $_POST['bbp_reply_title'] ) ) { 596 605 $reply_title = esc_attr( strip_tags( $_POST['bbp_reply_title'] ) ); 606 } 597 607 598 608 // Filter and sanitize … … 601 611 /** Reply Content *********************************************************/ 602 612 603 if ( !empty( $_POST['bbp_reply_content'] ) ) 613 if ( !empty( $_POST['bbp_reply_content'] ) ) { 604 614 $reply_content = $_POST['bbp_reply_content']; 615 } 605 616 606 617 // Filter and sanitize … … 608 619 609 620 // No reply content 610 if ( empty( $reply_content ) ) 621 if ( empty( $reply_content ) ) { 611 622 bbp_add_error( 'bbp_edit_reply_content', __( '<strong>ERROR</strong>: Your reply cannot be empty.', 'bbpress' ) ); 623 } 612 624 613 625 /** Reply Blacklist *******************************************************/ 614 626 615 if ( !bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) 627 if ( !bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) { 616 628 bbp_add_error( 'bbp_reply_blacklist', __( '<strong>ERROR</strong>: Your reply cannot be edited at this time.', 'bbpress' ) ); 629 } 617 630 618 631 /** Reply Status **********************************************************/ … … 658 671 659 672 // Bail if errors 660 if ( bbp_has_errors() ) 673 if ( bbp_has_errors() ) { 661 674 return; 675 } 662 676 663 677 /** No Errors *************************************************************/ … … 706 720 707 721 // Revision Reason 708 if ( !empty( $_POST['bbp_reply_edit_reason'] ) ) 722 if ( !empty( $_POST['bbp_reply_edit_reason'] ) ) { 709 723 $reply_edit_reason = esc_attr( strip_tags( $_POST['bbp_reply_edit_reason'] ) ); 724 } 710 725 711 726 // Update revision log … … 798 813 799 814 // Bail if there is no reply 800 if ( empty( $reply_id ) ) 815 if ( empty( $reply_id ) ) { 801 816 return; 817 } 802 818 803 819 // Check author_id 804 if ( empty( $author_id ) ) 820 if ( empty( $author_id ) ) { 805 821 $author_id = bbp_get_current_user_id(); 822 } 806 823 807 824 // Check topic_id 808 if ( empty( $topic_id ) ) 825 if ( empty( $topic_id ) ) { 809 826 $topic_id = bbp_get_reply_topic_id( $reply_id ); 827 } 810 828 811 829 // Check forum_id 812 if ( !empty( $topic_id ) && empty( $forum_id ) ) 830 if ( !empty( $topic_id ) && empty( $forum_id ) ) { 813 831 $forum_id = bbp_get_topic_forum_id( $topic_id ); 832 } 814 833 815 834 // If anonymous post, store name, email, website and ip in post_meta. … … 935 954 936 955 // If we want a full refresh, unset any of the possibly passed variables 937 if ( true === $refresh ) 956 if ( true === $refresh ) { 938 957 $forum_id = $topic_id = $reply_id = $active_id = $last_active_time = 0; 958 } 939 959 940 960 // Walk up ancestors … … 1259 1279 1260 1280 // Bail if action is not 'bbp-move-reply' 1261 if ( 'bbp-move-reply' !== $action ) 1281 if ( 'bbp-move-reply' !== $action ) { 1262 1282 return; 1283 } 1263 1284 1264 1285 // Prevent debug notices … … 1278 1299 1279 1300 // Reply exists 1280 if ( empty( $move_reply ) ) 1301 if ( empty( $move_reply ) ) { 1281 1302 bbp_add_error( 'bbp_mover_reply_r_not_found', __( '<strong>ERROR</strong>: The reply you want to move was not found.', 'bbpress' ) ); 1303 } 1282 1304 1283 1305 /** Topic to Move From ***************************************************/ … … 1443 1465 'meta_value' => $move_reply->ID, 1444 1466 ) ); 1445 foreach ( $children as $child ) 1467 foreach ( $children as $child ) { 1446 1468 bbp_update_reply_to( $child->ID, $parent ); 1469 } 1447 1470 1448 1471 // Remove reply_to from moved reply … … 1553 1576 1554 1577 // Bail if required GET actions aren't passed 1555 if ( empty( $_GET['reply_id'] ) ) 1578 if ( empty( $_GET['reply_id'] ) ) { 1556 1579 return; 1580 } 1557 1581 1558 1582 // Setup possible get actions … … 1563 1587 1564 1588 // Bail if actions aren't meant for this function 1565 if ( !in_array( $action, $possible_actions ) ) 1589 if ( !in_array( $action, $possible_actions ) ) { 1566 1590 return; 1591 } 1567 1592 1568 1593 $failure = ''; // Empty failure string … … 1574 1599 // Make sure reply exists 1575 1600 $reply = bbp_get_reply( $reply_id ); 1576 if ( empty( $reply ) ) 1601 if ( empty( $reply ) ) { 1577 1602 return; 1603 } 1578 1604 1579 1605 // What is the user doing here? … … 1602 1628 $sub_action = in_array( $_GET['sub_action'], array( 'trash', 'untrash', 'delete' ) ) ? $_GET['sub_action'] : false; 1603 1629 1604 if ( empty( $sub_action ) ) 1630 if ( empty( $sub_action ) ) { 1605 1631 break; 1632 } 1606 1633 1607 1634 switch ( $sub_action ) { … … 1650 1677 1651 1678 // Add view all if needed 1652 if ( !empty( $view_all ) ) 1679 if ( !empty( $view_all ) ) { 1653 1680 $reply_url = bbp_add_view_all( $reply_url, true ); 1681 } 1654 1682 1655 1683 // Redirect back to reply … … 1702 1730 // Get reply 1703 1731 $reply = bbp_get_reply( $reply_id ); 1704 if ( empty( $reply ) ) 1732 if ( empty( $reply ) ) { 1705 1733 return $reply; 1734 } 1706 1735 1707 1736 // Bail if already spam 1708 if ( bbp_get_spam_status_id() === $reply->post_status ) 1737 if ( bbp_get_spam_status_id() === $reply->post_status ) { 1709 1738 return false; 1739 } 1710 1740 1711 1741 // Execute pre spam code … … 1749 1779 // Get reply 1750 1780 $reply = bbp_get_reply( $reply_id ); 1751 if ( empty( $reply ) ) 1781 if ( empty( $reply ) ) { 1752 1782 return $reply; 1783 } 1753 1784 1754 1785 // Bail if already not spam 1755 if ( bbp_get_spam_status_id() !== $reply->post_status ) 1786 if ( bbp_get_spam_status_id() !== $reply->post_status ) { 1756 1787 return false; 1788 } 1757 1789 1758 1790 // Execute pre unspam code … … 1795 1827 $reply_id = bbp_get_reply_id( $reply_id ); 1796 1828 1797 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) 1829 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) { 1798 1830 return false; 1831 } 1799 1832 1800 1833 do_action( 'bbp_delete_reply', $reply_id ); … … 1811 1844 $reply_id = bbp_get_reply_id( $reply_id ); 1812 1845 1813 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) 1846 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) { 1814 1847 return false; 1848 } 1815 1849 1816 1850 do_action( 'bbp_trash_reply', $reply_id ); … … 1827 1861 $reply_id = bbp_get_reply_id( $reply_id ); 1828 1862 1829 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) 1863 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) { 1830 1864 return false; 1865 } 1831 1866 1832 1867 do_action( 'bbp_untrash_reply', $reply_id ); … … 1845 1880 $reply_id = bbp_get_reply_id( $reply_id ); 1846 1881 1847 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) 1882 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) { 1848 1883 return false; 1884 } 1849 1885 1850 1886 do_action( 'bbp_deleted_reply', $reply_id ); … … 1861 1897 $reply_id = bbp_get_reply_id( $reply_id ); 1862 1898 1863 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) 1899 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) { 1864 1900 return false; 1901 } 1865 1902 1866 1903 do_action( 'bbp_trashed_reply', $reply_id ); … … 1877 1914 $reply_id = bbp_get_reply_id( $reply_id ); 1878 1915 1879 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) 1916 if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) { 1880 1917 return false; 1918 } 1881 1919 1882 1920 do_action( 'bbp_untrashed_reply', $reply_id ); … … 1901 1939 1902 1940 // If return val is empty, set it to default 1903 if ( empty( $retval ) ) 1941 if ( empty( $retval ) ) { 1904 1942 $retval = $default; 1943 } 1905 1944 1906 1945 // Filter and return … … 1924 1963 1925 1964 // If return val is empty, set it to default 1926 if ( empty( $retval ) ) 1965 if ( empty( $retval ) ) { 1927 1966 $retval = $default; 1967 } 1928 1968 1929 1969 // Filter and return … … 2052 2092 2053 2093 // User cannot access forum this topic is in 2054 if ( bbp_is_single_topic() && !bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) 2094 if ( bbp_is_single_topic() && !bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) { 2055 2095 return; 2096 } 2056 2097 2057 2098 // Adjust the title based on context 2058 if ( bbp_is_single_topic() && bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) 2099 if ( bbp_is_single_topic() && bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) { 2059 2100 $title = apply_filters( 'wp_title_rss', get_wp_title_rss( ' » ' ) ); 2060 elseif ( !bbp_show_lead_topic() )2101 } elseif ( !bbp_show_lead_topic() ) { 2061 2102 $title = ' » ' . __( 'All Posts', 'bbpress' ); 2062 else2103 } else { 2063 2104 $title = ' » ' . __( 'All Replies', 'bbpress' ); 2105 } 2064 2106 2065 2107 // Display the feed … … 2168 2210 2169 2211 // Bail if not editing a topic 2170 if ( !bbp_is_reply_edit() ) 2212 if ( !bbp_is_reply_edit() ) { 2171 2213 return; 2214 } 2172 2215 2173 2216 // User cannot edit topic, so redirect back to reply … … 2199 2242 // Bail if reply_id is empty 2200 2243 $reply_id = bbp_get_reply_id( $reply_id ); 2201 if ( empty( $reply_id ) ) 2244 if ( empty( $reply_id ) ) { 2202 2245 return false; 2246 } 2203 2247 2204 2248 // If no position was passed, get it from the db and update the menu_order -
trunk/src/includes/replies/template.php
r5422 r5431 294 294 295 295 // Reset the post data when finished 296 if ( empty( $have_posts ) ) 296 if ( empty( $have_posts ) ) { 297 297 wp_reset_postdata(); 298 } 298 299 299 300 return $have_posts; … … 388 389 */ 389 390 function bbp_get_reply( $reply, $output = OBJECT, $filter = 'raw' ) { 390 if ( empty( $reply ) || is_numeric( $reply ) ) 391 if ( empty( $reply ) || is_numeric( $reply ) ) { 391 392 $reply = bbp_get_reply_id( $reply ); 393 } 392 394 393 395 $reply = get_post( $reply, OBJECT, $filter ); 394 if ( empty( $reply ) ) 396 if ( empty( $reply ) ) { 395 397 return $reply; 396 397 if ( $reply->post_type !== bbp_get_reply_post_type() ) 398 } 399 400 if ( $reply->post_type !== bbp_get_reply_post_type() ) { 398 401 return null; 402 } 399 403 400 404 if ( $output === OBJECT ) { … … 408 412 $_reply = array_values( get_object_vars( $reply ) ); 409 413 return $_reply; 410 411 414 } 412 415 … … 459 462 * 460 463 * @param int $reply_id Optional. Reply id 461 * @param $string $redirect_to Optional. Pass a redirect value for use with464 * @param string $redirect_to Optional. Pass a redirect value for use with 462 465 * shortcodes and other fun things. 463 466 * @uses bbp_get_reply_id() To get the reply id … … 511 514 512 515 // Add topic view query arg back to end if it is set 513 if ( bbp_get_view_all() ) 516 if ( bbp_get_view_all() ) { 514 517 $url = bbp_add_view_all( $url ); 518 } 515 519 516 520 return apply_filters( 'bbp_get_reply_url', $url, $reply_id, $redirect_to ); … … 552 556 * @since bbPress (r5177) 553 557 * 554 * @param string $ reply_title Required. Reply Title555 * @param int $ reply_id Required. Reply ID558 * @param string $post_title Required. Reply Title 559 * @param int $post_id Required. Reply ID 556 560 * @uses bbp_get_reply_topic_title() To get the reply topic title 557 561 * @uses apply_filters() Calls 'bbp_get_reply_title_fallback' with the title and reply ID … … 603 607 604 608 // Check if password is required 605 if ( post_password_required( $reply_id ) ) 609 if ( post_password_required( $reply_id ) ) { 606 610 return get_the_password_form(); 611 } 607 612 608 613 $content = get_post_field( 'post_content', $reply_id ); … … 725 730 726 731 // Bail if in admin or feed 727 if ( is_admin() || is_feed() ) 732 if ( is_admin() || is_feed() ) { 728 733 return $content; 734 } 729 735 730 736 // Validate the ID … … 776 782 777 783 // Check reply and revision log exist 778 if ( empty( $reply_id ) || empty( $revision_log ) || !is_array( $revision_log ) ) 784 if ( empty( $reply_id ) || empty( $revision_log ) || !is_array( $revision_log ) ) { 779 785 return false; 786 } 780 787 781 788 // Get the actual revisions 782 789 $revisions = bbp_get_reply_revisions( $reply_id ); 783 if ( empty( $revisions ) ) 790 if ( empty( $revisions ) ) { 784 791 return false; 792 } 785 793 786 794 $r = "\n\n" . '<ul id="bbp-reply-revision-log-' . esc_attr( $reply_id ) . '" class="bbp-reply-revision-log">' . "\n\n"; … … 959 967 $retval = false; 960 968 961 if ( ! bbp_get_reply_author_id( $reply_id ) )969 if ( ! bbp_get_reply_author_id( $reply_id ) ) { 962 970 $retval = true; 963 971 964 elseif ( get_post_meta( $reply_id, '_bbp_anonymous_name', true ) )972 } elseif ( get_post_meta( $reply_id, '_bbp_anonymous_name', true ) ) { 965 973 $retval = true; 966 974 967 elseif ( get_post_meta( $reply_id, '_bbp_anonymous_email', true ) )975 } elseif ( get_post_meta( $reply_id, '_bbp_anonymous_email', true ) ) { 968 976 $retval = true; 977 } 969 978 970 979 return (bool) apply_filters( 'bbp_is_reply_anonymous', $retval, $reply_id ); … … 1006 1015 $reply_id = bbp_get_reply_id( $reply_id ); 1007 1016 1008 if ( ! bbp_is_reply_anonymous( $reply_id ) ) {1017 if ( ! bbp_is_reply_anonymous( $reply_id ) ) { 1009 1018 $author = get_the_author_meta( 'display_name', bbp_get_reply_author_id( $reply_id ) ); 1010 1019 } else { … … 1076 1085 1077 1086 // User is not a guest 1078 if ( ! bbp_is_reply_anonymous( $reply_id ) ) {1087 if ( ! bbp_is_reply_anonymous( $reply_id ) ) { 1079 1088 1080 1089 // Get the author ID … … 1095 1104 1096 1105 // If nothing could be found anywhere, use Anonymous 1097 if ( empty( $author_name ) ) 1106 if ( empty( $author_name ) ) { 1098 1107 $author_name = __( 'Anonymous', 'bbpress' ); 1108 } 1099 1109 1100 1110 // Encode possible UTF8 display names 1101 if ( seems_utf8( $author_name ) === false ) 1111 if ( seems_utf8( $author_name ) === false ) { 1102 1112 $author_name = utf8_encode( $author_name ); 1113 } 1103 1114 1104 1115 return apply_filters( 'bbp_get_reply_author_display_name', $author_name, $reply_id ); … … 1292 1303 1293 1304 // Check for anonymous user or non-existant user 1294 if ( ! bbp_is_reply_anonymous( $reply_id ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) {1305 if ( ! bbp_is_reply_anonymous( $reply_id ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) { 1295 1306 $author_url = bbp_get_user_profile_url( bbp_get_reply_author_id( $reply_id ) ); 1296 1307 } else { … … 1335 1346 1336 1347 // Not anonymous 1337 if ( ! bbp_is_reply_anonymous( $reply_id ) ) {1348 if ( ! bbp_is_reply_anonymous( $reply_id ) ) { 1338 1349 1339 1350 // Use reply author email address … … 1459 1470 1460 1471 // Check that reply_id is valid 1461 if ( $reply_id = bbp_get_reply_id( $reply_id ) ) 1462 1463 // Get topic_id from reply 1464 if ( $topic_id = get_post_meta( $reply_id, '_bbp_topic_id', true ) ) 1465 1466 // Validate the topic_id 1472 $reply_id = bbp_get_reply_id( $reply_id ); 1473 if ( ! empty( $reply_id ) ) { 1474 $topic_id = get_post_meta( $reply_id, '_bbp_topic_id', true ); 1475 if ( ! empty( $topic_id ) ) { 1467 1476 $topic_id = bbp_get_topic_id( $topic_id ); 1477 } 1478 } 1468 1479 1469 1480 return (int) apply_filters( 'bbp_get_reply_topic_id', $topic_id, $reply_id ); … … 1499 1510 1500 1511 // Check that reply_id is valid 1501 if ( $reply_id = bbp_get_reply_id( $reply_id ) ) 1502 1503 // Get forum_id from reply 1504 if ( $forum_id = get_post_meta( $reply_id, '_bbp_forum_id', true ) ) 1505 1506 // Validate the forum_id 1512 $reply_id = bbp_get_reply_id( $reply_id ); 1513 if ( ! empty( $reply_id ) ) { 1514 $forum_id = get_post_meta( $reply_id, '_bbp_forum_id', true ); 1515 if ( ! empty( $forum_id ) ) { 1507 1516 $forum_id = bbp_get_forum_id( $forum_id ); 1517 } 1518 } 1508 1519 1509 1520 return (int) apply_filters( 'bbp_get_reply_forum_id', $forum_id, $reply_id ); … … 1533 1544 // Validation 1534 1545 $reply_id = bbp_get_reply_id( $reply_id ); 1535 if ( empty( $reply_id ) ) 1546 if ( empty( $reply_id ) ) { 1536 1547 return false; 1548 } 1537 1549 1538 1550 // Find highest reply ancestor … … 1629 1641 1630 1642 // Bail if no reply or user cannot reply 1631 if ( empty( $reply ) || ! bbp_current_user_can_access_create_reply_form() ) 1643 if ( empty( $reply ) || ! bbp_current_user_can_access_create_reply_form() ) { 1632 1644 return; 1645 } 1633 1646 1634 1647 // Build the URI and return value … … 1763 1776 1764 1777 // Bump the position by one if the lead topic is in the replies loop 1765 if ( ! bbp_show_lead_topic() ) 1778 if ( ! bbp_show_lead_topic() ) { 1766 1779 $reply_position++; 1780 } 1767 1781 1768 1782 return (int) apply_filters( 'bbp_get_reply_position', $reply_position, $reply_id, $topic_id ); … … 1926 1940 1927 1941 // Bail if no uri 1928 if ( empty( $uri ) ) 1942 if ( empty( $uri ) ) { 1929 1943 return; 1944 } 1930 1945 1931 1946 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-edit-link">' . $r['edit_text'] . '</a>' . $r['link_after']; … … 1964 1979 $bbp = bbpress(); 1965 1980 $reply = bbp_get_reply( bbp_get_reply_id( $reply_id ) ); 1966 if ( empty( $reply ) ) 1981 if ( empty( $reply ) ) { 1967 1982 return; 1983 } 1968 1984 1969 1985 $reply_link = bbp_remove_view_all( bbp_get_reply_permalink( $reply_id ) ); … … 2109 2125 $reply = bbp_get_reply( bbp_get_reply_id( (int) $r['id'] ) ); 2110 2126 2111 if ( empty( $reply ) || !current_user_can( 'moderate', $reply->ID ) ) 2127 if ( empty( $reply ) || !current_user_can( 'moderate', $reply->ID ) ) { 2112 2128 return; 2129 } 2113 2130 2114 2131 $display = bbp_is_reply_spam( $reply->ID ) ? $r['unspam_text'] : $r['spam_text']; … … 2174 2191 $topic_id = bbp_get_reply_topic_id( $reply_id ); 2175 2192 2176 if ( empty( $reply_id ) || !current_user_can( 'moderate', $topic_id ) ) 2193 if ( empty( $reply_id ) || !current_user_can( 'moderate', $topic_id ) ) { 2177 2194 return; 2195 } 2178 2196 2179 2197 $uri = add_query_arg( array( … … 2241 2259 $topic_id = bbp_get_reply_topic_id( $reply_id ); 2242 2260 2243 if ( empty( $reply_id ) || !current_user_can( 'moderate', $topic_id ) ) 2261 if ( empty( $reply_id ) || !current_user_can( 'moderate', $topic_id ) ) { 2244 2262 return; 2263 } 2245 2264 2246 2265 $uri = add_query_arg( array( … … 2394 2413 $bbp = bbpress(); 2395 2414 2396 if ( !isset( $bbp->reply_query->pagination_links ) || empty( $bbp->reply_query->pagination_links ) ) 2415 if ( !isset( $bbp->reply_query->pagination_links ) || empty( $bbp->reply_query->pagination_links ) ) { 2397 2416 return false; 2417 } 2398 2418 2399 2419 return apply_filters( 'bbp_get_topic_pagination_links', $bbp->reply_query->pagination_links );
Note: See TracChangeset
for help on using the changeset viewer.