/bbp-includes/bbp-common-template.php

Description

bbPress Common Template Tags

Common template tags are ones that are used by more than one component, like forums, topics, replies, users, topic tags, etc...

Functions
bbp_allowed_tags (line 1989)

Output all of the allowed tags in HTML format with attributes.

This is useful for displaying in the post area, which elements and attributes are supported. As well as any plugins which want to display it.

void bbp_allowed_tags ()
bbp_body_class (line 715)

Use the above is_() functions to output a body class for each scenario

array bbp_body_class (array $wp_classes, [array $custom_classes = false])
  • array $wp_classes
  • array $custom_classes
bbp_breadcrumb (line 1728)

Output a breadcrumb

void bbp_breadcrumb ([ $args = array()], string $sep, bool $current_page, bool $root)
  • string $sep: Separator. Defaults to '←'
  • bool $current_page: Include the current item
  • bool $root: Include the root page if one exists
  • $args
bbp_dropdown (line 1093)

Output a select box allowing to pick which forum/topic a new topic/reply belongs in.

Can be used for any post type, but is mostly used for topics and forums.

void bbp_dropdown ([mixed $args = ''])
bbp_edit_user_form_fields (line 1399)

Output the required hidden fields when editing a user

  • since: bbPress (r2690)
  • uses: wp_referer_field() - To generate a hidden referer field
  • uses: bbp_displayed_user_id() - To output the displayed user id
  • uses: wp_nonce_field() - To generate a hidden nonce field
void bbp_edit_user_form_fields ()
bbp_footer (line 87)

Add our custom head action to wp_head

  • since: bbPress (r2464)
  • uses: do_action() - Calls 'bbp_footer'
void bbp_footer ()
bbp_forums_url (line 26)

Ouput the forum URL

void bbp_forums_url ([string $path = '/'])
  • string $path: Additional path with leading slash
bbp_forum_form_fields (line 1264)

Output the required hidden fields when creating/editing a forum

void bbp_forum_form_fields ()
bbp_get_allowed_tags (line 2004)

Display all of the allowed tags in HTML format with attributes.

This is useful for displaying in the post area, which elements and attributes are supported. As well as any plugins which want to display it.

  • return: HTML allowed tags entity encoded.
  • since: bbPress (r2780)
  • usedby: bbp_allowed_tags()
  • uses: allowed_tags() - To get the allowed tags
  • uses: apply_filters() - Calls 'bbp_allowed_tags' with the tags
string bbp_get_allowed_tags ()
bbp_get_breadcrumb (line 1755)

Return a breadcrumb ( forum -> topic -> reply )

string bbp_get_breadcrumb ([ $args = array()], string $sep, bool $current_page, bool $root)
  • string $sep: Separator. Defaults to '←'
  • bool $current_page: Include the current item
  • bool $root: Include the root page if one exists
  • $args
bbp_get_dropdown (line 1140)

Output a select box allowing to pick which forum/topic a new topic/reply belongs in.

  • return: The dropdown
  • since: bbPress (r2746)
  • uses: current_user_can() - To check if the current user can read private forums
  • uses: walk_page_dropdown_tree() - To generate the dropdown using the walker
  • uses: BBP_Walker_Dropdown() - As the default walker to generate the dropdown
  • uses: bbp_get_topic_post_type() - To get the topic post type
  • uses: apply_filters() - Calls 'bbp_get_dropdown' with the dropdown and args
  • uses: bbp_get_forum_post_type() - To get the forum post type
string bbp_get_dropdown ([mixed $args = ''])
  • mixed $args: The function supports these args:
    • post_type: Post type, defaults to bbp_get_forum_post_type() (bbp_forum)
    • selected: Selected ID, to not have any value as selected, pass anything smaller than 0 (due to the nature of select box, the first value would of course be selected - though you can have that as none (pass 'show_none' arg))
    • sort_column: Sort by? Defaults to 'menu_order, post_title'
    • child_of: Child of. Defaults to 0
    • post_status: Which all post_statuses to find in? Can be an array or CSV of publish, category, closed, private, spam, trash (based on post type) - if not set, these are automatically determined based on the post_type
    • posts_per_page: Retrieve all forums/topics. Defaults to -1 to get all posts
    • walker: Which walker to use? Defaults to BBP_Walker_Dropdown
    • select_id: ID of the select box. Defaults to 'bbp_forum_id'
    • tab: Tabindex value. False or integer
    • options_only: Show only <options>? No <select>?
    • show_none: False or something like __( '(No Forum)', 'bbpress' ), will have value=""
    • none_found: False or something like __( 'No forums to post to!', 'bbpress' )
    • disable_categories: Disable forum categories and closed forums? Defaults to true. Only for forums and when the category option is displayed.
bbp_get_forums_url (line 38)

Return the forum URL

void bbp_get_forums_url ([string $path = '/'])
  • string $path: Additional path with leading slash
bbp_get_logout_link (line 2096)

Return the logout link

  • return: The logout link
  • since: bbPress (r2827)
  • usedby: bbp_logout_link() - To get the logout link
  • uses: apply_filters() - Calls 'bbp_get_logout_link' with the logout link and redirect to url
  • uses: wp_logout_url() - To get the logout url
string bbp_get_logout_link ([string $redirect_to = ''])
  • string $redirect_to: Redirect to url
bbp_get_query_name (line 1675)

Get the '_bbp_query_name' setting

  • return: To return the query var value
  • since: bbPress (r2695)
  • usedby: bbp_is_query_name() - Get the query var '_bbp_query_name'
  • uses: get_query_var() - To get the query var '_bbp_query_name'
string bbp_get_query_name ()
bbp_get_sanitize_val (line 1016)

Return sanitized $_REQUEST value.

Use the $input_type parameter to properly process the value. This ensures correct sanitization of the value for the receiving input.

  • return: Sanitized value ready for screen display
  • since: bbPress (r2815)
  • usedby: bbp_sanitize_val() - To sanitize the value.
  • uses: apply_filters() - Calls 'bbp_get_sanitize_val' with the sanitized value, request and input type
  • uses: esc_attr() - To escape the string
string bbp_get_sanitize_val ([string $request = ''], [string $input_type = 'text'])
  • string $request: Name of $_REQUEST to look for
  • string $input_type: Type of input. Default: text. Accepts: textarea|password|select|radio|checkbox
bbp_get_tab_index (line 1074)

Output the current tab index of a given form

Use this function to handle the tab indexing of user facing forms within a template file. Calling this function will automatically increment the global tab index by default.

  • return: The global tab index
  • since: bbPress (r2810)
  • uses: apply_filters - Allows return value to be filtered
int bbp_get_tab_index ([int $auto_increment = true])
  • int $auto_increment: Optional. Default true. Set to false to prevent the increment
bbp_get_the_content (line 1471)

Return a textarea or TinyMCE if enabled

  • return: HTML from output buffer
  • since: bbPress (r3586)
  • uses: wp_parse_pargs() - To compare args
  • usedby: bbp_the_content() - To return the content to output
  • uses: wp_editor() - To output the WordPress editor
  • uses: bbp_use_wp_editor() - To see if WP editor is in use
  • uses: apply_filter() - To filter args and output
  • uses: bbp_is_edit() - To see if we are editing something
string bbp_get_the_content ([array $args = array()])
  • array $args
bbp_get_topics_url (line 63)

Return the forum URL

The bbp_get_topics_url ([string $path = '/'])
  • string $path: Additional path with leading slash
bbp_get_view_id (line 1564)

Get the view id

If a view id is supplied, that is used. Otherwise the 'bbp_view' query var is checked for.

bool|string bbp_get_view_id ([string $view = ''])
  • string $view: Optional. View id.
bbp_get_view_title (line 1599)

Get the view name aka title

If a view id is supplied, that is used. Otherwise the bbp_view query var is checked for.

bool|string bbp_get_view_title ([string $view = ''])
  • string $view: Optional. View id
bbp_get_view_url (line 1633)

Return the view url

  • return: View url (or home url if the view was not found)
  • since: bbPress (r2789)
  • usedby: bbp_view_url() - To get the view url
  • uses: sanitize_title() - To sanitize the view id
  • uses: apply_filters() - Calls 'bbp_get_view_url' with the view url, used view id
  • uses: add_query_arg() - To add custom args to the url
  • uses: home_url() - To get blog home url
string bbp_get_view_url ([string $view = false])
  • string $view: Optional. View id
bbp_head (line 76)

Add our custom head action to wp_head

  • since: bbPress (r2464)
  • uses: do_action() - Calls 'bbp_head'
void bbp_head ()
bbp_is_custom_post_type (line 410)

Check if the current post type is one of bbPress's

bool bbp_is_custom_post_type ([mixed $the_post = false])
  • mixed $the_post: Optional. Post object or post ID.
bbp_is_edit (line 671)

Check if current page is an edit page

  • return: True if it's the edit page, false if not
  • since: bbPress (r3585)
  • usedby: bbp_get_the_content() - To see if we are editing something
  • uses: WP_Query - Checks if WP_Query::bbp_is_edit is true
bool bbp_is_edit ()
bbp_is_favorites (line 504)

Check if current page is a bbPress user's favorites page (profile page)

bool bbp_is_favorites ()
bbp_is_forum (line 125)

Check if current page is a bbPress forum

bool bbp_is_forum ([int $post_id = 0])
  • int $post_id: Possible post_id to check
bbp_is_forum_archive (line 147)

Check if we are viewing a forum archive.

bool bbp_is_forum_archive ()
bbp_is_forum_edit (line 191)

Check if current page is a forum edit page

bool bbp_is_forum_edit ()
bbp_is_query_name (line 1663)

Check the passed parameter against the current _bbp_query_name

bool bbp_is_query_name ([ $name = ''])
  • $name
bbp_is_reply (line 436)

Check if current page is a bbPress reply

bool bbp_is_reply ([int $post_id = 0])
  • int $post_id: Possible post_id to check
bbp_is_reply_edit (line 456)

Check if current page is a reply edit page

bool bbp_is_reply_edit ()
bbp_is_single_forum (line 171)

Viewing a single forum

bool bbp_is_single_forum ()
bbp_is_single_reply (line 485)

Viewing a single reply

bool bbp_is_single_reply ()
bbp_is_single_topic (line 242)

Viewing a single topic

bool bbp_is_single_topic ()
bbp_is_single_user (line 603)

Check if current page is a user profile page

bool bbp_is_single_user ()
bbp_is_single_user_edit (line 624)

Check if current page is a user profile edit page

bool bbp_is_single_user_edit ()
bbp_is_single_view (line 646)

Check if current page is a view page

bool bbp_is_single_view ()
bbp_is_site_public (line 104)

Check if current site is public

  • return: True if site is public, false if private
  • since: bbPress (r3398)
  • uses: get_current_blog_id()
  • uses: apply_filters()
  • uses: get_blog_option()
bool bbp_is_site_public ([int $site_id = 0])
  • int $site_id
bbp_is_subscriptions (line 524)

Check if current page is a bbPress user's subscriptions page (profile page)

bool bbp_is_subscriptions ()
bbp_is_topic (line 218)

Check if current page is a bbPress topic

bool bbp_is_topic ([int $post_id = 0])
  • int $post_id: Possible post_id to check
bbp_is_topics_created (line 546)

Check if current page shows the topics created by a bbPress user (profile page)

bool bbp_is_topics_created ()
bbp_is_topic_archive (line 264)

Check if we are viewing a topic archive.

bool bbp_is_topic_archive ()
bbp_is_topic_edit (line 284)

Check if current page is a topic edit page

bool bbp_is_topic_edit ()
bbp_is_topic_merge (line 309)

Check if current page is a topic merge page

bool bbp_is_topic_merge ()
bbp_is_topic_split (line 329)

Check if current page is a topic split page

bool bbp_is_topic_split ()
bbp_is_topic_tag (line 348)

Check if the current page is a topic tag

  • return: True if it's a topic tag, false if not
  • since: bbPress (r3311)
  • usedby: bbp_body_class()
bool bbp_is_topic_tag ()
bbp_is_topic_tag_edit (line 376)

Check if the current page is editing a topic tag

bool bbp_is_topic_tag_edit ()
bbp_is_user_home (line 563)

Check if current page is the currently logged in users author page

bool bbp_is_user_home ()
bbp_is_user_home_edit (line 584)

Check if current page is the currently logged in users author edit page

bool bbp_is_user_home_edit ()
bbp_logout_link (line 2082)

Output the logout link

void bbp_logout_link ([string $redirect_to = ''])
  • string $redirect_to: Redirect to url
bbp_merge_topic_form_fields (line 1418)

Merge topic form fields

Output the required hidden fields when merging a topic

  • since: bbPress (r2756)
  • uses: wp_nonce_field() - To generate a hidden nonce field
  • uses: bbp_topic_id() - To output the topic id
void bbp_merge_topic_form_fields ()
bbp_redirect_to_field (line 967)

Output hidden request URI field for user forms.

The referer link is the current Request URI from the server super global. The input name is '_wp_http_referer', in case you wanted to check manually.

  • since: bbPress (r2815)
  • usedby: bbp_user_register_fields() - To output the redirect to field
  • usedby: bbp_user_login_fields() - To output the hidden request url field
  • uses: esc_attr() - To escape the url
  • uses: apply_filters() - Calls 'bbp_redirect_to_field' with the referer field and url
  • uses: wp_get_referer() - To get the referer
void bbp_redirect_to_field ([ $redirect_to = ''], string $url)
  • string $url: Pass a URL to redirect to
  • $redirect_to
bbp_reply_form_fields (line 1358)

Output the required hidden fields when creating/editing a reply

void bbp_reply_form_fields ()
bbp_reset_query_name (line 1698)

Used to clear the '_bbp_query_name' setting

  • since: bbPress (r2692)
  • uses: bbp_set_query_name() - To set the query var '_bbp_query_name' value to ''
void bbp_reset_query_name ()
bbp_sanitize_val (line 997)

Echo sanitized $_REQUEST value.

Use the $input_type parameter to properly process the value. This ensures correct sanitization of the value for the receiving input.

void bbp_sanitize_val ([string $request = ''], [string $input_type = 'text'])
  • string $request: Name of $_REQUEST to look for
  • string $input_type: Type of input. Default: text. Accepts: textarea|password|select|radio|checkbox
bbp_set_query_name (line 1687)

Set the '_bbp_query_name' setting to $name

  • since: bbPress (r2692)
  • usedby: bbp_reset_query_name() - To set the query var '_bbp_query_name' value to ''
  • uses: set_query_var() - To set the query var '_bbp_query_name'
void bbp_set_query_name ([string $name = ''])
  • string $name: What to set the query var to
bbp_split_topic_form_fields (line 1436)

Split topic form fields

Output the required hidden fields when splitting a topic

  • since: bbPress (r2756)
  • uses: wp_nonce_field() - To generete a hidden nonce field
void bbp_split_topic_form_fields ()
bbp_tab_index (line 1056)

Output the current tab index of a given form

Use this function to handle the tab indexing of user facing forms within a template file. Calling this function will automatically increment the global tab index by default.

  • since: bbPress (r2810)
void bbp_tab_index ([int $auto_increment = true])
  • int $auto_increment: Optional. Default true. Set to false to prevent increment
bbp_template_notices (line 2021)

Display possible errors & messages inside a template file

  • since: bbPress (r2688)
  • uses: WP_Error - bbPress::errors::get_error_messages() To get the error messages
  • uses: WP_Error - bbPress::errors::get_error_codes() To get the error codes
  • uses: WP_Error - bbPress::errors::get_error_data() To get the error data
  • uses: is_wp_error() - To check if it's a WP_Error
void bbp_template_notices ()
bbp_the_content (line 1453)

Output a textarea or TinyMCE if enabled

void bbp_the_content ([array $args = array()])
  • array $args
bbp_title (line 2131)

Custom page title for bbPress pages

string bbp_title ([string $title = ''], [string $sep = '&amp;raquo;'], [string $seplocation = ''])
  • string $title: Optional. The title (not used).
  • string $sep: Optional, default is '&raquo;'. How to separate the various items within the page title.
  • string $seplocation: Optional. Direction to display title, 'right'.
bbp_title_breadcrumb (line 1714)

Output the page title as a breadcrumb

void bbp_title_breadcrumb ([ $args = array()], string $sep, bool $current_page, bool $root)
  • string $sep: Separator. Defaults to '&larr;'
  • bool $current_page: Include the current item
  • bool $root: Include the root page if one exists
  • $args
bbp_topics_url (line 50)

Ouput the forum URL

void bbp_topics_url ([string $path = '/'])
  • string $path: Additional path with leading slash
bbp_topic_form_fields (line 1313)

Output the required hidden fields when creating/editing a topic

void bbp_topic_form_fields ()
bbp_view_id (line 1547)

Output the view id

void bbp_view_id ([string $view = ''])
  • string $view: Optional. View id
bbp_view_title (line 1583)

Output the view name aka title

void bbp_view_title ([string $view = ''])
  • string $view: Optional. View id
bbp_view_url (line 1617)

Output the view url

void bbp_view_url ([string $view = false])
  • string $view: Optional. View id
bbp_wp_login_action (line 935)

Output the login form action url

  • since: bbPress (r2815)
  • uses: site_url() - Toget the site url
  • uses: add_query_arg() - To add a arg to the url
  • uses: apply_filters() - Calls 'bbp_wp_login_action' with the url and args
void bbp_wp_login_action ([ $args = ''], string $url)
  • string $url: Pass a URL to redirect to
  • $args
is_bbpress (line 848)

Use the above is_() functions to return if in any bbPress page

bool is_bbpress ()

Documentation generated on Mon, 01 Sep 2014 01:45:45 +0100 by phpDocumentor 1.4.3