Changeset 5017
- Timestamp:
- 07/10/2013 07:17:14 AM (12 years ago)
- Location:
- trunk/includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/tools.php
r5002 r5017 91 91 92 92 foreach ( (array) bbp_admin_repair_list() as $item ) { 93 if ( isset( $item[2] ) && isset( $_POST[$item[0]] ) && 1 === $_POST[$item[0]]&& is_callable( $item[2] ) ) {93 if ( isset( $item[2] ) && isset( $_POST[$item[0]] ) && 1 === absint( $_POST[$item[0]] ) && is_callable( $item[2] ) ) { 94 94 $messages[] = call_user_func( $item[2] ); 95 95 } … … 938 938 */ 939 939 function bbp_admin_repair_forum_visibility() { 940 941 940 $statement = __( 'Recalculating forum visibility … %s', 'bbpress' ); 942 $result = __( 'Failed!', 'bbpress' );943 944 // First, delete everything.945 delete_option( '_bbp_private_forums' );946 delete_option( '_bbp_hidden_forums' );947 948 // Next, get all the private and hidden forums949 $private_forums = new WP_Query( array(950 'suppress_filters' => true,951 'nopaging' => true,952 'post_type' => bbp_get_forum_post_type(),953 'post_status' => bbp_get_private_status_id(),954 'fields' => 'ids'955 ) );956 $hidden_forums = new WP_Query( array(957 'suppress_filters' => true,958 'nopaging' => true,959 'post_type' => bbp_get_forum_post_type(),960 'post_status' => bbp_get_hidden_status_id(),961 'fields' => 'ids'962 ) );963 941 964 942 // Bail if queries returned errors 965 if ( is_wp_error( $private_forums ) || is_wp_error( $hidden_forums ) ) 966 return array( 2, sprintf( $statement, $result ) ); 967 968 update_option( '_bbp_private_forums', $private_forums->posts ); // Private forums 969 update_option( '_bbp_hidden_forums', $hidden_forums->posts ); // Hidden forums 970 971 // Reset the $post global 972 wp_reset_postdata(); 943 if ( ! bbp_repair_forum_visibility() ) { 944 return array( 2, sprintf( $statement, __( 'Failed!', 'bbpress' ) ) ); 973 945 974 946 // Complete results 975 return array( 0, sprintf( $statement, __( 'Complete!', 'bbpress' ) ) ); 947 } else { 948 return array( 0, sprintf( $statement, __( 'Complete!', 'bbpress' ) ) ); 949 } 976 950 } 977 951 -
trunk/includes/common/widgets.php
r4995 r5017 557 557 558 558 // Note: private and hidden forums will be excluded via the 559 // bbp_pre_get_posts_ exclude_forums filterand function.559 // bbp_pre_get_posts_normalize_forum_visibility action and function. 560 560 $widget_query = new WP_Query( array( 561 561 'post_type' => bbp_get_forum_post_type(), … … 781 781 782 782 // Note: private and hidden forums will be excluded via the 783 // bbp_pre_get_posts_ exclude_forums filterand function.783 // bbp_pre_get_posts_normalize_forum_visibility action and function. 784 784 $widget_query = new WP_Query( $topics_query ); 785 785 … … 1122 1122 1123 1123 // Note: private and hidden forums will be excluded via the 1124 // bbp_pre_get_posts_ exclude_forums filterand function.1124 // bbp_pre_get_posts_normalize_forum_visibility action and function. 1125 1125 $widget_query = new WP_Query( array( 1126 1126 'post_type' => bbp_get_reply_post_type(), -
trunk/includes/extend/buddypress/group.php
r4995 r5017 680 680 $this->disconnect_forum_from_group( $group_id ); 681 681 } 682 683 // Update bbPress' internal private and forum ID variables 684 bbp_repair_forum_visibility(); 682 685 683 686 // Return the group -
trunk/includes/forums/functions.php
r5010 r5017 910 910 } 911 911 912 /** 913 * Recaches the private and hidden forums 914 * 915 * @since bbPress (r5017) 916 * 917 * @uses delete_option() to delete private and hidden forum pointers 918 * @uses WP_Query() To query post IDs 919 * @uses is_wp_error() To return if error occurred 920 * @uses update_option() To update the private and hidden post ID pointers 921 * @return array An array of the status code and the message 922 */ 923 function bbp_repair_forum_visibility() { 924 925 // First, delete everything. 926 delete_option( '_bbp_private_forums' ); 927 delete_option( '_bbp_hidden_forums' ); 928 929 // Next, get all the private and hidden forums 930 $private_forums = new WP_Query( array( 931 'suppress_filters' => true, 932 'nopaging' => true, 933 'post_type' => bbp_get_forum_post_type(), 934 'post_status' => bbp_get_private_status_id(), 935 'fields' => 'ids' 936 ) ); 937 $hidden_forums = new WP_Query( array( 938 'suppress_filters' => true, 939 'nopaging' => true, 940 'post_type' => bbp_get_forum_post_type(), 941 'post_status' => bbp_get_hidden_status_id(), 942 'fields' => 'ids' 943 ) ); 944 945 // Reset the $post global 946 wp_reset_postdata(); 947 948 // Bail if queries returned errors 949 if ( is_wp_error( $private_forums ) || is_wp_error( $hidden_forums ) ) 950 return false; 951 952 // Update the private/hidden options 953 update_option( '_bbp_private_forums', $private_forums->posts ); // Private forums 954 update_option( '_bbp_hidden_forums', $hidden_forums->posts ); // Hidden forums 955 956 // Complete results 957 return true; 958 } 959 912 960 /** Count Bumpers *************************************************************/ 913 961
Note: See TracChangeset
for help on using the changeset viewer.