[ Index ]

PHP Cross Reference of BBPress

title

Body

[close]

/src/includes/forums/ -> functions.php (summary)

bbPress Forum Functions

File Size: 2798 lines (82 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 61 functions

  bbp_insert_forum()
  bbp_new_forum_handler()
  bbp_edit_forum_handler()
  bbp_save_forum_extras()
  bbp_close_forum()
  bbp_open_forum()
  bbp_categorize_forum()
  bbp_normalize_forum()
  bbp_publicize_forum()
  bbp_privatize_forum()
  bbp_hide_forum()
  bbp_repair_forum_visibility()
  bbp_remove_forum_from_all_subscriptions()
  bbp_bump_forum_topic_count()
  bbp_increase_forum_topic_count()
  bbp_decrease_forum_topic_count()
  bbp_bump_forum_topic_count_hidden()
  bbp_increase_forum_topic_count_hidden()
  bbp_decrease_forum_topic_count_hidden()
  bbp_bump_forum_reply_count()
  bbp_bump_forum_reply_count_hidden()
  bbp_increase_forum_reply_count()
  bbp_decrease_forum_reply_count()
  bbp_increase_forum_reply_count_hidden()
  bbp_decrease_forum_reply_count_hidden()
  bbp_approved_unapproved_topic_update_forum_reply_count()
  bbp_update_forum_last_topic_id()
  bbp_update_forum_last_reply_id()
  bbp_update_forum_last_active_id()
  bbp_update_forum_last_active_time()
  bbp_update_forum_subforum_count()
  bbp_update_forum_topic_count()
  bbp_update_forum_topic_count_hidden()
  bbp_update_forum_reply_count()
  bbp_update_forum_reply_count_hidden()
  bbp_update_forum()
  bbp_get_forum_statuses()
  bbp_get_forum_types()
  bbp_get_forum_visibilities()
  bbp_get_public_forum_statuses()
  bbp_get_non_public_forum_statuses()
  bbp_get_hidden_forum_ids()
  bbp_get_private_forum_ids()
  bbp_get_excluded_forum_ids()
  bbp_exclude_forum_ids()
  bbp_pre_get_posts_normalize_forum_visibility()
  bbp_forum_query_topic_ids()
  bbp_forum_query_subforum_ids()
  bbp_forum_query_last_reply_id()
  bbp_forum_enforce_hidden()
  bbp_forum_enforce_private()
  bbp_check_forum_edit()
  bbp_delete_forum_topics()
  bbp_trash_forum_topics()
  bbp_untrash_forum_topics()
  bbp_delete_forum()
  bbp_trash_forum()
  bbp_untrash_forum()
  bbp_deleted_forum()
  bbp_trashed_forum()
  bbp_untrashed_forum()

Functions
Functions that are not part of a class:

bbp_insert_forum( $forum_data = array()   X-Ref
A wrapper for wp_insert_post() that also includes the necessary meta values
for the forum to function properly.

since: 2.0.0 bbPress (r3349)
param: array $forum_data Forum post data
param: array $forum_meta Forum meta data

bbp_new_forum_handler( $action = '' )   X-Ref
Handles the front end forum submission

param: string $action The requested action to compare this function to

bbp_edit_forum_handler( $action = '' )   X-Ref
Handles the front end edit forum submission

param: string $action The requested action to compare this function to

bbp_save_forum_extras( $forum_id = 0 )   X-Ref
Handle the saving of core forum metadata (Status, Visibility, and Type)

since: 2.1.0 bbPress (r3678)
return: If forum ID is empty
param: int $forum_id

bbp_close_forum( $forum_id = 0 )   X-Ref
Closes a forum

since: 2.0.0 bbPress (r2746)
return: mixed False or {@link WP_Error} on failure, forum id on success
param: int $forum_id forum id

bbp_open_forum( $forum_id = 0 )   X-Ref
Opens a forum

since: 2.0.0 bbPress (r2746)
return: mixed False or {@link WP_Error} on failure, forum id on success
param: int $forum_id forum id

bbp_categorize_forum( $forum_id = 0 )   X-Ref
Make the forum a category

since: 2.0.0 bbPress (r2746)
return: bool False on failure, true on success
param: int $forum_id Optional. Forum id

bbp_normalize_forum( $forum_id = 0 )   X-Ref
Remove the category status from a forum

since: 2.0.0 bbPress (r2746)
return: bool False on failure, true on success
param: int $forum_id Optional. Forum id

bbp_publicize_forum( $forum_id = 0, $current_visibility = '' )   X-Ref
Mark the forum as public

since: 2.0.0 bbPress (r2746)
return: bool False on failure, true on success
param: int $forum_id Optional. Forum id

bbp_privatize_forum( $forum_id = 0, $current_visibility = '' )   X-Ref
Mark the forum as private

since: 2.0.0 bbPress (r2746)
return: bool False on failure, true on success
param: int $forum_id Optional. Forum id

bbp_hide_forum( $forum_id = 0, $current_visibility = '' )   X-Ref
Mark the forum as hidden

since: 2.0.0 bbPress (r2996)
return: bool False on failure, true on success
param: int $forum_id Optional. Forum id

bbp_repair_forum_visibility()   X-Ref
Recaches the private and hidden forums

since: 2.4.0 bbPress (r5017)
return: array An array of the status code and the message

bbp_remove_forum_from_all_subscriptions( $forum_id = 0 )   X-Ref
Remove a deleted forum from all user subscriptions

since: 2.5.0 bbPress (r5156)
param: int $forum_id Get the forum ID to remove

bbp_bump_forum_topic_count( $forum_id = 0, $difference = 1, $update_ancestors = true )   X-Ref
Bump the total topic count of a forum

since: 2.1.0 bbPress (r3825)
return: int Forum topic count
param: int $forum_id Optional. Forum id.
param: int $difference Optional. Default 1
param: bool $update_ancestors Optional. Default true

bbp_increase_forum_topic_count( $forum_id = 0 )   X-Ref
Increase the total topic count of a forum by one.

since: 2.6.0 bbPress (r6036)
return: void
param: int $forum_id The forum id.

bbp_decrease_forum_topic_count( $forum_id = 0 )   X-Ref
Decrease the total topic count of a forum by one.

since: 2.6.0 bbPress (r6036)
return: void
param: int $forum_id The forum id.

bbp_bump_forum_topic_count_hidden( $forum_id = 0, $difference = 1, $update_ancestors = true )   X-Ref
Bump the total topic count of a forum

since: 2.1.0 bbPress (r3825)
return: int Forum topic count
param: int $forum_id Optional. Forum id.
param: int $difference Optional. Default 1
param: bool $update_ancestors Optional. Default true

bbp_increase_forum_topic_count_hidden( $forum_id = 0 )   X-Ref
Increase the total hidden topic count of a forum by one.

since: 2.6.0 bbPress (r6036)
return: void
param: int $forum_id The forum id.

bbp_decrease_forum_topic_count_hidden( $forum_id = 0 )   X-Ref
Decrease the total hidden topic count of a forum by one.

since: 2.6.0 bbPress (r6036)
return: void
param: int $forum_id The forum id.

bbp_bump_forum_reply_count( $forum_id = 0, $difference = 1, $update_ancestors = true )   X-Ref
Bump the total topic count of a forum

since: 2.1.0 bbPress (r3825)
return: int Forum topic count
param: int $forum_id Optional. Forum id.
param: int $difference Optional. Default 1
param: bool $update_ancestors Optional. Default true

bbp_bump_forum_reply_count_hidden( $forum_id = 0, $difference = 1, $update_ancestors = true )   X-Ref
Bump the total topic count of a forum

since: 2.6.0 bbPress (r6922)
return: int Forum topic count
param: int $forum_id Optional. Forum id.
param: int $difference Optional. Default 1
param: bool $update_ancestors Optional. Default true

bbp_increase_forum_reply_count( $forum_id = 0 )   X-Ref
Increase the total reply count of a forum by one.

since: 2.6.0 bbPress (r6036)
return: void
param: int $forum_id The forum id.

bbp_decrease_forum_reply_count( $forum_id = 0 )   X-Ref
Decrease the total reply count of a forum by one.

since: 2.6.0 bbPress (r6036)
return: void
param: int $forum_id The forum id.

bbp_increase_forum_reply_count_hidden( $forum_id = 0 )   X-Ref
Increase the total hidden reply count of a forum by one.

since: 2.6.0 bbPress (r6036)
return: void
param: int $forum_id The forum id.

bbp_decrease_forum_reply_count_hidden( $forum_id = 0 )   X-Ref
Decrease the total hidden reply count of a forum by one.

since: 2.6.0 bbPress (r6036)
return: void
param: int $forum_id The forum id.

bbp_approved_unapproved_topic_update_forum_reply_count( $topic_id = 0 )   X-Ref
Update forum reply counts when a topic is approved or unapproved.

since: 2.6.0 bbPress (r6036)
return: void
param: int $topic_id The topic id.

bbp_update_forum_last_topic_id( $forum_id = 0, $topic_id = 0 )   X-Ref
Update the forum last topic id

since: 2.0.0 bbPress (r2625)
return: int Id of the forums most recent topic
param: int $forum_id Optional. Forum id.
param: int $topic_id Optional. Topic id.

bbp_update_forum_last_reply_id( $forum_id = 0, $reply_id = 0 )   X-Ref
Update the forum last reply id

since: 2.0.0 bbPress (r2625)
return: int Id of the forums most recent reply
param: int $forum_id Optional. Forum id.
param: int $reply_id Optional. Reply id.

bbp_update_forum_last_active_id( $forum_id = 0, $active_id = 0 )   X-Ref
Update the forum last active post id

since: 2.0.0 bbPress (r2860)
return: int Id of the forums last active post
param: int $forum_id Optional. Forum id.
param: int $active_id Optional. Active post id.

bbp_update_forum_last_active_time( $forum_id = 0, $new_time = '' )   X-Ref
Update the forums last active date/time (aka freshness)

since: 2.0.0 bbPress (r2680)
return: string MySQL timestamp of last active topic or reply
param: int    $forum_id Optional. Topic id.
param: string $new_time Optional. New time in mysql format.

bbp_update_forum_subforum_count( $forum_id = 0, $subforums = false )   X-Ref
Update the forum sub-forum count

since: 2.0.0 bbPress (r2625)
return: bool True on success, false on failure
param: int $forum_id Optional. Forum id
param: int $subforums Optional. Number of subforums

bbp_update_forum_topic_count( $forum_id = 0 )   X-Ref
Adjust the total topic count of a forum

since: 2.0.0 bbPress (r2464)
return: int Forum topic count
param: int $forum_id Optional. Forum id or topic id. It is checked whether it
param: bool $total_count Optional. To return the total count or normal count?

bbp_update_forum_topic_count_hidden( $forum_id = 0, $topic_count = false )   X-Ref
Adjust the total hidden topic count of a forum (hidden includes trashed,
spammed and pending topics)

since: 2.0.0 bbPress (r2888)
since: 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects
return: int Topic hidden topic count
param: int $forum_id Optional. Topic id to update.
param: int $topic_count Optional. Set the topic count manually.

bbp_update_forum_reply_count( $forum_id = 0 )   X-Ref
Adjust the total reply count of a forum

since: 2.0.0 bbPress (r2464)
since: 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects
return: int Forum reply count
param: int  $forum_id Optional. Forum id or topic id. It is checked whether it

bbp_update_forum_reply_count_hidden( $forum_id = 0 )   X-Ref
Adjust the total hidden reply count of a forum

since: 2.6.0 bbPress (r6922)
return: int Forum reply count
param: int  $forum_id Optional. Forum id or topic id. It is checked whether it

bbp_update_forum( $args = array()   X-Ref
Updates the counts of a forum.

This calls a few internal functions that all run manual queries against the
database to get their results. As such, this function can be costly to run
but is necessary to keep everything accurate.

since: 2.0.0 bbPress (r2908)
param: array $args Supports these arguments:

bbp_get_forum_statuses( $forum_id = 0 )   X-Ref
Return an associative array of available topic statuses

Developers note: these statuses are actually stored as meta data, and
Visibilities are stored in post_status.

since: 2.4.0 bbPress (r5059)
return: array
param: int $forum_id   Optional. Forum id.

bbp_get_forum_types( $forum_id = 0 )   X-Ref
Return an associative array of forum types

since: 2.4.0 bbPress (r5059)
return: array
param: int $forum_id   Optional. Forum id.

bbp_get_forum_visibilities( $forum_id = 0)   X-Ref
Return an associative array of forum visibility

Developers note: these visibilities are actually stored in post_status, and
Statuses are stored in meta data.

since: 2.4.0 bbPress (r5059)
return: array
param: int $forum_id   Optional. Forum id.

bbp_get_public_forum_statuses()   X-Ref
Return array of public forum statuses.

since: 2.6.0 bbPress (r6921)
return: array

bbp_get_non_public_forum_statuses()   X-Ref
Return array of non-public forum statuses.

since: 2.6.0 bbPress (r6921)
return: array

bbp_get_hidden_forum_ids()   X-Ref
Returns the hidden forum ids

Only hidden forum ids are returned. Public and private ids are not.

since: 2.0.0 bbPress (r3007)

bbp_get_private_forum_ids()   X-Ref
Returns the private forum ids

Only private forum ids are returned. Public and hidden ids are not.

since: 2.0.0 bbPress (r3007)

bbp_get_excluded_forum_ids()   X-Ref
Returns the forum IDs that should be excluded from various views & queries,
based on the current user's capabilities.

since: 2.6.0 bbPress (r6425)
return: array Forum IDs to exclude, or an empty array

bbp_exclude_forum_ids( $type = 'string' )   X-Ref
Returns a meta_query that either includes or excludes hidden forum IDs
from a query.

since: 2.0.0 bbPress (r3291)
param: string Optional. The type of value to return. (string|array|meta_query)

bbp_pre_get_posts_normalize_forum_visibility( $posts_query = null )   X-Ref
Adjusts forum, topic, and reply queries to exclude items that might be
contained inside hidden or private forums that the user does not have the
capability to view.

Doing it with an action allows us to trap all WP_Query's rather than needing
to hardcode this logic into each query. It also protects forum content for
plugins that might be doing their own queries.

since: 2.0.0 bbPress (r3291)
return: WP_Query
param: WP_Query $posts_query

bbp_forum_query_topic_ids( $forum_id )   X-Ref
Returns the forum's topic ids

Only topics with published and closed statuses are returned

since: 2.0.0 bbPress (r2908)
param: int $forum_id Forum id

bbp_forum_query_subforum_ids( $forum_id )   X-Ref
Returns the forum's subforum ids

Only forums with published status are returned

since: 2.0.0 bbPress (r2908)
param: int $forum_id Forum id

bbp_forum_query_last_reply_id( $forum_id = 0, $topic_ids = 0 )   X-Ref
Returns the forum's last reply id

since: 2.0.0 bbPress (r2908)
since: 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects
param: int $forum_id Forum id.
param: int $topic_ids Optional. Topic ids.

bbp_forum_enforce_hidden()   X-Ref
Check if it's a hidden forum or a topic or reply of a hidden forum and if
the user can't view it, then sets a 404

since: 2.0.0 bbPress (r2996)

bbp_forum_enforce_private()   X-Ref
Check if it's a private forum or a topic or reply of a private forum and if
the user can't view it, then sets a 404

since: 2.0.0 bbPress (r2996)

bbp_check_forum_edit()   X-Ref
Redirect if unauthorized user is attempting to edit a forum

since: 2.1.0 bbPress (r3607)

bbp_delete_forum_topics( $forum_id = 0 )   X-Ref
Delete all topics (and their replies) for a specific forum ID

since: 2.1.0 bbPress (r3668)
return: If forum is not valid
param: int $forum_id

bbp_trash_forum_topics( $forum_id = 0 )   X-Ref
Trash all topics inside a forum

since: 2.1.0 bbPress (r3668)
return: If forum is not valid
param: int $forum_id

bbp_untrash_forum_topics( $forum_id = 0 )   X-Ref
Untrash all topics inside a forum

since: 2.1.0 bbPress (r3668)
return: If forum is not valid
param: int $forum_id

bbp_delete_forum( $forum_id = 0 )   X-Ref
Called before deleting a forum.

This function is supplemental to the actual forum deletion which is
handled by WordPress core API functions. It is used to clean up after
a forum that is being deleted.

since: 2.1.0 bbPress (r3668)

bbp_trash_forum( $forum_id = 0 )   X-Ref
Called before trashing a forum

This function is supplemental to the actual forum being trashed which is
handled by WordPress core API functions. It is used to clean up after
a forum that is being trashed.

since: 2.1.0 bbPress (r3668)

bbp_untrash_forum( $forum_id = 0 )   X-Ref
Called before untrashing a forum

since: 2.1.0 bbPress (r3668)

bbp_deleted_forum( $forum_id = 0 )   X-Ref
Called after deleting a forum

Try not to use this action. All meta & taxonomy terms have already been
deleted, making them impossible to use.

since: 2.1.0 bbPress (r3668)
since: 2.6.0 bbPress (r6526) Not recommend for usage

bbp_trashed_forum( $forum_id = 0 )   X-Ref
Called after trashing a forum

since: 2.1.0 bbPress (r3668)

bbp_untrashed_forum( $forum_id = 0 )   X-Ref
Called after untrashing a forum

since: 2.1.0 bbPress (r3668)



Generated: Sat Dec 21 01:00:52 2024 Cross-referenced by PHPXref 0.7.1