本文整理汇总了PHP中bbp_is_reply_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_reply_edit函数的具体用法?PHP bbp_is_reply_edit怎么用?PHP bbp_is_reply_edit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_is_reply_edit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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_search() To check if page is search
* @uses bbp_get_search_template() To get search 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_move() To check if page is reply move
* @uses bbp_get_reply_move_template() To get reply move 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())) {
// User favorites
} elseif (bbp_is_favorites() && ($new_template = bbp_get_favorites_template())) {
// User favorites
} elseif (bbp_is_subscriptions() && ($new_template = bbp_get_subscriptions_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())) {
// Search
} elseif (bbp_is_search() && ($new_template = bbp_get_search_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())) {
// Reply move
} elseif (bbp_is_reply_move() && ($new_template = bbp_get_reply_move_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())) {
}
// A bbPress template file was located, so override the WordPress template
// and use it to switch off bbPress's theme compatibility.
if (!empty($new_template)) {
$template = bbp_set_template_included($new_template);
}
return apply_filters('bbp_template_include_theme_supports', $template);
}
示例2: 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())) {
// User favorites
} elseif (bbp_is_favorites() && ($new_template = bbp_get_favorites_template())) {
// User favorites
} elseif (bbp_is_subscriptions() && ($new_template = bbp_get_subscriptions_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);
}
示例3: bbpress_hl_add_buttons
function bbpress_hl_add_buttons()
{
global $wp_sh_allowed_str, $wp_sh_setting_opt;
if (bbp_is_single_forum() || bbp_is_single_topic() || bbp_is_topic_edit() || bbp_is_reply_edit()) {
if (bbp_is_single_forum()) {
$textarea_id = "bbp_topic_content";
} elseif (bbp_is_topic_edit()) {
$textarea_id = "bbp_topic_content";
} elseif (bbp_is_reply_edit()) {
$textarea_id = "bbp_reply_content";
} elseif (bbp_is_single_topic()) {
$textarea_id = "bbp_reply_content";
}
echo "<div class=\"bbpress_highlight\">";
if ($wp_sh_setting_opt['bbpress_hl_description_before_enable'] == 1) {
$wp_sh_bbpress_hl_description_before = wp_sh_valid_text(get_option('wp_sh_bbpress_hl_description_before'), $wp_sh_allowed_str);
if ($wp_sh_bbpress_hl_description_before == "invalid") {
$wp_sh_bbpress_hl_description_before = wp_sh_default_setting_value('bbp_desc');
}
echo "<p>" . str_replace("<pre>", "<pre>", $wp_sh_bbpress_hl_description_before) . "</p>";
}
if ($wp_sh_setting_opt['bbpress_hl_bt_tag'] == "shortcode") {
$tag = "shorcode";
} else {
$tag = "pre";
}
echo "<div class=\"bbpress_highlight_button\">";
if ($wp_sh_setting_opt['lib_version'] == '3.0') {
$languages = get_option('wp_sh_language3');
} elseif ($wp_sh_setting_opt['lib_version'] == '2.1') {
$languages = get_option('wp_sh_language2');
}
$gutter = $wp_sh_setting_opt['gutter'];
if (is_array($languages)) {
asort($languages);
foreach ($languages as $key => $val) {
if ($val[1] == 'true' || $val[1] == 'added') {
echo "<a href=\"javascript:void(0);\" onclick=\"surroundHTML('" . $key . "','" . $textarea_id . "','" . $gutter . "','" . $wp_sh_setting_opt['first_line'] . "','" . $tag . "','0');\">" . $val[0] . "</a> | ";
}
}
unset($val);
}
echo "</div>";
echo "</div>";
}
}
示例4: nav_menu_css_class
static function nav_menu_css_class($classes, $item, $args, $depth)
{
if ($item->object == bbp_get_forum_post_type() && is_bbpress()) {
if (bbp_is_topic_edit() || bbp_is_single_topic()) {
$forum_id = bbp_get_topic_forum_id();
if ($forum_id == $item->object_id) {
$classes[] = 'current-menu-parent';
$classes[] = 'current-' . bbp_get_topic_post_type() . '-parent';
} elseif ($ancestors = self::forum_ancestors($forum_id, array())) {
if (in_array($item->object_id, $ancestors)) {
$classes[] = 'current-menu-ancestor';
$classes[] = 'current-' . bbp_get_topic_post_type() . '-ancestor';
}
}
} elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
$forum_id = bbp_get_reply_forum_id();
}
}
return $classes;
}
示例5: checkbox
/**
* Outputs the "Set as private reply" checkbox
*
* @since 1.0
*
* @return void
*/
public function checkbox()
{
?>
<p>
<input name="bbp_private_reply" id="bbp_private_reply" type="checkbox"<?php
checked('1', $this->is_private(bbp_get_reply_id()));
?>
value="1" tabindex="<?php
bbp_tab_index();
?>
" />
<?php
if (bbp_is_reply_edit() && get_the_author_meta('ID') != bbp_get_current_user_id()) {
?>
<label for="bbp_private_reply"><?php
_e('Set author\'s post as private.', 'bbp_private_replies');
?>
</label>
<?php
} else {
?>
<label for="bbp_private_reply"><?php
_e('Set as private reply', 'bbp_private_replies');
?>
</label>
<?php
}
?>
</p>
<?php
}
示例6: _e
_e('Notify me of follow-up replies via email', 'bbpress');
?>
</label>
<?php
}
?>
</p>
<?php
do_action('bbp_theme_after_reply_form_subscription');
?>
<?php
}
?>
<?php
if (bbp_allow_revisions() && bbp_is_reply_edit()) {
?>
<?php
do_action('bbp_theme_before_reply_form_revisions');
?>
<fieldset class="bbp-form">
<legend>
<input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php
bbp_form_reply_log_edit();
?>
tabindex="<?php
bbp_tab_index();
?>
" />
<label for="bbp_log_reply_edit"><?php
_e('Keep a log of this edit:', 'bbpress');
示例7: bbp_get_form_reply_status_dropdown
/**
* Returns reply status downdown
*
* This dropdown is only intended to be seen by users with the 'moderate'
* capability. Because of this, no additional capablitiy checks are performed
* within this function to check available reply statuses.
*
* @since 2.6.0 bbPress (r5399)
*
* @param $args This function supports these arguments:
* - select_id: Select id. Defaults to bbp_reply_status
* - tab: Deprecated. Tabindex
* - reply_id: Reply id
* - selected: Override the selected option
*/
function bbp_get_form_reply_status_dropdown($args = array())
{
// Parse arguments against default values
$r = bbp_parse_args($args, array('select_id' => 'bbp_reply_status', 'select_class' => 'bbp_dropdown', 'tab' => false, 'reply_id' => 0, 'selected' => false), 'reply_status_dropdown');
// No specific selected value passed
if (empty($r['selected'])) {
// Post value is passed
if (bbp_is_reply_form_post_request() && isset($_POST[$r['select_id']])) {
$r['selected'] = sanitize_key($_POST[$r['select_id']]);
// No Post value was passed
} else {
// Edit reply
if (bbp_is_reply_edit()) {
$r['reply_id'] = bbp_get_reply_id($r['reply_id']);
$r['selected'] = bbp_get_reply_status($r['reply_id']);
// New reply
} else {
$r['selected'] = bbp_get_public_status_id();
}
}
}
// Used variables
$tab = !empty($r['tab']) ? ' tabindex="' . (int) $r['tab'] . '"' : '';
// Start an output buffer, we'll finish it after the select loop
ob_start();
?>
<select name="<?php
echo esc_attr($r['select_id']);
?>
" id="<?php
echo esc_attr($r['select_id']);
?>
_select" class="<?php
echo esc_attr($r['select_class']);
?>
"<?php
echo $tab;
?>
>
<?php
foreach (bbp_get_reply_statuses($r['reply_id']) as $key => $label) {
?>
<option value="<?php
echo esc_attr($key);
?>
"<?php
selected($key, $r['selected']);
?>
><?php
echo esc_html($label);
?>
</option>
<?php
}
?>
</select>
<?php
// Return the results
return apply_filters('bbp_get_form_reply_status_dropdown', ob_get_clean(), $r);
}
示例8: cupid_breadcrumb_get_bbpress_items
function cupid_breadcrumb_get_bbpress_items()
{
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a></li>';
}
if (bbp_is_forum_archive()) {
$item['last'] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item['last'] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item['last'] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a></li>';
} else {
$item['last'] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item['last'] = __('Split', 'cupid');
} elseif (bbp_is_topic_merge()) {
$item['last'] = __('Merge', 'cupid');
} elseif (bbp_is_topic_edit()) {
$item['last'] = __('Edit', 'cupid');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item['last'] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a></li>';
$item['last'] = __('Edit', 'cupid');
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, cupid_breadcrumb_get_parents($forum_parent_id));
}
$item['last'] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a></li>';
$item['last'] = __('Edit', 'cupid');
} else {
$item['last'] = bbp_get_displayed_user_field('display_name');
}
}
return apply_filters('cupid_breadcrumb_get_bbpress_items', $item);
}
示例9: bbp_title
/**
* Custom page title for bbPress pages
*
* @since bbPress (r2788)
*
* @param string $title Optional. The title (not used).
* @param string $sep Optional, default is '»'. How to separate the
* various items within the page title.
* @param string $seplocation Optional. Direction to display title, 'right'.
* @uses bbp_is_single_user() To check if it's a user profile page
* @uses bbp_is_single_user_edit() To check if it's a user profile edit page
* @uses bbp_is_user_home() To check if the profile page is of the current user
* @uses get_query_var() To get the user id
* @uses get_userdata() To get the user data
* @uses bbp_is_single_forum() To check if it's a forum
* @uses bbp_get_forum_title() To get the forum title
* @uses bbp_is_single_topic() To check if it's a topic
* @uses bbp_get_topic_title() To get the topic title
* @uses bbp_is_single_reply() To check if it's a reply
* @uses bbp_get_reply_title() To get the reply title
* @uses is_tax() To check if it's the tag page
* @uses get_queried_object() To get the queried object
* @uses bbp_is_single_view() To check if it's a view
* @uses bbp_get_view_title() To get the view title
* @uses apply_filters() Calls 'bbp_raw_title' with the title
* @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title,
* separator and separator location
* @return string The tite
*/
function bbp_title($title = '', $sep = '»', $seplocation = '')
{
// Title array
$new_title = array();
/** Archives **************************************************************/
// Forum Archive
if (bbp_is_forum_archive()) {
$new_title['text'] = bbp_get_forum_archive_title();
// Topic Archive
} elseif (bbp_is_topic_archive()) {
$new_title['text'] = bbp_get_topic_archive_title();
/** Edit ******************************************************************/
// Forum edit page
} elseif (bbp_is_forum_edit()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum Edit: %s', 'bbpress');
// Topic edit page
} elseif (bbp_is_topic_edit()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic Edit: %s', 'bbpress');
// Reply edit page
} elseif (bbp_is_reply_edit()) {
$new_title['text'] = bbp_get_reply_title();
$new_title['format'] = esc_attr__('Reply Edit: %s', 'bbpress');
// Topic tag edit page
} elseif (bbp_is_topic_tag_edit()) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag Edit: %s', 'bbpress');
/** Singles ***************************************************************/
// Forum page
} elseif (bbp_is_single_forum()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum: %s', 'bbpress');
// Topic page
} elseif (bbp_is_single_topic()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic: %s', 'bbpress');
// Replies
} elseif (bbp_is_single_reply()) {
$new_title['text'] = bbp_get_reply_title();
// Topic tag page
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag')) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag: %s', 'bbpress');
/** Users *****************************************************************/
// Profile page
} elseif (bbp_is_single_user()) {
// User is viewing their own profile
if (bbp_is_user_home()) {
$new_title['text'] = esc_attr_x('Your', 'User viewing his/her own profile', 'bbpress');
// User is viewing someone else's profile (so use their display name)
} else {
$new_title['text'] = sprintf(esc_attr_x("%s's", 'User viewing another users profile', 'bbpress'), get_userdata(bbp_get_user_id())->display_name);
}
// User topics created
if (bbp_is_single_user_topics()) {
$new_title['format'] = esc_attr__("%s Topics", 'bbpress');
// User rueplies created
} elseif (bbp_is_single_user_replies()) {
$new_title['format'] = esc_attr__("%s Replies", 'bbpress');
// User favorites
} elseif (bbp_is_favorites()) {
$new_title['format'] = esc_attr__("%s Favorites", 'bbpress');
// User subscriptions
} elseif (bbp_is_subscriptions()) {
$new_title['format'] = esc_attr__("%s Subscriptions", 'bbpress');
// User "home"
} else {
$new_title['format'] = esc_attr__("%s Profile", 'bbpress');
}
// Profile edit page
//.........这里部分代码省略.........
示例10: 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);
}
示例11: bbp_topic_id
<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php printf( __( 'The topic ‘%s’ is closed to new replies.', 'bbpress' ), bbp_get_topic_title() ); ?></p>
</div>
</div>
<?php elseif ( bbp_is_forum_closed( bbp_get_topic_forum_id() ) ) : ?>
<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php printf( __( 'The forum ‘%s’ is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></p>
</div>
</div>
<?php else : ?>
<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php is_user_logged_in() ? _e( 'You cannot reply to this topic.', 'bbpress' ) : _e( 'You must be logged in to reply to this topic.', 'bbpress' ); ?> </p>
<?php wp_login_form(); ?>
</div>
</div>
<?php endif; ?>
<?php if ( bbp_is_reply_edit() ) : ?>
</div>
<?php endif; ?>
示例12: bbp_redirect_canonical
/**
* Remove the canonical redirect to allow pretty pagination
*
* @since bbPress (r2628)
* @param string $redirect_url Redirect url
* @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
* @uses bbp_get_paged() To get the current page number
* @uses bbp_is_single_topic() To check if it's a topic page
* @uses bbp_is_single_forum() To check if it's a forum page
* @return bool|string False if it's a topic/forum and their first page,
* otherwise the redirect url
*/
function bbp_redirect_canonical($redirect_url)
{
global $wp_rewrite;
// Canonical is for the beautiful
if ($wp_rewrite->using_permalinks()) {
// If viewing beyond page 1 of several
if (1 < bbp_get_paged()) {
// Only on single topics...
if (bbp_is_single_topic()) {
$redirect_url = false;
// ...and single forums...
} elseif (bbp_is_single_forum()) {
$redirect_url = false;
// ...and single replies...
} elseif (bbp_is_single_reply()) {
$redirect_url = false;
// ...and any single anything else...
//
// @todo - Find a more accurate way to disable paged canonicals for
// paged shortcode usage within other posts.
} elseif (is_page() || is_singular()) {
$redirect_url = false;
}
// If editing a topic
} elseif (bbp_is_topic_edit()) {
$redirect_url = false;
// If editing a reply
} elseif (bbp_is_reply_edit()) {
$redirect_url = false;
}
}
return $redirect_url;
}
示例13: bbp_get_breadcrumb
//.........这里部分代码省略.........
// Single Forum
} elseif (bbp_is_single_forum()) {
$pre_current_text = bbp_get_forum_title();
// Single Topic
} elseif (bbp_is_single_topic()) {
$pre_current_text = bbp_get_topic_title();
// Single Topic
} elseif (bbp_is_single_reply()) {
$pre_current_text = bbp_get_reply_title();
// Topic Tag (or theme compat topic tag)
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag') && !bbp_is_topic_tag_edit()) {
// Always include the tag name
$tag_data[] = bbp_get_topic_tag_name();
// If capable, include a link to edit the tag
if (current_user_can('manage_topic_tags')) {
$tag_data[] = '<a href="' . bbp_get_topic_tag_edit_link() . '" class="bbp-edit-topic-tag-link">' . __('(Edit)', 'bbpress') . '</a>';
}
// Implode the results of the tag data
$pre_current_text = sprintf(__('Topic Tag: %s', 'bbpress'), implode(' ', $tag_data));
// Edit Topic Tag
} elseif (bbp_is_topic_tag_edit()) {
$pre_current_text = __('Edit', 'bbpress');
// Single
} else {
$pre_current_text = get_the_title();
}
/** Parse Args ********************************************************/
// Parse args
$defaults = array('before' => '<div class="bbp-breadcrumb"><p>', 'after' => '</p></div>', 'sep' => __('›', 'bbpress'), 'pad_sep' => 1, 'include_home' => $pre_include_home, 'home_text' => $pre_front_text, 'include_root' => $pre_include_root, 'root_text' => $pre_root_text, 'include_current' => $pre_include_current, 'current_text' => $pre_current_text);
$r = bbp_parse_args($args, $defaults, 'get_breadcrumb');
extract($r);
/** Ancestors *********************************************************/
// Get post ancestors
if (is_page() || is_single() || bbp_is_forum_edit() || bbp_is_topic_edit() || bbp_is_reply_edit()) {
$ancestors = array_reverse(get_post_ancestors(get_the_ID()));
}
// Do we want to include a link to home?
if (!empty($include_home) || empty($home_text)) {
$crumbs[] = '<a href="' . trailingslashit(home_url()) . '" class="bbp-breadcrumb-home">' . $home_text . '</a>';
}
// Do we want to include a link to the forum root?
if (!empty($include_root) || empty($root_text)) {
// Page exists at root slug path, so use its permalink
$page = bbp_get_page_by_path(bbp_get_root_slug());
if (!empty($page)) {
$root_url = get_permalink($page->ID);
// Use the root slug
} else {
$root_url = get_post_type_archive_link(bbp_get_forum_post_type());
}
// Add the breadcrumb
$crumbs[] = '<a href="' . $root_url . '" class="bbp-breadcrumb-root">' . $root_text . '</a>';
}
// Ancestors exist
if (!empty($ancestors)) {
// Loop through parents
foreach ((array) $ancestors as $parent_id) {
// Parents
$parent = get_post($parent_id);
// Switch through post_type to ensure correct filters are applied
switch ($parent->post_type) {
// Forum
case bbp_get_forum_post_type():
$crumbs[] = '<a href="' . bbp_get_forum_permalink($parent->ID) . '" class="bbp-breadcrumb-forum">' . bbp_get_forum_title($parent->ID) . '</a>';
break;
// Topic
示例14: bbp_is_topic_edit
<input type="text" id="bbp_anonymous_email" value="<?php
bbp_is_topic_edit() ? bbp_topic_author_email() : bbp_is_reply_edit() ? bbp_reply_author_email() : bbp_current_anonymous_user_data('email');
?>
" tabindex="<?php
bbp_tab_index();
?>
" size="40" name="bbp_anonymous_email" />
</p>
<p>
<label for="bbp_anonymous_website"><?php
_e('Website:', 'bbpress');
?>
</label><br />
<input type="text" id="bbp_anonymous_website" value="<?php
bbp_is_topic_edit() ? bbp_topic_author_url() : bbp_is_reply_edit() ? bbp_reply_author_url() : bbp_current_anonymous_user_data('website');
?>
" tabindex="<?php
bbp_tab_index();
?>
" size="40" name="bbp_anonymous_website" />
</p>
<?php
do_action('bbp_theme_anonymous_form_extras_bottom');
?>
</fieldset>
<?php
do_action('bbp_theme_after_anonymous_form');
示例15: bbp_check_reply_edit
/**
* Redirect if unathorized user is attempting to edit a reply
*
* @since bbPress (r3605)
*
* @uses bbp_is_reply_edit()
* @uses current_user_can()
* @uses bbp_get_topic_id()
* @uses wp_safe_redirect()
* @uses bbp_get_topic_permalink()
*/
function bbp_check_reply_edit()
{
// Bail if not editing a topic
if (!bbp_is_reply_edit()) {
return;
}
// User cannot edit topic, so redirect back to reply
if (!current_user_can('edit_reply', bbp_get_reply_id())) {
wp_safe_redirect(bbp_get_reply_url());
exit;
}
}