bbp_repair_forum_visibility()
Recaches the private and hidden forums
Description
Return
(array) An array of the status code and the message
Source
File: bp-forums/forums/functions.php
958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | function bbp_repair_forum_visibility() { // First, delete everything. delete_option( '_bbp_private_forums' ); delete_option( '_bbp_hidden_forums' ); // Next, get all the private and hidden forums $private_forums = new WP_Query( array ( 'suppress_filters' => true, 'nopaging' => true, 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_private_status_id(), 'fields' => 'ids' ) ); $hidden_forums = new WP_Query( array ( 'suppress_filters' => true, 'nopaging' => true, 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_hidden_status_id(), 'fields' => 'ids' ) ); // Reset the $post global wp_reset_postdata(); // Bail if queries returned errors if ( is_wp_error( $private_forums ) || is_wp_error( $hidden_forums ) ) return false; // Update the private/hidden options update_option( '_bbp_private_forums' , $private_forums ->posts ); // Private forums update_option( '_bbp_hidden_forums' , $hidden_forums ->posts ); // Hidden forums // Complete results return true; } |
Changelog
Version | Description |
---|---|
bbPress (r5017) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.