本文整理汇总了PHP中bbp_get_reply_post_type函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_reply_post_type函数的具体用法?PHP bbp_get_reply_post_type怎么用?PHP bbp_get_reply_post_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_reply_post_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mycred_exclude_post_type_bbPress
function mycred_exclude_post_type_bbPress($excludes)
{
$excludes[] = bbp_get_forum_post_type();
$excludes[] = bbp_get_topic_post_type();
$excludes[] = bbp_get_reply_post_type();
return $excludes;
}
示例2: 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;
}
示例3: hybrid_meta_box_post_remove_seo
/**
* Remove the meta box from some post types.
*
* @since 1.3.0
* @param string $post_type The post type of the current post being edited.
* @param object $post The current post being edited.
* @return void
*/
function hybrid_meta_box_post_remove_seo($post_type, $post)
{
/* Removes post stylesheets support of the bbPress 'topic' post type. */
if (function_exists('bbp_get_topic_post_type') && bbp_get_topic_post_type() == $post_type) {
remove_meta_box('hybrid-core-post-seo', bbp_get_topic_post_type(), 'normal');
} elseif (function_exists('bbp_get_reply_post_type') && bbp_get_reply_post_type() == $post_type) {
remove_meta_box('hybrid-core-post-seo', bbp_get_reply_post_type(), 'normal');
}
}
示例4: hybrid_meta_box_post_remove_template
/**
* Remove the meta box from some post types.
*
* @since 1.3.0
* @access public
* @param string $post_type The post type of the current post being edited.
* @param object $post The current post being edited.
* @return void
*/
function hybrid_meta_box_post_remove_template($post_type, $post)
{
/* Removes meta box from pages since this is a built-in WordPress feature. */
if ('page' == $post_type) {
remove_meta_box('hybrid-core-post-template', 'page', 'side');
} elseif (function_exists('bbp_get_topic_post_type') && bbp_get_topic_post_type() == $post_type) {
remove_meta_box('hybrid-core-post-template', bbp_get_topic_post_type(), 'side');
} elseif (function_exists('bbp_get_reply_post_type') && bbp_get_reply_post_type() == $post_type) {
remove_meta_box('hybrid-core-post-template', bbp_get_reply_post_type(), 'side');
}
}
示例5: register_bb_custom_sidebar_mb
function register_bb_custom_sidebar_mb()
{
if (!function_exists('bbp_get_topic_post_type') || !function_exists('bbp_get_forum_post_type') || !function_exists('bbp_get_reply_post_type')) {
return;
}
$options = array('id' => 'circleflip-custom-sidebar-page', 'title' => 'Custom Sidebar', 'callback' => 'render_page_custom_sidebar_mb', 'context' => 'normal', 'priority' => 'high', 'callback_args' => NULL);
extract($options);
add_meta_box($id, $title, $callback, bbp_get_topic_post_type(), $context, $priority, $callback_args);
add_meta_box($id, $title, $callback, bbp_get_forum_post_type(), $context, $priority, $callback_args);
add_meta_box($id, $title, $callback, bbp_get_reply_post_type(), $context, $priority, $callback_args);
}
示例6: bbpvotes_buddypress_voted_activity
function bbpvotes_buddypress_voted_activity($post_id, $user_id, $vote)
{
//check vote value
if (is_bool($vote) === false) {
return new WP_Error('vote_is_not_bool', __('Vote is not a boolean', 'bbpvotes'));
}
$voteplus = $vote === true;
$voteminus = $vote === false;
$post = get_post($post_id);
$user_link = bbp_get_user_profile_link($user_id);
//build item link
if ($post->post_type == bbp_get_topic_post_type()) {
$topic_id = $post->ID;
$post_permalink = get_permalink($post->ID);
} elseif ($post->post_type == bbp_get_reply_post_type()) {
$topic_id = bbp_get_reply_topic_id($post->ID);
$post_permalink = bbp_get_reply_url($post->ID);
}
//topic infos
$topic = get_post($topic_id);
$topic_author_link = bbp_get_user_profile_link($topic->post_author);
$topic_title = $topic->post_title;
$post_link = '<a href="' . $post_permalink . '">' . $topic_title . '</a>';
if ($voteplus) {
$type = 'bbpvotes_voted_up';
if ($post->post_type == bbp_get_topic_post_type()) {
$action = sprintf(esc_html__('%1$s voted up to the topic %2$s by %3$s', 'bbpress'), $user_link, $post_link, $topic_author_link);
} elseif ($post->post_type == bbp_get_reply_post_type()) {
$action = sprintf(esc_html__('%1$s voted up to a reply by %3$s in the topic %2$s', 'bbpress'), $user_link, $post_link, $topic_author_link);
}
} else {
$type = 'bbpvotes_voted_down';
if ($post->post_type == bbp_get_topic_post_type()) {
$action = sprintf(esc_html__('%1$s voted down to the topic %2$s by %3$s', 'bbpress'), $user_link, $post_link, $topic_author_link);
} elseif ($post->post_type == bbp_get_reply_post_type()) {
$action = sprintf(esc_html__('%1$s voted down to a reply by %3$s in the topic %2$s', 'bbpress'), $user_link, $post_link, $topic_author_link);
}
}
$args = array('action' => $action, 'component' => 'bbpress', 'type' => $type, 'item_id' => $topic->ID);
if ($post->post_type == bbp_get_reply_post_type()) {
$args['secondary_item_id'] = $post->ID;
}
/*
if ($is_update){
$previous_activity_id =
$args['id'] = $previous_activity_id;
}
*/
bp_activity_add($args);
}
示例7: test_bbp_reply_post_type
/**
* @covers ::bbp_reply_post_type
* @covers ::bbp_get_reply_post_type
*/
public function test_bbp_reply_post_type()
{
$t = $this->factory->topic->create();
$r = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('topic_id' => $t)));
$robj = get_post_type_object('reply');
$this->assertInstanceOf('stdClass', $robj);
$this->assertEquals('reply', $robj->name);
// Test some defaults
$this->assertFalse(is_post_type_hierarchical('topic'));
$reply_type = bbp_reply_post_type($r);
$this->expectOutputString('reply', $reply_type);
$reply_type = bbp_get_reply_post_type($r);
$this->assertSame('reply', $reply_type);
}
示例8: bbPressPostTypes
/**
* bbPress post types.
*
* @since 150821 Improving bbPress support.
*
* @return array All bbPress post types.
*/
public function bbPressPostTypes()
{
if (!$this->isBbPressActive()) {
return [];
}
if (!is_null($types =& $this->cacheKey('bbPressPostTypes'))) {
return $types;
// Already did this.
}
$types = [];
// Initialize.
$types[] = bbp_get_forum_post_type();
$types[] = bbp_get_topic_post_type();
$types[] = bbp_get_reply_post_type();
return $types;
}
示例9: test_bbp_reply_post_type
/**
* @covers ::bbp_reply_post_type
* @covers ::bbp_get_reply_post_type
*/
public function test_bbp_reply_post_type()
{
$t = $this->factory->topic->create();
$r = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('topic_id' => $t)));
$robj = get_post_type_object('reply');
// WordPress 4.6 introduced `WP_Post_Type` class
if (bbp_get_major_wp_version() < 4.6) {
$this->assertInstanceOf('stdClass', $robj);
} else {
$this->assertInstanceOf('WP_Post_Type', $robj);
}
$this->assertEquals('reply', $robj->name);
// Test some defaults
$this->assertFalse(is_post_type_hierarchical('topic'));
$reply_type = bbp_reply_post_type($r);
$this->expectOutputString('reply', $reply_type);
$reply_type = bbp_get_reply_post_type($r);
$this->assertSame('reply', $reply_type);
}
示例10: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$title = !empty($instance['title']) ? $instance['title'] : __('Recent Comments');
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
$number = !empty($instance['number']) ? absint($instance['number']) : 5;
if (!$number) {
$number = 5;
}
$cb_qry = new WP_Query(array('post_type' => bbp_get_reply_post_type(), 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()), 'posts_per_page' => $number, 'ignore_sticky_posts' => true, 'no_found_rows' => true));
echo $before_widget;
echo $before_title . $title . $after_title;
?>
<ul class="cb-bbp-recent-replies">
<?php
while ($cb_qry->have_posts()) {
$cb_qry->the_post();
?>
<li>
<?php
$cb_reply_id = bbp_get_reply_id($cb_qry->post->ID);
$cb_reply_url = '<a class="bbp-reply-topic-title" href="' . esc_url(bbp_get_reply_url($cb_reply_id)) . '" title="' . esc_attr(bbp_get_reply_excerpt($cb_reply_id, 50)) . '">' . bbp_get_reply_topic_title($cb_reply_id) . '</a>';
$cb_author_avatar = bbp_get_reply_author_link(array('post_id' => $cb_reply_id, 'type' => 'avatar', 'size' => 60));
$cb_author_name = bbp_get_reply_author_link(array('post_id' => $cb_reply_id, 'type' => 'name'));
echo $cb_author_avatar . '<div class="cb-bbp-meta">' . $cb_author_name . ' <i class="icon-long-arrow-right"></i> ' . $cb_reply_url . '<div class="cb-bbp-recent-replies-time">' . bbp_get_time_since(get_the_time('U')) . '</div></div>';
?>
</li>
<?php
}
?>
</ul>
<?php
echo $after_widget;
// Reset the $post global
wp_reset_postdata();
}
示例11: check_private_groups_reply_ids
function check_private_groups_reply_ids($post_ids)
{
//Init the Array which will hold our list of allowed posts
$allowed_posts = array();
//Loop through all the posts
foreach ($post_ids as $post_id) {
//Get the Forum ID based on Post Type Topic
$reply = bbp_get_reply_post_type();
$forum_id = private_groups_get_forum_id_from_post_id($post_id, $reply);
//Check if User has permissions to view this Post ID
//by calling the function that checks if the user can view this forum, and hence this post
if (private_groups_can_user_view_post_id($forum_id)) {
//User can view this post - add it to the allowed array
array_push($allowed_posts, $post_id);
}
}
//Return the list
return $allowed_posts;
}
示例12: tehnik_bpp_get_forum_id_from_post_id
function tehnik_bpp_get_forum_id_from_post_id($post_id, $post_type)
{
$forum_id = 0;
// Check post type
switch ($post_type) {
// Forum
case bbp_get_forum_post_type():
$forum_id = bbp_get_forum_id($post_id);
break;
// Topic
// Topic
case bbp_get_topic_post_type():
$forum_id = bbp_get_topic_forum_id($post_id);
break;
// Reply
// Reply
case bbp_get_reply_post_type():
$forum_id = bbp_get_reply_forum_id($post_id);
break;
}
return $forum_id;
}
示例13: bbpress_replieslist_settings_field
function bbpress_replieslist_settings_field($settings, $value)
{
$dependency = vc_generate_dependencies_attributes($settings);
$param_name = isset($settings['param_name']) ? $settings['param_name'] : '';
$type = isset($settings['type']) ? $settings['type'] : '';
$args = array('post_type' => bbp_get_reply_post_type(), 'orderby' => 'title', 'order' => 'ASC');
$forums = new WP_Query($args);
$output = '';
$output .= '<select name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-input wpb-select ' . $settings['param_name'] . ' ' . $settings['type'] . '">';
while ($forums->have_posts()) {
$forums->the_post();
if ($value != '' && get_the_ID() == $value) {
$selected = ' selected="selected"';
} else {
$selected = "";
}
$output .= '<option class="' . get_the_ID() . '" data-id="' . get_the_ID() . '" data-value="' . get_the_title() . '" value="' . get_the_ID() . '"' . $selected . '>' . get_the_title() . '</option>';
}
wp_reset_query();
$output .= '</select>';
return $output;
}
示例14: bbp_current_user_can_see
/**
* Can the current user see a specific UI element?
*
* Used when registering post-types and taxonomies to decide if 'show_ui' should
* be set to true or false. Also used for fine-grained control over which admin
* sections are visible under what conditions.
*
* This function is in bbp-core-caps.php rather than in /bbp-admin so that it
* can be used during the bbp_register_post_types action.
*
* @since bbPress (r3944)
*
* @uses current_user_can() To check the 'moderate' capability
* @uses bbp_get_forum_post_type()
* @uses bbp_get_topic_post_type()
* @uses bbp_get_reply_post_type()
* @uses bbp_get_topic_tag_tax_id()
* @uses is_plugin_active()
* @uses is_super_admin()
* @return bool Results of current_user_can( 'moderate' ) check.
*/
function bbp_current_user_can_see($component = '')
{
// Define local variable
$retval = false;
// Which component are we checking UI visibility for?
switch ($component) {
/** Everywhere ********************************************************/
case bbp_get_forum_post_type():
// Forums
// Forums
case bbp_get_topic_post_type():
// Topics
// Topics
case bbp_get_reply_post_type():
// Replies
// Replies
case bbp_get_topic_tag_tax_id():
// Topic-Tags
$retval = current_user_can('moderate');
break;
/** Admin Exclusive ***************************************************/
/** Admin Exclusive ***************************************************/
case 'bbp_settings_buddypress':
// BuddyPress Extension
$retval = is_plugin_active('buddypress/bp-loader.php') && defined('BP_VERSION') && is_super_admin();
break;
case 'bbp_settings_akismet':
// Akismet Extension
$retval = is_plugin_active('akismet/akismet.php') && defined('AKISMET_VERSION') && is_super_admin();
break;
case 'bbp_tools_page':
// Tools Page
// Tools Page
case 'bbp_tools_repair_page':
// Tools - Repair Page
// Tools - Repair Page
case 'bbp_tools_import_page':
// Tools - Import Page
// Tools - Import Page
case 'bbp_tools_reset_page':
// Tools - Reset Page
// Tools - Reset Page
case 'bbp_settings?page':
// Settings Page
// Settings Page
case 'bbp_settings_main':
// Settings - General
// Settings - General
case 'bbp_settings_theme_compat':
// Settings - Theme compat
// Settings - Theme compat
case 'bbp_settings_root_slugs':
// Settings - Root slugs
// Settings - Root slugs
case 'bbp_settings_single_slugs':
// Settings - Single slugs
// Settings - Single slugs
case 'bbp_settings_per_page':
// Settings - Single slugs
// Settings - Single slugs
case 'bbp_settings_per_page_rss':
// Settings - Single slugs
// Settings - Single slugs
default:
// Anything else
$retval = current_user_can(bbpress()->admin->minimum_capability);
break;
}
return (bool) apply_filters('bbp_current_user_can_see', (bool) $retval, $component);
}
示例15: bbp_forum_enforce_private
/**
* 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 bbPress (r2996)
*
* @uses current_user_can() To check if the current user can read private forums
* @uses is_singular() To check if it's a singular page
* @uses bbp_is_user_keymaster() To check if user is a keymaster
* @uses bbp_get_forum_post_type() To get the forum post type
* @uses bbp_get_topic_post_type() To get the topic post type
* @uses bbp_get_reply_post_type() TO get the reply post type
* @uses bbp_get_topic_forum_id() To get the topic forum id
* @uses bbp_get_reply_forum_id() To get the reply forum id
* @uses bbp_is_forum_private() To check if the forum is private or not
* @uses bbp_set_404() To set a 404 status
*/
function bbp_forum_enforce_private()
{
// Bail if not viewing a single item or if user has caps
if (!is_singular() || bbp_is_user_keymaster() || current_user_can('read_private_forums')) {
return;
}
global $wp_query;
// Define local variable
$forum_id = 0;
// Check post type
switch ($wp_query->get('post_type')) {
// Forum
case bbp_get_forum_post_type():
$forum_id = bbp_get_forum_id($wp_query->post->ID);
break;
// Topic
// Topic
case bbp_get_topic_post_type():
$forum_id = bbp_get_topic_forum_id($wp_query->post->ID);
break;
// Reply
// Reply
case bbp_get_reply_post_type():
$forum_id = bbp_get_reply_forum_id($wp_query->post->ID);
break;
}
// If forum is explicitly hidden and user not capable, set 404
if (!empty($forum_id) && bbp_is_forum_private($forum_id) && !current_user_can('read_private_forums')) {
bbp_set_404();
}
}