本文整理汇总了PHP中bbpress函数的典型用法代码示例。如果您正苦于以下问题:PHP bbpress函数的具体用法?PHP bbpress怎么用?PHP bbpress使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbpress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_admin_menu_order
/**
* Move our custom separator above our custom post types
*
* @since bbPress (r2957)
*
* @param array $menu_order Menu Order
* @uses bbp_get_forum_post_type() To get the forum post type
* @return array Modified menu order
*/
function bbp_admin_menu_order($menu_order)
{
// Bail if user cannot see any top level bbPress menus
if (empty($menu_order) || false === bbpress()->admin->show_separator) {
return $menu_order;
}
// Initialize our custom order array
$bbp_menu_order = array();
// Menu values
$second_sep = 'separator2';
$custom_menus = array('separator-bbpress', 'edit.php?post_type=' . bbp_get_forum_post_type(), 'edit.php?post_type=' . bbp_get_topic_post_type(), 'edit.php?post_type=' . bbp_get_reply_post_type());
// Loop through menu order and do some rearranging
foreach ($menu_order as $item) {
// Position bbPress menus above appearance
if ($second_sep == $item) {
// Add our custom menus
foreach ($custom_menus as $custom_menu) {
if (array_search($custom_menu, $menu_order)) {
$bbp_menu_order[] = $custom_menu;
}
}
// Add the appearance separator
$bbp_menu_order[] = $second_sep;
// Skip our menu items
} elseif (!in_array($item, $custom_menus)) {
$bbp_menu_order[] = $item;
}
}
// Return our custom order
return $bbp_menu_order;
}
示例2: settings_map_cap
function settings_map_cap($caps, $cap, $user_id, $args)
{
if ($cap == 'bbpvotes_settings') {
$caps = array(bbpress()->admin->minimum_capability);
}
return $caps;
}
示例3: get_all_forums
public function get_all_forums()
{
$bbp_f = bbp_parse_args($args, array('post_type' => bbp_get_forum_post_type(), 'post_parent' => 'any', 'post_status' => bbp_get_public_status_id(), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'ignore_sticky_posts' => true, 'orderby' => 'menu_order title', 'order' => 'ASC'), 'has_forums');
$bbp = bbpress();
$bbp->forum_query = new WP_Query($bbp_f);
$data = array();
foreach ($bbp->forum_query->posts as $post) {
$type = 'forum';
$is_parent = false;
$is_category = bbp_forum_get_subforums($post->ID);
if ($is_category) {
$type = 'category';
$parent = true;
}
$settings = $this->wlm->GetOption('bbpsettings');
if ($settings && count($settings) > 0) {
foreach ($settings as $setting) {
if ($setting["id"] == $post->ID) {
$data[$post->ID] = array("id" => $post->ID, "name" => $post->post_title, "level" => $setting["sku"], "protection" => $setting["protection"], "type" => $type, "parent" => $parent, "date" => "");
}
}
if (!isset($data[$post->ID])) {
$data[$post->ID] = array("id" => $post->ID, "name" => $post->post_title, "level" => "", "protection" => "", "type" => $type, "parent" => $parent, "date" => "");
}
} else {
$data[$post->ID] = array("id" => $post->ID, "name" => $post->post_title, "level" => "", "protection" => "", "type" => $type, "parent" => $parent, "date" => "");
}
}
echo json_encode($data);
die;
}
示例4: learn_press_remove_all_filters
/**
* Remove all filter
* @param String $tag
* @param boolean $priority
* @return boolean
*/
function learn_press_remove_all_filters($tag, $priority = false)
{
global $wp_filter, $merged_filters;
if (!function_exists('bbpress')) {
return;
}
$bbp = bbpress();
// Filters exist
if (isset($wp_filter[$tag])) {
// Filters exist in this priority
if (!empty($priority) && isset($wp_filter[$tag][$priority])) {
// Store filters in a backup
$bbp->filters->wp_filter[$tag][$priority] = $wp_filter[$tag][$priority];
// Unset the filters
unset($wp_filter[$tag][$priority]);
// Priority is empty
} else {
// Store filters in a backup
$bbp->filters->wp_filter[$tag] = $wp_filter[$tag];
// Unset the filters
unset($wp_filter[$tag]);
}
}
// Check merged filters
if (isset($merged_filters[$tag])) {
// Store filters in a backup
$bbp->filters->merged_filters[$tag] = $merged_filters[$tag];
// Unset the filters
unset($merged_filters[$tag]);
}
return true;
}
示例5: setup_globals
/**
* Component global variables
*
* @since bbPress (r2626)
* @access private
* @uses bbp_get_version() To get the bbPress version
* @uses get_stylesheet_directory() To get the stylesheet path
* @uses get_stylesheet_directory_uri() To get the stylesheet uri
*/
private function setup_globals()
{
$bbp = bbpress();
$this->id = 'bbp-twentyten';
$this->name = __('Twenty Ten (bbPress)', 'bbpress');
$this->version = bbp_get_version();
$this->dir = trailingslashit($bbp->themes_dir . 'bbp-twentyten');
$this->url = trailingslashit($bbp->themes_url . 'bbp-twentyten');
}
示例6: setup_globals
/**
* Component global variables
*
* Note that this function is currently commented out in the constructor.
* It will only be used if you copy this file into your current theme and
* uncomment the line above.
*
* You'll want to customize the values in here, so they match whatever your
* needs are.
*
* @since bbPress (r3732)
* @access private
*/
private function setup_globals()
{
$bbp = bbpress();
$this->id = 'default';
$this->name = __('bbPress Default', 'bbpress');
$this->version = bbp_get_version();
$this->dir = trailingslashit($bbp->themes_dir . 'default');
$this->url = trailingslashit($bbp->themes_url . 'default');
}
示例7: settings_meta_caps
static function settings_meta_caps($caps, $cap)
{
switch ($cap) {
default:
$caps = array(bbpress()->admin->minimum_capability);
break;
}
return $caps;
}
示例8: meta_caps
/**
* Maps settings capabilities
*
* @param array $caps Capabilities for meta capability
* @param string $cap Capability name
*
* @return array Actual capabilities for meta capability
*/
public function meta_caps($caps, $cap)
{
switch ($cap) {
case 'bbp_settings_block':
// User blocking settings
$caps = array(bbpress()->admin->minimum_capability);
break;
}
return $caps;
}
示例9: bbp_after_has_search_results_parse_args
/**
* Filter bbPress arguments
*
* @param $bbp_args
*
* @return mixed
*/
public function bbp_after_has_search_results_parse_args($bbp_args)
{
$bbp = bbpress();
$bbp->search_query = new WPSOLR_Query($bbp_args);
// Remove the 's' parameter, to prevent bbPress executing it's own wp_query
if (!empty($bbp_args['s'])) {
unset($bbp_args['s']);
}
return $bbp_args;
}
示例10: tf_get_search_pagination_links
function tf_get_search_pagination_links()
{
$bbp = bbpress();
$pagination_links = $bbp->search_query->pagination_links;
$pagination_links = str_replace('page-numbers current', 'current', $pagination_links);
$pagination_links = str_replace('page-numbers', 'inactive', $pagination_links);
$pagination_links = str_replace('prev inactive', 'pagination-prev', $pagination_links);
$pagination_links = str_replace('next inactive', 'pagination-next', $pagination_links);
$pagination_links = str_replace('←', __('Previous', 'Avada') . '<span class="page-prev"></span>', $pagination_links);
$pagination_links = str_replace('→', __('Next', 'Avada') . '<span class="page-next"></span>', $pagination_links);
return $pagination_links;
}
示例11: bp_registration_options_init
/**
* Loads BP Registration Options files only if BuddyPress is present
*
* @package BP-Registration-Options
*
*/
function bp_registration_options_init()
{
# Not using bp_includes because we want to be able to be run with just bbPress as well.
if (function_exists('buddypress')) {
$bp = buddypress();
}
if (function_exists('bbpress')) {
$bbp = bbpress();
}
if (isset($bp) && version_compare($bp->version, '1.7.0', '>=') || isset($bbp) && version_compare($bbp->version, '2.0.0', '>=')) {
require dirname(__FILE__) . '/bp-registration-options.php';
$bp_registration_options = new BP_Registration_Options();
$bp_registration_compatibility = new BP_Registration_Compatibility();
}
}
示例12: d4p_bbpress_version
/**
* Get version of the bbPress.
*
* @param string $ret what version format to return: code or version
* @return mixed version value
*/
function d4p_bbpress_version($ret = 'code')
{
if (function_exists('bbpress')) {
$bbp = bbpress();
} else {
global $bbp;
}
if (isset($bbp->version)) {
if ($ret == 'code') {
return substr(str_replace('.', '', $bbp->version), 0, 2);
} else {
return $bbp->version;
}
}
return null;
}
示例13: bp_registration_options_init
/**
* Loads BP Registration Options files only if BuddyPress is present
*
* @package BP-Registration-Options
*
*/
function bp_registration_options_init()
{
$bp = '';
$bbp = '';
# Not using bp_includes because we want to be able to be run with just bbPress as well.
if (function_exists('buddypress')) {
$bp = buddypress();
}
if (function_exists('bbpress')) {
$bbp = bbpress();
}
if (bp_registration_should_init($bp, $bbp)) {
require_once dirname(__FILE__) . '/bp-registration-options.php';
$bp_registration_options = new BP_Registration_Options();
add_action('init', 'bp_registration_options_compat_init');
}
}
示例14: bbp_template_include_theme_supports
/**
* Possibly intercept the template being loaded
*
* Listens to the 'template_include' filter and waits for any bbPress specific
* template condition to be met. If one is met and the template file exists,
* it will be used; otherwise
*
* Note that the _edit() checks are ahead of their counterparts, to prevent them
* from being stomped on accident.
*
* @since bbPress (r3032)
*
* @param string $template
*
* @uses bbp_is_single_user() To check if page is single user
* @uses bbp_get_single_user_template() To get user template
* @uses bbp_is_single_user_edit() To check if page is single user edit
* @uses bbp_get_single_user_edit_template() To get user edit template
* @uses bbp_is_single_view() To check if page is single view
* @uses bbp_get_single_view_template() To get view template
* @uses bbp_is_forum_edit() To check if page is forum edit
* @uses bbp_get_forum_edit_template() To get forum edit template
* @uses bbp_is_topic_merge() To check if page is topic merge
* @uses bbp_get_topic_merge_template() To get topic merge template
* @uses bbp_is_topic_split() To check if page is topic split
* @uses bbp_get_topic_split_template() To get topic split template
* @uses bbp_is_topic_edit() To check if page is topic edit
* @uses bbp_get_topic_edit_template() To get topic edit template
* @uses bbp_is_reply_edit() To check if page is reply edit
* @uses bbp_get_reply_edit_template() To get reply edit template
* @uses bbp_set_theme_compat_template() To set the global theme compat template
*
* @return string The path to the template file that is being used
*/
function bbp_template_include_theme_supports($template = '')
{
// Editing a user
if (bbp_is_single_user_edit() && ($new_template = bbp_get_single_user_edit_template())) {
// Viewing a user
} elseif (bbp_is_single_user() && ($new_template = bbp_get_single_user_template())) {
// Single View
} elseif (bbp_is_single_view() && ($new_template = bbp_get_single_view_template())) {
// Forum edit
} elseif (bbp_is_forum_edit() && ($new_template = bbp_get_forum_edit_template())) {
// Single Forum
} elseif (bbp_is_single_forum() && ($new_template = bbp_get_single_forum_template())) {
// Forum Archive
} elseif (bbp_is_forum_archive() && ($new_template = bbp_get_forum_archive_template())) {
// Topic merge
} elseif (bbp_is_topic_merge() && ($new_template = bbp_get_topic_merge_template())) {
// Topic split
} elseif (bbp_is_topic_split() && ($new_template = bbp_get_topic_split_template())) {
// Topic edit
} elseif (bbp_is_topic_edit() && ($new_template = bbp_get_topic_edit_template())) {
// Single Topic
} elseif (bbp_is_single_topic() && ($new_template = bbp_get_single_topic_template())) {
// Topic Archive
} elseif (bbp_is_topic_archive() && ($new_template = bbp_get_topic_archive_template())) {
// Editing a reply
} elseif (bbp_is_reply_edit() && ($new_template = bbp_get_reply_edit_template())) {
// Single Reply
} elseif (bbp_is_single_reply() && ($new_template = bbp_get_single_reply_template())) {
// Editing a topic tag
} elseif (bbp_is_topic_tag_edit() && ($new_template = bbp_get_topic_tag_edit_template())) {
// Viewing a topic tag
} elseif (bbp_is_topic_tag() && ($new_template = bbp_get_topic_tag_template())) {
}
// bbPress template file exists
if (!empty($new_template)) {
// Override the WordPress template with a bbPress one
$template = $new_template;
// @see: bbp_template_include_theme_compat()
bbpress()->theme_compat->bbpress_template = true;
}
return apply_filters('bbp_template_include_theme_supports', $template);
}
示例15: bbp_setup_buddypress
/**
* Requires and creates the BuddyPress extension, and adds component creation
* action to bp_init hook. @see bbp_setup_buddypress_component()
*
* @since bbPress (r3395)
* @return If BuddyPress is not active
*/
function bbp_setup_buddypress()
{
if (!function_exists('buddypress')) {
/**
* Helper for BuddyPress 1.6 and earlier
*
* @since bbPress (r4395)
* @return BuddyPress
*/
function buddypress()
{
return isset($GLOBALS['bp']) ? $GLOBALS['bp'] : false;
}
}
// Bail if in maintenance mode
if (!buddypress() || buddypress()->maintenance_mode) {
return;
}
// Include the BuddyPress Component
require bbpress()->includes_dir . 'extend/buddypress/loader.php';
// Instantiate BuddyPress for bbPress
bbpress()->extend->buddypress = new BBP_Forums_Component();
}