Example #1
0
/**
 * Recaches the private and hidden forums
 *
 * @since 2.2.0 bbPress (r4104)
 *
 * @uses bbp_repair_forum_visibility() To update private and hidden forum ids
 * @return array An array of the status code and the message
 */
function bbp_admin_repair_forum_visibility()
{
    $statement = __('Recalculating forum visibility … %s', 'bbpress');
    // Bail if queries returned errors
    if (!bbp_repair_forum_visibility()) {
        return array(2, sprintf($statement, __('Failed!', 'bbpress')));
        // Complete results
    } else {
        return array(0, sprintf($statement, __('Complete!', 'bbpress')));
    }
}
Example #2
0
 /**
  * Toggle the enable_forum group setting on or off
  *
  * @since bbPress (r4612)
  *
  * @param int $group_id The group to toggle
  * @param bool $enabled True for on, false for off
  * @uses groups_get_group() To get the group to toggle
  * @return False if group is not found, otherwise return the group
  */
 public function toggle_group_forum($group_id = 0, $enabled = false)
 {
     // Get the group
     $group = groups_get_group(array('group_id' => $group_id));
     // Bail if group cannot be found
     if (empty($group)) {
         return false;
     }
     // Set forum enabled status
     $group->enable_forum = (int) $enabled;
     // Save the group
     $group->save();
     // Maybe disconnect forum from group
     if (empty($enabled)) {
         $this->disconnect_forum_from_group($group_id);
     }
     // Update bbPress' internal private and forum ID variables
     bbp_repair_forum_visibility();
     // Return the group
     return $group;
 }