当前位置: 首页>>代码示例>>PHP>>正文


PHP bbp_is_reply函数代码示例

本文整理汇总了PHP中bbp_is_reply函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_reply函数的具体用法?PHP bbp_is_reply怎么用?PHP bbp_is_reply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bbp_is_reply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pmpro_bbp_is_forum

 function pmpro_bbp_is_forum($forum_id = NULL)
 {
     global $post;
     if (bbp_is_forum($post->ID)) {
         if (!empty($forum_id) && $post->ID == $forum_id) {
             return true;
         } elseif (empty($forum_id)) {
             return true;
         } else {
             return false;
         }
     } elseif (bbp_is_topic($post->ID)) {
         if (!empty($forum_id) && $post->post_parent == $forum_id) {
             return true;
         } elseif (empty($forum_id)) {
             return true;
         } else {
             return false;
         }
     } elseif (bbp_is_reply($post->ID)) {
         if (!empty($forum_id) && in_array($forum_id, $post->ancestors)) {
             return true;
         } elseif (empty($forum_id)) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:functions.php

示例2: bbp_get_forum_freshness_link

/**
 * Returns link to the most recent activity inside a forum.
 *
 * Returns a complete link with attributes and content.
 *
 * @since bbPress (r2625)
 *
 * @param int $forum_id Optional. Forum id
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_forum_last_active_id() To get the forum last active id
 * @uses bbp_get_forum_last_reply_id() To get the forum last reply id
 * @uses bbp_get_forum_last_topic_id() To get the forum last topic id
 * @uses bbp_get_forum_last_reply_url() To get the forum last reply url
 * @uses bbp_get_forum_last_reply_title() To get the forum last reply
 *                                         title
 * @uses bbp_get_forum_last_topic_permalink() To get the forum last
 *                                             topic permalink
 * @uses bbp_get_forum_last_topic_title() To get the forum last topic
 *                                         title
 * @uses bbp_get_forum_last_active_time() To get the time when the forum
 *                                         was last active
 * @uses apply_filters() Calls 'bbp_get_forum_freshness_link' with the
 *                        link and forum id
 */
function bbp_get_forum_freshness_link($forum_id = 0)
{
    $forum_id = bbp_get_forum_id($forum_id);
    $active_id = bbp_get_forum_last_active_id($forum_id);
    if (empty($active_id)) {
        $active_id = bbp_get_forum_last_reply_id($forum_id);
    }
    if (empty($active_id)) {
        $active_id = bbp_get_forum_last_topic_id($forum_id);
    }
    if (bbp_is_topic($active_id)) {
        $link_url = bbp_get_forum_last_topic_permalink($forum_id);
        $title = bbp_get_forum_last_topic_title($forum_id);
    } elseif (bbp_is_reply($active_id)) {
        $link_url = bbp_get_forum_last_reply_url($forum_id);
        $title = bbp_get_forum_last_reply_title($forum_id);
    }
    $time_since = bbp_get_forum_last_active_time($forum_id);
    if (!empty($time_since) && !empty($link_url)) {
        $anchor = '<a href="' . $link_url . '" title="' . esc_attr($title) . '">' . $time_since . '</a>';
    } else {
        $anchor = __('No Topics', 'bbpress');
    }
    return apply_filters('bbp_get_forum_freshness_link', $anchor, $forum_id);
}
开发者ID:hscale,项目名称:webento,代码行数:49,代码来源:bbp-forum-template.php

示例3: bbp_get_author_link

/**
 * Return the author link of the post
 *
 * @since 2.0.0 bbPress (r2875)
 *
 * @param array $args Optional. If an integer, it is used as reply id.
 * @uses bbp_is_topic() To check if it's a topic page
 * @uses bbp_get_topic_author_link() To get the topic author link
 * @uses bbp_is_reply() To check if it's a reply page
 * @uses bbp_get_reply_author_link() To get the reply author link
 * @uses get_post_field() To get the post author
 * @uses bbp_is_reply_anonymous() To check if the reply is by an
 *                                 anonymous user
 * @uses get_the_author_meta() To get the author name
 * @uses bbp_get_user_profile_url() To get the author profile url
 * @uses get_avatar() To get the author avatar
 * @uses apply_filters() Calls 'bbp_get_reply_author_link' with the
 *                        author link and args
 * @return string Author link of reply
 */
function bbp_get_author_link($args = array())
{
    $post_id = is_numeric($args) ? (int) $args : 0;
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('post_id' => $post_id, 'link_title' => '', 'type' => 'both', 'size' => 80), 'get_author_link');
    // Confirmed topic
    if (bbp_is_topic($r['post_id'])) {
        return bbp_get_topic_author_link($r);
        // Confirmed reply
    } elseif (bbp_is_reply($r['post_id'])) {
        return bbp_get_reply_author_link($r);
    }
    // Get the post author and proceed
    $user_id = get_post_field('post_author', $r['post_id']);
    // Neither a reply nor a topic, so could be a revision
    if (!empty($r['post_id'])) {
        // Generate title with the display name of the author
        if (empty($r['link_title'])) {
            $r['link_title'] = sprintf(!bbp_is_reply_anonymous($r['post_id']) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'), get_the_author_meta('display_name', $user_id));
        }
        // Assemble some link bits
        $link_title = !empty($r['link_title']) ? ' title="' . esc_attr($r['link_title']) . '"' : '';
        $anonymous = bbp_is_reply_anonymous($r['post_id']);
        // Declare empty array
        $author_links = array();
        // Get avatar
        if ('avatar' === $r['type'] || 'both' === $r['type']) {
            $author_links[] = get_avatar($user_id, $r['size']);
        }
        // Get display name
        if ('name' === $r['type'] || 'both' === $r['type']) {
            $author_links[] = esc_html(get_the_author_meta('display_name', $user_id));
        }
        // Add links if not anonymous
        if (empty($anonymous) && bbp_user_has_profile($user_id)) {
            $author_url = bbp_get_user_profile_url($user_id);
            foreach ($author_links as $link_text) {
                $author_link[] = sprintf('<a href="%1$s"%2$s>%3$s</a>', esc_url($author_url), $link_title, $link_text);
            }
            $author_link = implode('&nbsp;', $author_link);
            // No links if anonymous
        } else {
            $author_link = implode('&nbsp;', $author_links);
        }
        // No post so link is empty
    } else {
        $author_link = '';
    }
    return apply_filters('bbp_get_author_link', $author_link, $r);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:70,代码来源:template.php

示例4: get_post_ID

 /**
  * Get the Post ID
  * Added support for sale of bbPress items.
  * @since 1.3.3.2
  * @version 1.0
  */
 public function get_post_ID()
 {
     $post_id = $bbp_topic_id = $bbp_reply_id = 0;
     if (function_exists('bbpress')) {
         global $wp_query;
         $bbp = bbpress();
         // Currently inside a topic loop
         if (!empty($bbp->topic_query->in_the_loop) && isset($bbp->topic_query->post->ID)) {
             $bbp_topic_id = $bbp->topic_query->post->ID;
         } elseif (!empty($bbp->search_query->in_the_loop) && isset($bbp->search_query->post->ID) && bbp_is_topic($bbp->search_query->post->ID)) {
             $bbp_topic_id = $bbp->search_query->post->ID;
         } elseif ((bbp_is_single_topic() || bbp_is_topic_edit()) && !empty($bbp->current_topic_id)) {
             $bbp_topic_id = $bbp->current_topic_id;
         } elseif ((bbp_is_single_topic() || bbp_is_topic_edit()) && isset($wp_query->post->ID)) {
             $bbp_topic_id = $wp_query->post->ID;
         }
         // So far, no topic found, check if we are in a reply
         if ($bbp_topic_id == 0) {
             // Currently inside a replies loop
             if (!empty($bbp->reply_query->in_the_loop) && isset($bbp->reply_query->post->ID)) {
                 $bbp_reply_id = $bbp->reply_query->post->ID;
             } elseif (!empty($bbp->search_query->in_the_loop) && isset($bbp->search_query->post->ID) && bbp_is_reply($bbp->search_query->post->ID)) {
                 $bbp_reply_id = $bbp->search_query->post->ID;
             } elseif ((bbp_is_single_reply() || bbp_is_reply_edit()) && !empty($bbp->current_reply_id)) {
                 $bbp_reply_id = $bbp->current_reply_id;
             } elseif ((bbp_is_single_reply() || bbp_is_reply_edit()) && isset($wp_query->post->ID)) {
                 $bbp_reply_id = $wp_query->post->ID;
             }
             if ($bbp_reply_id != 0) {
                 $post_id = $bbp_reply_id;
             }
         } else {
             $post_id = $bbp_topic_id;
         }
     }
     if ($post_id == 0 && isset($GLOBALS['post'])) {
         $post_id = $GLOBALS['post']->ID;
     }
     return apply_filters('mycred_sell_this_get_post_ID', $post_id, $this);
 }
开发者ID:suifengtec,项目名称:mycred,代码行数:46,代码来源:myCRED-addon-sell-content.php

示例5: aq_get_author

/**
 * Custom function from bbp_get_author_link(), returns only author name
 * -------------------------------------------------------------------------------------------*/
function aq_get_author($post_id = 0)
{
    // Confirmed topic
    if (bbp_is_topic($post_id)) {
        return bbp_get_topic_author($post_id);
        // Confirmed reply
    } elseif (bbp_is_reply($post_id)) {
        return bbp_get_reply_author($post_id);
        // Get the post author and proceed
    } else {
        $user_id = get_post_field('post_author', $post_id);
    }
    // Neither a reply nor a topic, so could be a revision
    if (!empty($post_id)) {
        // Assemble some link bits
        $anonymous = bbp_is_reply_anonymous($post_id);
        // Add links if not anonymous
        if (empty($anonymous) && bbp_user_has_profile($user_id)) {
            $author_link = get_the_author_meta('display_name', $user_id);
            // No links if anonymous
        } else {
            $author_link = join('&nbsp;', $author_links);
        }
        // No post so link is empty
    } else {
        $author_link = '';
    }
    return $author_link;
}
开发者ID:kanawanzx,项目名称:support_forum,代码行数:32,代码来源:bbpress-functions.php

示例6: bbp_get_author_link

/**
 * Return the author link of the post
 *
 * @since bbPress (r2875)
 *
 * @param mixed $args Optional. If an integer, it is used as reply id.
 * @uses bbp_is_topic() To check if it's a topic page
 * @uses bbp_get_topic_author_link() To get the topic author link
 * @uses bbp_is_reply() To check if it's a reply page
 * @uses bbp_get_reply_author_link() To get the reply author link
 * @uses get_post_field() To get the post author
 * @uses bbp_is_reply_anonymous() To check if the reply is by an
 *                                 anonymous user
 * @uses get_the_author_meta() To get the author name
 * @uses bbp_get_user_profile_url() To get the author profile url
 * @uses get_avatar() To get the author avatar
 * @uses apply_filters() Calls 'bbp_get_reply_author_link' with the
 *                        author link and args
 * @return string Author link of reply
 */
function bbp_get_author_link($args = '')
{
    // Default arguments
    $defaults = array('post_id' => 0, 'link_title' => '', 'type' => 'both', 'size' => 80);
    $r = bbp_parse_args($args, $defaults, 'get_author_link');
    extract($r);
    // Used as reply_id
    if (is_numeric($args)) {
        $post_id = $args;
    }
    // Confirmed topic
    if (bbp_is_topic($post_id)) {
        return bbp_get_topic_author_link($args);
    } elseif (bbp_is_reply($post_id)) {
        return bbp_get_reply_author_link($args);
    } else {
        $user_id = get_post_field('post_author', $post_id);
    }
    // Neither a reply nor a topic, so could be a revision
    if (!empty($post_id)) {
        // Generate title with the display name of the author
        if (empty($link_title)) {
            $link_title = sprintf(!bbp_is_reply_anonymous($post_id) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'), get_the_author_meta('display_name', $user_id));
        }
        // Assemble some link bits
        $link_title = !empty($link_title) ? ' title="' . $link_title . '"' : '';
        $author_url = bbp_get_user_profile_url($user_id);
        $anonymous = bbp_is_reply_anonymous($post_id);
        // Get avatar
        if ('avatar' == $type || 'both' == $type) {
            $author_links[] = get_avatar($user_id, $size);
        }
        // Get display name
        if ('name' == $type || 'both' == $type) {
            $author_links[] = get_the_author_meta('display_name', $user_id);
        }
        // Add links if not anonymous
        if (empty($anonymous)) {
            foreach ($author_links as $link_text) {
                $author_link[] = sprintf('<a href="%1$s"%2$s>%3$s</a>', $author_url, $link_title, $link_text);
            }
            $author_link = join('&nbsp;', $author_link);
            // No links if anonymous
        } else {
            $author_link = join('&nbsp;', $author_links);
        }
        // No post so link is empty
    } else {
        $author_link = '';
    }
    return apply_filters('bbp_get_author_link', $author_link, $args);
}
开发者ID:rmccue,项目名称:bbPress,代码行数:72,代码来源:bbp-user-template.php

示例7: bbp_get_reply_admin_links

/**
 * Return admin links for reply
 *
 * @since bbPress (r2667)
 *
 * @param array $args This function supports these arguments:
 *  - id: Optional. Reply id
 *  - before: HTML before the links. Defaults to
 *             '<span class="bbp-admin-links">'
 *  - after: HTML after the links. Defaults to '</span>'
 *  - sep: Separator. Defaults to ' | '
 *  - links: Array of the links to display. By default, edit, trash,
 *            spam, reply move, and topic split links are displayed
 * @uses bbp_is_topic() To check if it's the topic page
 * @uses bbp_is_reply() To check if it's the reply page
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_edit_link() To get the reply edit link
 * @uses bbp_get_reply_trash_link() To get the reply trash link
 * @uses bbp_get_reply_spam_link() To get the reply spam link
 * @uses bbp_get_reply_move_link() To get the reply move link
 * @uses bbp_get_topic_split_link() To get the topic split link
 * @uses current_user_can() To check if the current user can edit or
 *                           delete the reply
 * @uses apply_filters() Calls 'bbp_get_reply_admin_links' with the
 *                        reply admin links and args
 * @return string Reply admin links
 */
function bbp_get_reply_admin_links($args = array())
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('id' => 0, 'before' => '<span class="bbp-admin-links">', 'after' => '</span>', 'sep' => ' | ', 'links' => array()), 'get_reply_admin_links');
    $r['id'] = bbp_get_reply_id((int) $r['id']);
    // If post is a topic, return the topic admin links instead
    if (bbp_is_topic($r['id'])) {
        return bbp_get_topic_admin_links($args);
    }
    // If post is not a reply, return
    if (!bbp_is_reply($r['id'])) {
        return;
    }
    // If topic is trashed, do not show admin links
    if (bbp_is_topic_trash(bbp_get_reply_topic_id($r['id']))) {
        return;
    }
    // If no links were passed, default to the standard
    if (empty($r['links'])) {
        $r['links'] = apply_filters('bbp_reply_admin_links', array('edit' => bbp_get_reply_edit_link($r), 'move' => bbp_get_reply_move_link($r), 'split' => bbp_get_topic_split_link($r), 'trash' => bbp_get_reply_trash_link($r), 'spam' => bbp_get_reply_spam_link($r), 'reply' => bbp_get_reply_to_link($r)), $r['id']);
    }
    // See if links need to be unset
    $reply_status = bbp_get_reply_status($r['id']);
    if (in_array($reply_status, array(bbp_get_spam_status_id(), bbp_get_trash_status_id()))) {
        // Spam link shouldn't be visible on trashed topics
        if (bbp_get_trash_status_id() === $reply_status) {
            unset($r['links']['spam']);
            // Trash link shouldn't be visible on spam topics
        } elseif (bbp_get_spam_status_id() === $reply_status) {
            unset($r['links']['trash']);
        }
    }
    // Process the admin links
    $links = implode($r['sep'], array_filter($r['links']));
    $retval = $r['before'] . $links . $r['after'];
    return apply_filters('bbp_get_reply_admin_links', $retval, $r, $args);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:64,代码来源:template.php

示例8: bbp_untrashed_reply

/**
 * Called after untrashing (restoring) a reply
 *
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_is_reply() To check if the passed id is a reply
 * @uses do_action() Calls 'bbp_untrashed_reply' with the reply id
 */
function bbp_untrashed_reply($reply_id = 0)
{
    $reply_id = bbp_get_reply_id($reply_id);
    if (empty($reply_id) || !bbp_is_reply($reply_id)) {
        return false;
    }
    do_action('bbp_untrashed_reply', $reply_id);
}
开发者ID:hscale,项目名称:webento,代码行数:15,代码来源:functions.php

示例9: apoc_loop_subforums

/**
 * Display nested subforums with a hierarchical structure using their parent category
 * @version 2.0
 */
function apoc_loop_subforums()
{
    // Exclude private forums
    $private = apoc_private_forum_ids();
    // Check for subforums
    $subs = bbp_forum_get_subforums(array('post__not_in' => $private));
    if (empty($subs)) {
        return;
    }
    // Buffer output
    ob_start();
    // Print a header
    ?>
	<header class="forum-header">
		<div class="forum-content"><h2><?php 
    bbp_forum_title();
    ?>
</h2></div>
		<div class="forum-count">Topics</div>
		<div class="forum-freshness">Latest Post</div>
	</header>
	<ol class="forums category <?php 
    bbp_forum_status();
    ?>
"><?php 
    // Loop over forums
    foreach ($subs as $count => $sub) {
        // Get forum details
        $sub_id = $sub->ID;
        $title = $sub->post_title;
        $desc = $sub->post_content;
        $permalink = bbp_get_forum_permalink($sub_id);
        // Get topic counts
        $topics = bbp_get_forum_topic_count($sub_id, false);
        // Get the most recent reply and its topic
        $reply_id = bbp_get_forum_last_reply_id($sub_id);
        $topic_id = bbp_is_reply($reply_id) ? bbp_get_reply_topic_id($reply_id) : $reply_id;
        $topic_title = bbp_get_topic_title($topic_id);
        $link = bbp_get_reply_url($reply_id);
        // Get the author avatar
        $user_id = bbp_get_reply_author_id($reply_id);
        $avatar = apoc_get_avatar(array('user_id' => $user_id, 'link' => true, 'size' => 50));
        // Toggle html class
        $class = $count % 2 ? 'odd' : 'even';
        // Print output
        ?>
		<li id="forum-<?php 
        echo $sub_id;
        ?>
" class="forum <?php 
        echo $class;
        ?>
">
			<div class="forum-content">
				<h3 class="forum-title"><a href="<?php 
        echo $permalink;
        ?>
" title="Browse <?php 
        echo $title;
        ?>
"><?php 
        echo $title;
        ?>
</a></h3>
				<p class="forum-description"><?php 
        echo $desc;
        ?>
</p>
			</div>

			<div class="forum-count">
				<?php 
        echo $topics;
        ?>
			</div>

			<div class="forum-freshness">
				<?php 
        echo $avatar;
        ?>
				<div class="freshest-meta">
					<a class="freshest-title" href="<?php 
        echo $link;
        ?>
" title="<?php 
        echo $topic_title;
        ?>
"><?php 
        echo $topic_title;
        ?>
</a>
					<span class="freshest-author">By <?php 
        bbp_author_link(array('post_id' => $reply_id, 'type' => 'name'));
        ?>
</span>
					<span class="freshest-time"><?php 
//.........这里部分代码省略.........
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:101,代码来源:bbpress.php

示例10: bbp_get_forum_permalink

		
			// Loop over forums
		foreach ( $subs as $count => $sub ) :

				// Get forum details
			$sub_id			= $sub->ID;
			$title			= $sub->post_title;
			$desc			= $sub->post_content;
			$permalink		= bbp_get_forum_permalink( $sub_id );

					// Get topic counts
			$topics	 		= bbp_get_forum_topic_count( $sub_id , true );

					// Get the most recent reply and its topic
			$reply_id		= bbp_get_forum_last_reply_id( $sub_id );
			$topic_id		= bbp_is_reply( $reply_id ) ? bbp_get_reply_topic_id( $reply_id ) : $reply_id;
			$topic_title	= bbp_get_topic_title( $topic_id );
			$link 			= bbp_get_reply_url( $reply_id );

					// Get the author 
			$user_id 		= bbp_get_reply_author_id( $reply_id );

					// Toggle html class?>

			<tr>
				<td><a class="bbp-forum-title" href="<?php echo $permalink; ?>"><?php echo $title; ?></a></td>
				<td><?php echo $topics; ?></td>
				<td><?php bbp_forum_post_count( $sub_id, true ); ?></td>
				<td><p class="bbp-topic-meta">

					<?php do_action( 'bbp_theme_before_topic_author' ); ?>
开发者ID:niamherinoc,项目名称:rctractors,代码行数:30,代码来源:loop-single-forum.php

示例11: bbp_decrease_forum_reply_count

/**
 * Decrease the total reply count of a forum by one.
 *
 * @since 2.6.0 bbPress (r6036)
 *
 * @param int $forum_id The forum id.
 *
 * @uses bbp_is_reply() To get the reply id
 * @uses bbp_get_reply_forum_id() To get the replies forum id
 * @uses bbp_bump_forum_reply_count() To bump the forum reply count
 *
 * @return void
 */
function bbp_decrease_forum_reply_count($forum_id = 0)
{
    // Bail early if no id is passed.
    if (empty($forum_id)) {
        return;
    }
    // If it's a reply, get the forum id.
    if (bbp_is_reply($forum_id)) {
        $forum_id = bbp_get_reply_forum_id($forum_id);
    }
    bbp_bump_forum_reply_count($forum_id, -1);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:25,代码来源:functions.php

示例12: bbp_get_reply_admin_links

/**
 * Return admin links for reply
 *
 * @since bbPress (r2667)
 *
 * @param mixed $args This function supports these arguments:
 *  - id: Optional. Reply id
 *  - before: HTML before the links. Defaults to
 *             '<span class="bbp-admin-links">'
 *  - after: HTML after the links. Defaults to '</span>'
 *  - sep: Separator. Defaults to ' | '
 *  - links: Array of the links to display. By default, edit, trash,
 *            spam and topic split links are displayed
 * @uses bbp_is_topic() To check if it's the topic page
 * @uses bbp_is_reply() To check if it's the reply page
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_edit_link() To get the reply edit link
 * @uses bbp_get_reply_trash_link() To get the reply trash link
 * @uses bbp_get_reply_spam_link() To get the reply spam link
 * @uses bbp_get_topic_split_link() To get the topic split link
 * @uses current_user_can() To check if the current user can edit or
 *                           delete the reply
 * @uses apply_filters() Calls 'bbp_get_reply_admin_links' with the
 *                        reply admin links and args
 * @return string Reply admin links
 */
function bbp_get_reply_admin_links($args = '')
{
    $defaults = array('id' => 0, 'before' => '<span class="bbp-admin-links">', 'after' => '</span>', 'sep' => ' | ', 'links' => array());
    $r = bbp_parse_args($args, $defaults, 'get_reply_admin_links');
    $r['id'] = bbp_get_reply_id((int) $r['id']);
    // If post is a topic, return the topic admin links instead
    if (bbp_is_topic($r['id'])) {
        return bbp_get_topic_admin_links($args);
    }
    // If post is not a reply, return
    if (!bbp_is_reply($r['id'])) {
        return;
    }
    // Make sure user can edit this reply
    if (!current_user_can('edit_reply', $r['id'])) {
        return;
    }
    // If topic is trashed, do not show admin links
    if (bbp_is_topic_trash(bbp_get_reply_topic_id($r['id']))) {
        return;
    }
    // If no links were passed, default to the standard
    if (empty($r['links'])) {
        $r['links'] = array('edit' => bbp_get_reply_edit_link($r), 'split' => bbp_get_topic_split_link($r), 'trash' => bbp_get_reply_trash_link($r), 'spam' => bbp_get_reply_spam_link($r));
    }
    // Check caps for trashing the topic
    if (!current_user_can('delete_reply', $r['id']) && !empty($r['links']['trash'])) {
        unset($r['links']['trash']);
    }
    // See if links need to be unset
    $reply_status = bbp_get_reply_status($r['id']);
    if (in_array($reply_status, array(bbp_get_spam_status_id(), bbp_get_trash_status_id()))) {
        // Spam link shouldn't be visible on trashed topics
        if ($reply_status == bbp_get_trash_status_id()) {
            unset($r['links']['spam']);
            // Trash link shouldn't be visible on spam topics
        } elseif (isset($r['links']['trash']) && bbp_get_spam_status_id() == $reply_status) {
            unset($r['links']['trash']);
        }
    }
    // Process the admin links
    $links = implode($r['sep'], array_filter($r['links']));
    $retval = $r['before'] . $links . $r['after'];
    return apply_filters('bbp_get_reply_admin_links', $retval, $args);
}
开发者ID:hscale,项目名称:webento,代码行数:71,代码来源:template-tags.php

示例13: user_has_cap

 public static function user_has_cap($allcaps, $caps, $args, $user)
 {
     if (!in_array('upload_files', $caps)) {
         return $allcaps;
     }
     $can = isset($allcaps['upload_files']) ? $allcaps['upload_files'] : false;
     // async-upload.php, admin-ajax.php 를 통해서 업로드할 때 권한 체크가 어려움
     $ajax_attachment_actions = apply_filters('bbpkr_ajax_attachment_actions', array('upload-attachment', 'query-attachments'));
     if ((isset($_REQUEST['post_id']) || !empty(self::$forum_id)) && empty($allcaps['upload_files']) && (defined('DOING_AJAX') && true === DOING_AJAX) && (isset($_REQUEST['action']) && in_array($_REQUEST['action'], $ajax_attachment_actions))) {
         if (isset($_REQUEST['post_id'])) {
             $the_id = (int) $_REQUEST['post_id'];
             if (bbp_is_forum($the_id)) {
                 self::$forum_id = $the_id;
             } elseif (bbp_is_topic($the_id)) {
                 self::$forum_id = (int) bbp_get_topic_forum_id($the_id);
             } elseif (bbp_is_reply($the_id)) {
                 self::$forum_id = (int) bbp_get_reply_forum_id($the_id);
             }
         }
         if (!self::$forum_id) {
             return $allcaps;
         }
         $forum_id = self::$forum_id;
         // unset post_id to avoid edit_post check( DO NOT UNSET $_POST['post_id'] )
         $_REQUEST['post_id'] = null;
         $allcaps['upload_files'] = self::can_upload($can, $forum_id);
         return $allcaps;
     }
     $allcaps['upload_files'] = self::can_upload($can);
     return $allcaps;
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:31,代码来源:attachments.php

示例14: pg_get_author_link

function pg_get_author_link()
{
    $user_id2 = wp_get_current_user()->ID;
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('post_id' => $post_id, 'link_title' => '', 'type' => 'both', 'size' => 14), 'pg_get_author_link');
    //confirmed topic
    if (bbp_is_topic($post_id)) {
        $topic = bbp_get_topic_post_type();
        $forum_id_check = private_groups_get_forum_id_from_post_id($post_id, $topic);
        //now we can check if the user can view this
        if (!private_groups_can_user_view_post($user_id2, $forum_id_check)) {
            return;
        }
        return bbp_get_topic_author_link($r);
        // Confirmed reply
    } elseif (bbp_is_reply($post_id)) {
        $reply = bbp_get_reply_post_type();
        $forum_id_check = private_groups_get_forum_id_from_post_id($post_id, $reply);
        //now we can check if the user can view this
        if (!private_groups_can_user_view_post($user_id2, $forum_id_check)) {
            return;
        }
        return bbp_get_reply_author_link($r);
    }
    // Neither a reply nor a topic, so could be a revision
    //if it isn't a topic or reply, not sure so better to just not display the author in this case
    //could be revised to look up the post_parent of this post and then churn that round the code above if required return ;
    return;
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:29,代码来源:functions.php

示例15: bbp_validate_reply_to

/**
 * Validate a `reply_to` field for hierarchical replies
 * 
 * Checks for 2 scenarios:
 * -- The reply to ID is actually a reply
 * -- The reply to ID does not match the current reply
 *
 * @since bbPress (r5377)
 *
 * @param int $reply_to
 * @param int $reply_id
 *
 * @return int $reply_to
 */
function bbp_validate_reply_to($reply_to = 0, $reply_id = 0)
{
    // The parent reply must actually be a reply
    if (!bbp_is_reply($reply_to)) {
        $reply_to = 0;
    }
    // The parent reply cannot be itself
    if ($reply_id === $reply_to) {
        $reply_to = 0;
    }
    return (int) $reply_to;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:26,代码来源:functions.php


注:本文中的bbp_is_reply函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。