本文整理汇总了PHP中bbp_get_global_post_field函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_global_post_field函数的具体用法?PHP bbp_get_global_post_field怎么用?PHP bbp_get_global_post_field使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_global_post_field函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_get_form_topic_subscribed
/**
* Return checked value of topic subscription
*
* @since 2.0.0 bbPress (r2976)
*
* @uses bbp_is_topic_edit() To check if it's the topic edit page
* @uses bbp_is_user_subscribed_to_topic() To check if the user is
* subscribed to the topic
* @uses apply_filters() Calls 'bbp_get_form_topic_subscribed' with the
* option
* @return string Checked value of topic subscription
*/
function bbp_get_form_topic_subscribed()
{
// Get _POST data
if (bbp_is_topic_form_post_request() && isset($_POST['bbp_topic_subscription'])) {
$topic_subscribed = (bool) $_POST['bbp_topic_subscription'];
// Get edit data
} elseif (bbp_is_topic_edit() || bbp_is_reply_edit()) {
// Get current posts author
$post_author = bbp_get_global_post_field('post_author', 'raw');
// Post author is not the current user
if (bbp_get_current_user_id() !== $post_author) {
$topic_subscribed = bbp_is_user_subscribed_to_topic($post_author);
// Post author is the current user
} else {
$topic_subscribed = bbp_is_user_subscribed_to_topic(bbp_get_current_user_id());
}
// Get current status
} elseif (bbp_is_single_topic()) {
$topic_subscribed = bbp_is_user_subscribed_to_topic(bbp_get_current_user_id());
// No data
} else {
$topic_subscribed = false;
}
// Get checked output
$checked = checked($topic_subscribed, true, false);
return apply_filters('bbp_get_form_topic_subscribed', $checked, $topic_subscribed);
}
示例2: updated_messages
/**
* Custom user feedback messages for reply post type
*
* @since 2.0.0 bbPress (r3080)
*
* @global int $post_ID
* @uses bbp_get_topic_permalink()
* @uses wp_post_revision_title()
* @uses esc_url()
* @uses add_query_arg()
*
* @param array $messages
*
* @return array
*/
public function updated_messages($messages)
{
global $post_ID;
if ($this->bail()) {
return $messages;
}
// URL for the current topic
$topic_url = bbp_get_topic_permalink(bbp_get_reply_topic_id($post_ID));
// Current reply's post_date
$post_date = bbp_get_global_post_field('post_date', 'raw');
// Messages array
$messages[$this->post_type] = array(0 => '', 1 => sprintf(__('Reply updated. <a href="%s">View topic</a>', 'bbpress'), $topic_url), 2 => __('Custom field updated.', 'bbpress'), 3 => __('Custom field deleted.', 'bbpress'), 4 => __('Reply updated.', 'bbpress'), 5 => isset($_GET['revision']) ? sprintf(__('Reply restored to revision from %s', 'bbpress'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Reply created. <a href="%s">View topic</a>', 'bbpress'), $topic_url), 7 => __('Reply saved.', 'bbpress'), 8 => sprintf(__('Reply submitted. <a target="_blank" href="%s">Preview topic</a>', 'bbpress'), esc_url(add_query_arg('preview', 'true', $topic_url))), 9 => sprintf(__('Reply scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview topic</a>', 'bbpress'), date_i18n(__('M j, Y @ G:i', 'bbpress'), strtotime($post_date)), $topic_url), 10 => sprintf(__('Reply draft updated. <a target="_blank" href="%s">Preview topic</a>', 'bbpress'), esc_url(add_query_arg('preview', 'true', $topic_url))));
return $messages;
}
示例3: bbp_get_form_forum_content
/**
* Return the value of forum content field
*
* @since bbPress (r3551)
*
* @uses bbp_is_forum_edit() To check if it's the forum edit page
* @uses apply_filters() Calls 'bbp_get_form_forum_content' with the content
* @return string Value of forum content field
*/
function bbp_get_form_forum_content()
{
// Get _POST data
if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && isset($_POST['bbp_forum_content'])) {
$forum_content = $_POST['bbp_forum_content'];
} elseif (bbp_is_forum_edit()) {
$forum_content = bbp_get_global_post_field('post_content', 'raw');
} else {
$forum_content = '';
}
return apply_filters('bbp_get_form_forum_content', esc_textarea($forum_content));
}
示例4: bbp_get_form_reply_content
/**
* Return the value of reply content field
*
* @since bbPress (r31301)
*
* @uses bbp_is_reply_edit() To check if it's the reply edit page
* @uses apply_filters() Calls 'bbp_get_form_reply_content' with the content
* @return string Value of reply content field
*/
function bbp_get_form_reply_content()
{
// Get _POST data
if (bbp_is_post_request() && isset($_POST['bbp_reply_content'])) {
$reply_content = stripslashes($_POST['bbp_reply_content']);
// Get edit data
} elseif (bbp_is_reply_edit()) {
$reply_content = bbp_get_global_post_field('post_content', 'raw');
// No data
} else {
$reply_content = '';
}
return apply_filters('bbp_get_form_reply_content', $reply_content);
}
示例5: bbp_author_metabox
/**
* Anonymous user information metabox
*
* @since 2.0.0 bbPress (r2828)
*
* @uses bbp_is_reply_anonymous() To check if reply is anonymous
* @uses bbp_is_topic_anonymous() To check if topic is anonymous
* @uses get_the_ID() To get the global post ID
* @uses get_post_meta() To get the author user information
*/
function bbp_author_metabox()
{
// Post ID
$post_id = get_the_ID();
// Show extra bits if topic/reply is anonymous
if (bbp_is_reply_anonymous($post_id) || bbp_is_topic_anonymous($post_id)) {
?>
<p>
<strong class="label"><?php
esc_html_e('Name:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_anonymous_name"><?php
esc_html_e('Name', 'bbpress');
?>
</label>
<input type="text" id="bbp_anonymous_name" name="bbp_anonymous_name" value="<?php
echo esc_attr(get_post_meta($post_id, '_bbp_anonymous_name', true));
?>
" />
</p>
<p>
<strong class="label"><?php
esc_html_e('Email:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_anonymous_email"><?php
esc_html_e('Email', 'bbpress');
?>
</label>
<input type="text" id="bbp_anonymous_email" name="bbp_anonymous_email" value="<?php
echo esc_attr(get_post_meta($post_id, '_bbp_anonymous_email', true));
?>
" />
</p>
<p>
<strong class="label"><?php
esc_html_e('Website:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_anonymous_website"><?php
esc_html_e('Website', 'bbpress');
?>
</label>
<input type="text" id="bbp_anonymous_website" name="bbp_anonymous_website" value="<?php
echo esc_attr(get_post_meta($post_id, '_bbp_anonymous_website', true));
?>
" />
</p>
<?php
} else {
?>
<p>
<strong class="label"><?php
esc_html_e('ID:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_author_id"><?php
esc_html_e('ID', 'bbpress');
?>
</label>
<input type="text" id="bbp_author_id" name="post_author_override" value="<?php
echo esc_attr(bbp_get_global_post_field('post_author'));
?>
" data-ajax-url="<?php
echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'bbp_suggest_user'), admin_url('admin-ajax.php', 'relative')), 'bbp_suggest_user_nonce'));
?>
" />
</p>
<?php
}
?>
<p>
<strong class="label"><?php
esc_html_e('IP:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_author_ip_address"><?php
esc_html_e('IP Address', 'bbpress');
?>
</label>
<input type="text" id="bbp_author_ip_address" name="bbp_author_ip_address" value="<?php
echo esc_attr(get_post_meta($post_id, '_bbp_author_ip', true));
//.........这里部分代码省略.........
示例6: bbp_forum_metabox
/**
* Forum metabox
*
* The metabox that holds all of the additional forum information
*
* @since bbPress (r2744)
*
* @uses bbp_is_forum_closed() To check if a forum is closed or not
* @uses bbp_is_forum_category() To check if a forum is a category or not
* @uses bbp_is_forum_private() To check if a forum is private or not
* @uses bbp_dropdown() To show a dropdown of the forums for forum parent
* @uses do_action() Calls 'bbp_forum_metabox'
*/
function bbp_forum_metabox()
{
// Post ID
$post_id = get_the_ID();
$post_parent = bbp_get_global_post_field('post_parent', 'raw');
$menu_order = bbp_get_global_post_field('menu_order', 'edit');
/** Type ******************************************************************/
?>
<p>
<strong class="label"><?php
_e('Type:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_forum_type_select"><?php
_e('Type:', 'bbpress');
?>
</label>
<?php
bbp_form_forum_type_dropdown($post_id);
?>
</p>
<?php
/** Status ****************************************************************/
?>
<p>
<strong class="label"><?php
_e('Status:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_forum_status_select"><?php
_e('Status:', 'bbpress');
?>
</label>
<?php
bbp_form_forum_status_dropdown($post_id);
?>
</p>
<?php
/** Visibility ************************************************************/
?>
<p>
<strong class="label"><?php
_e('Visibility:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_forum_visibility_select"><?php
_e('Visibility:', 'bbpress');
?>
</label>
<?php
bbp_form_forum_visibility_dropdown($post_id);
?>
</p>
<hr />
<?php
/** Parent ****************************************************************/
?>
<p>
<strong class="label"><?php
_e('Parent:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="parent_id"><?php
_e('Forum Parent', 'bbpress');
?>
</label>
<?php
bbp_dropdown(array('exclude' => $post_id, 'selected' => $post_parent, 'show_none' => __('(No Parent)', 'bbpress'), 'select_id' => 'parent_id', 'disable_categories' => false));
?>
</p>
<p>
<strong class="label"><?php
_e('Order:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="menu_order"><?php
//.........这里部分代码省略.........
示例7: bbp_get_form_topic_subscribed
/**
* Return checked value of topic subscription
*
* @since bbPress (r2976)
*
* @uses bbp_is_topic_edit() To check if it's the topic edit page
* @uses bbp_is_user_subscribed() To check if the user is subscribed to
* the topic
* @uses apply_filters() Calls 'bbp_get_form_topic_subscribed' with the
* option
* @return string Checked value of topic subscription
*/
function bbp_get_form_topic_subscribed()
{
// Get _POST data
if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && isset($_POST['bbp_topic_subscription'])) {
$topic_subscribed = $_POST['bbp_topic_subscription'];
// Get edit data
} elseif (bbp_is_topic_edit() || bbp_is_reply_edit()) {
// Get current posts author
$post_author = bbp_get_global_post_field('post_author', 'raw');
// Post author is not the current user
if (bbp_get_current_user_id() != $post_author) {
$topic_subscribed = bbp_is_user_subscribed($post_author);
// Post author is the current user
} else {
$topic_subscribed = bbp_is_user_subscribed(bbp_get_current_user_id());
}
// Get current status
} elseif (bbp_is_single_topic()) {
$topic_subscribed = bbp_is_user_subscribed(bbp_get_current_user_id());
// No data
} else {
$topic_subscribed = 0;
}
// Get checked output
$checked = checked($topic_subscribed, true, false);
return apply_filters('bbp_get_form_topic_subscribed', $checked, $topic_subscribed);
}
示例8: bbp_forum_metabox
/**
* Forum metabox
*
* The metabox that holds all of the additional forum information
*
* @since bbPress (r2744)
*
* @uses bbp_is_forum_closed() To check if a forum is closed or not
* @uses bbp_is_forum_category() To check if a forum is a category or not
* @uses bbp_is_forum_private() To check if a forum is private or not
* @uses bbp_dropdown() To show a dropdown of the forums for forum parent
* @uses do_action() Calls 'bbp_forum_metabox'
*/
function bbp_forum_metabox()
{
// Post ID
$post_id = get_the_ID();
$post_parent = bbp_get_global_post_field('post_parent', 'raw');
$menu_order = bbp_get_global_post_field('menu_order', 'edit');
/** Type ******************************************************************/
?>
<p>
<strong class="label"><?php
_e('Type:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_forum_type_select"><?php
_e('Type:', 'bbpress');
?>
</label>
<?php
bbp_form_forum_type_dropdown($post_id);
?>
</p>
<?php
/** Status ****************************************************************/
?>
<p>
<strong class="label"><?php
_e('Status:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_forum_status_select"><?php
_e('Status:', 'bbpress');
?>
</label>
<?php
bbp_form_forum_status_dropdown($post_id);
?>
</p>
<?php
/** Visibility ************************************************************/
?>
<p>
<strong class="label"><?php
_e('Visibility:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="bbp_forum_visibility_select"><?php
_e('Visibility:', 'bbpress');
?>
</label>
<?php
bbp_form_forum_visibility_dropdown($post_id);
?>
</p>
<hr />
<?php
/** Parent ****************************************************************/
?>
<p>
<strong class="label"><?php
_e('Parent:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="parent_id"><?php
_e('Forum Parent', 'bbpress');
?>
</label>
<?php
bbp_dropdown(array('post_type' => bbp_get_forum_post_type(), 'selected' => $post_parent, 'child_of' => '0', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC', 'walker' => '', 'exclude' => $post_id, 'select_id' => 'parent_id', 'tab' => bbp_get_tab_index(), 'options_only' => false, 'show_none' => __('— No parent —', 'bbpress'), 'none_found' => false, 'disable_categories' => false, 'disabled' => ''));
?>
</p>
<p>
<strong class="label"><?php
_e('Order:', 'bbpress');
?>
</strong>
<label class="screen-reader-text" for="menu_order"><?php
_e('Forum Order', 'bbpress');
?>
//.........这里部分代码省略.........
示例9: updated_messages
/**
* Custom user feedback messages for forum post type
*
* @since 2.0.0 bbPress (r3080)
*
* @global int $post_ID
* @uses bbp_get_forum_permalink()
* @uses wp_post_revision_title()
* @uses esc_url()
* @uses add_query_arg()
*
* @param array $messages
*
* @return array
*/
public function updated_messages($messages)
{
global $post_ID;
if ($this->bail()) {
return $messages;
}
// URL for the current forum
$forum_url = bbp_get_forum_permalink($post_ID);
// Current forum's post_date
$post_date = bbp_get_global_post_field('post_date', 'raw');
// Messages array
$messages[$this->post_type] = array(0 => '', 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Forum updated.', 'bbpress'), $forum_url, __('View forum', 'bbpress')), 2 => __('Custom field updated.', 'bbpress'), 3 => __('Custom field deleted.', 'bbpress'), 4 => __('Forum updated.', 'bbpress'), 5 => isset($_GET['revision']) ? sprintf(__('Forum restored to revision from %s', 'bbpress'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Forum created.', 'bbpress'), $forum_url, __('View forum', 'bbpress')), 7 => __('Forum saved.', 'bbpress'), 8 => sprintf('%1$s <a href="%2$s" target="_blank">%3$s</a>', __('Forum submitted.', 'bbpress'), esc_url(add_query_arg('preview', 'true', $forum_url)), __('Preview forum', 'bbpress')), 9 => sprintf('%1$s <a target="_blank" href="%2$s">%3$s</a>', sprintf(__('Forum scheduled for: %s.', 'bbpress'), '<strong>' . date_i18n(__('M j, Y @ G:i', 'bbpress'), strtotime($post_date)) . '</strong>'), $forum_url, __('Preview forum', 'bbpress')), 10 => sprintf('%1$s <a href="%2$s" target="_blank">%3$s</a>', __('Forum draft updated.', 'bbpress'), esc_url(add_query_arg('preview', 'true', $forum_url)), __('Preview forum', 'bbpress')));
return $messages;
}