本文整理汇总了PHP中bp_activity_can_comment函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_activity_can_comment函数的具体用法?PHP bp_activity_can_comment怎么用?PHP bp_activity_can_comment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_activity_can_comment函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_activity
/**
* get_activity function.
*
* @access public
* @param mixed $filter
* @return void
*/
public function get_activity($filter)
{
$args = $filter;
if (bp_has_activities($args)) {
while (bp_activities()) {
bp_the_activity();
$activity = array('avatar' => bp_core_fetch_avatar(array('html' => false, 'item_id' => bp_get_activity_id())), 'action' => bp_get_activity_action(), 'content' => bp_get_activity_content_body(), 'activity_id' => bp_get_activity_id(), 'activity_username' => bp_core_get_username(bp_get_activity_user_id()), 'user_id' => bp_get_activity_user_id(), 'comment_count' => bp_activity_get_comment_count(), 'can_comment' => bp_activity_can_comment(), 'can_favorite' => bp_activity_can_favorite(), 'is_favorite' => bp_get_activity_is_favorite(), 'can_delete' => bp_activity_user_can_delete());
$activity = apply_filters('bp_json_prepare_activity', $activity);
$activities[] = $activity;
}
$data = array('activity' => $activities, 'has_more_items' => bp_activity_has_more_items());
$data = apply_filters('bp_json_prepare_activities', $data);
} else {
return new WP_Error('bp_json_activity', __('No Activity Found.', 'buddypress'), array('status' => 200));
}
$response = new WP_REST_Response();
$response->set_data($data);
$response = rest_ensure_response($response);
return $response;
}
示例2: do_action
?>
</div>
<?php
}
?>
</div>
<?php
do_action('bp_before_activity_entry_comments');
?>
<?php
if (is_user_logged_in() && bp_activity_can_comment() || bp_activity_get_comment_count()) {
?>
<div class="activity-comments">
<?php
bp_activity_comments();
?>
<?php
if (is_user_logged_in()) {
?>
<form action="<?php
bp_activity_comment_form_action();
?>
示例3: bp_activity_thread_permalink
echo bp_activity_thread_permalink();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false);
?>
</pubDate>
<description>
<![CDATA[
<?php
bp_activity_feed_item_description();
?>
<?php
if (bp_activity_can_comment()) {
?>
<p><?php
printf(__('Comments: %s', 'buddypress'), bp_activity_get_comment_count());
?>
</p>
<?php
}
?>
<?php
if ('activity_comment' == bp_get_activity_action_name()) {
?>
<br /><strong><?php
_e('In reply to', 'buddypress');
?>
示例4: do_action
*/
do_action('bp_before_activity_entry_comments');
?>
<?php
if (bp_activity_get_comment_count() || bp_activity_can_comment() || bp_is_single_activity()) {
?>
<div class="activity-comments">
<?php
bp_activity_comments();
?>
<?php
if (is_user_logged_in() && bp_activity_can_comment()) {
?>
<form action="<?php
bp_activity_comment_form_action();
?>
" method="post" id="ac-form-<?php
bp_activity_id();
?>
" class="ac-form"<?php
bp_activity_comment_form_nojs_display();
?>
>
<div class="ac-reply-avatar"><?php
bp_loggedin_user_avatar('width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT);
?>
示例5: output
//.........这里部分代码省略.........
</description>
<lastBuildDate><?php
echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
?>
</lastBuildDate>
<generator>https://buddypress.org/?v=<?php
bp_version();
?>
</generator>
<language><?php
bloginfo_rss('language');
?>
</language>
<ttl><?php
echo $this->ttl;
?>
</ttl>
<sy:updatePeriod><?php
echo $this->update_period;
?>
</sy:updatePeriod>
<sy:updateFrequency><?php
echo $this->update_frequency;
?>
</sy:updateFrequency>
<?php
/**
* Fires at the end of channel elements list in RSS feed so plugins can add extra channel elements.
*
* @since 1.8.0
*/
do_action('bp_activity_feed_channel_elements');
?>
<?php
if (bp_has_activities($this->activity_args)) {
?>
<?php
while (bp_activities()) {
bp_the_activity();
?>
<item>
<guid isPermaLink="false"><?php
bp_activity_feed_item_guid();
?>
</guid>
<title><?php
echo stripslashes(bp_get_activity_feed_item_title());
?>
</title>
<link><?php
bp_activity_thread_permalink();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false);
?>
</pubDate>
<?php
if (bp_get_activity_feed_item_description()) {
?>
<content:encoded><![CDATA[<?php
$this->feed_content();
?>
]]></content:encoded>
<?php
}
?>
<?php
if (bp_activity_can_comment()) {
?>
<slash:comments><?php
bp_activity_comment_count();
?>
</slash:comments>
<?php
}
?>
<?php
/**
* Fires at the end of the individual RSS Item list in RSS feed so plugins can add extra item elements.
*
* @since 1.8.0
*/
do_action('bp_activity_feed_item_elements');
?>
</item>
<?php
}
?>
<?php
}
?>
</channel>
</rss><?php
}
示例6: do_action
?>
</div>
<?php
}
?>
</div>
<?php
do_action('bp_before_activity_entry_comments');
?>
<?php
if (is_user_logged_in() && bp_activity_can_comment() || bp_is_single_activity()) {
?>
<div class="activity-comments">
<?php
bp_activity_comments();
?>
<?php
if (is_user_logged_in()) {
?>
<form action="<?php
bp_activity_comment_form_action();
?>
示例7: output
//.........这里部分代码省略.........
echo $this->link;
?>
</link>
<atom:link href="<?php
self_link();
?>
" rel="self" type="application/rss+xml" />
<description><?php
echo $this->description;
?>
</description>
<lastBuildDate><?php
echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
?>
</lastBuildDate>
<generator>http://buddypress.org/?v=<?php
bp_version();
?>
</generator>
<language><?php
bloginfo_rss('language');
?>
</language>
<ttl><?php
echo $this->ttl;
?>
</ttl>
<sy:updatePeriod><?php
echo $this->update_period;
?>
</sy:updatePeriod>
<sy:updateFrequency><?php
echo $this->update_frequency;
?>
</sy:updateFrequency>
<?php
do_action('bp_activity_feed_channel_elements');
?>
<?php
if (bp_has_activities($this->activity_args)) {
?>
<?php
while (bp_activities()) {
bp_the_activity();
?>
<item>
<guid isPermaLink="false"><?php
bp_activity_feed_item_guid();
?>
</guid>
<title><?php
echo stripslashes(bp_get_activity_feed_item_title());
?>
</title>
<link><?php
bp_activity_thread_permalink();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false);
?>
</pubDate>
<?php
if (bp_get_activity_feed_item_description()) {
?>
<content:encoded><![CDATA[<?php
$this->feed_content();
?>
]]></content:encoded>
<?php
}
?>
<?php
if (bp_activity_can_comment()) {
?>
<slash:comments><?php
bp_activity_comment_count();
?>
</slash:comments>
<?php
}
?>
<?php
do_action('bp_activity_feed_item_elements');
?>
</item>
<?php
}
?>
<?php
}
?>
</channel>
</rss><?php
}
示例8: show_comment_form
function show_comment_form() {
$activity_id = get_post_meta($this->id, 'bp_media_child_activity', true);
if (bp_has_activities(array(
'display_comments' => 'stream',
'include' => $activity_id,
'max' => 1
))) :
while (bp_activities()) : bp_the_activity();
do_action('bp_before_activity_entry');
?>
<div class="activity">
<ul id="activity-stream" class="activity-list item-list">
<li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
<div class="activity-content">
<?php do_action('bp_activity_entry_content'); ?>
<?php if (is_user_logged_in()) : ?>
<div class="activity-meta no-ajax">
<?php if (bp_activity_can_comment()) : ?>
<a href="<?php bp_get_activity_comment_link(); ?>" class="button acomment-reply bp-primary-action" id="acomment-comment-<?php bp_activity_id(); ?>"><?php printf(__('Comment <span>%s</span>', 'buddypress'), bp_activity_get_comment_count()); ?></a>
<?php endif; ?>
<?php if (bp_activity_can_favorite()) : ?>
<?php if (!bp_get_activity_is_favorite()) : ?>
<a href="<?php bp_activity_favorite_link(); ?>" class="button fav bp-secondary-action" title="<?php esc_attr_e('Mark as Favorite', 'buddypress'); ?>"><?php _e('Favorite', 'buddypress') ?></a>
<?php else : ?>
<a href="<?php bp_activity_unfavorite_link(); ?>" class="button unfav bp-secondary-action" title="<?php esc_attr_e('Remove Favorite', 'buddypress'); ?>"><?php _e('Remove Favorite', 'buddypress') ?></a>
<?php endif; ?>
<?php endif; ?>
<?php if (bp_activity_user_can_delete()) bp_activity_delete_link(); ?>
<?php do_action('bp_activity_entry_meta'); ?>
</div>
<?php endif; ?>
</div>
<?php do_action('bp_before_activity_entry_comments'); ?>
<?php if (( is_user_logged_in() && bp_activity_can_comment() ) || bp_activity_get_comment_count()) : ?>
<div class="activity-comments">
<?php bp_activity_comments(); ?>
<?php if (is_user_logged_in()) : ?>
<form action="<?php bp_activity_comment_form_action(); ?>" method="post" id="ac-form-<?php bp_activity_id(); ?>" class="ac-form"<?php bp_activity_comment_form_nojs_display(); ?>>
<div class="ac-reply-avatar"><?php bp_loggedin_user_avatar('width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT); ?></div>
<div class="ac-reply-content">
<div class="ac-textarea">
<textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
</div>
<input type="submit" name="ac_form_submit" value="<?php _e('Post', 'buddypress'); ?>" /> <?php _e('or press esc to cancel.', 'buddypress'); ?>
<input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
</div>
<?php do_action('bp_activity_entry_comments'); ?>
<?php wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment'); ?>
</form>
<?php endif; ?>
</div>
<?php endif; ?>
<?php do_action('bp_after_activity_entry_comments'); ?>
</li>
</ul>
</div>
<?php
endwhile;
else: ?>
<div class="activity">
<ul id="activity-stream" class="activity-list item-list">
<li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
<div class="activity-content">
<?php do_action('bp_activity_entry_content'); ?>
<?php if (is_user_logged_in()) : ?>
<div class="activity-meta no-ajax">
<a href="<?php echo $this->get_delete_url(); ?>" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">Delete</a>
</div>
<?php endif; ?>
</div>
</li>
</ul>
</div>
<?
endif;
}
示例9: bp_get_activity_css_class
/**
* Gets the activity CSS class
*
* @since 1.0.0
*
* @global object $activities_template {@link BP_Activity_Template}
* @uses apply_filters() To call the 'bp_activity_mini_activity_types' hook
* @uses bp_activity_get_comment_count()
* @uses bp_activity_can_comment()
* @uses apply_filters() To call the 'bp_get_activity_css_class' hook
*
* @return string The activity css class
*/
function bp_get_activity_css_class()
{
global $activities_template;
$mini_activity_actions = apply_filters('bp_activity_mini_activity_types', array('friendship_accepted', 'friendship_created', 'new_blog', 'joined_group', 'created_group', 'new_member'));
$class = '';
if (in_array($activities_template->activity->type, (array) $mini_activity_actions) || empty($activities_template->activity->content)) {
$class = ' mini';
}
if (bp_activity_get_comment_count() && bp_activity_can_comment()) {
$class .= ' has-comments';
}
return apply_filters('bp_get_activity_css_class', $activities_template->activity->component . ' ' . $activities_template->activity->type . $class);
}
示例10: bp_get_activity_css_class
/**
* Return the current activity item's CSS class.
*
* @since BuddyPress (1.0.0)
*
* @global object $activities_template {@link BP_Activity_Template}
* @uses apply_filters() To call the 'bp_activity_mini_activity_types' hook.
* @uses bp_activity_get_comment_count()
* @uses bp_activity_can_comment()
* @uses apply_filters() To call the 'bp_get_activity_css_class' hook.
*
* @return string The activity item's CSS class.
*/
function bp_get_activity_css_class()
{
global $activities_template;
/**
* Filters the available mini activity actions available as CSS classes.
*
* @since BuddyPress (1.2.0)
*
* @param array $value Array of classes used to determine classes applied to HTML element.
*/
$mini_activity_actions = apply_filters('bp_activity_mini_activity_types', array('friendship_accepted', 'friendship_created', 'new_blog', 'joined_group', 'created_group', 'new_member'));
$class = ' activity-item';
if (in_array($activities_template->activity->type, (array) $mini_activity_actions) || empty($activities_template->activity->content)) {
$class .= ' mini';
}
if (bp_activity_get_comment_count() && bp_activity_can_comment()) {
$class .= ' has-comments';
}
/**
* Filters the determined classes to add to the HTML element.
*
* @since BuddyPress (1.0.0)
*
* @param string $value Classes to be added to the HTML element.
*/
return apply_filters('bp_get_activity_css_class', $activities_template->activity->component . ' ' . $activities_template->activity->type . $class);
}
示例11: get_option
<language><?php echo get_option('rss_language'); ?></language>
<?php do_action('bp_activity_mentions_feed_head'); ?>
<?php if ( bp_has_activities( 'max=50&display_comments=stream&search_terms=@' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) ) : ?>
<?php while ( bp_activities() ) : bp_the_activity(); ?>
<item>
<guid><?php bp_activity_thread_permalink() ?></guid>
<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
<link><?php echo bp_activity_thread_permalink() ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
<description>
<![CDATA[
<?php bp_activity_feed_item_description() ?>
<?php if ( bp_activity_can_comment() ) : ?>
<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
<?php endif; ?>
<?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
<br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
<?php bp_activity_parent_content() ?>
<?php endif; ?>
]]>
</description>
<?php do_action('bp_activity_mentions_feed_item'); ?>
</item>
<?php endwhile; ?>
<?php endif; ?>
</channel>
示例12: swa_activity_entry
function swa_activity_entry($show_avatar = false)
{
?>
<?php
do_action('bp_before_activity_entry');
?>
<li class="<?php
bp_activity_css_class();
?>
" id="activity-<?php
bp_activity_id();
?>
">
<?php
if ($show_avatar == "yes") {
?>
<div class="swa-activity-avatar">
<a href="<?php
bp_activity_user_link();
?>
">
<?php
bp_activity_avatar('type=thumb&width=50&height=50');
?>
</a>
</div>
<?php
}
?>
<div class="swa-activity-content">
<div class="swa-activity-header">
<?php
bp_activity_action();
?>
</div>
<?php
if (bp_activity_has_content()) {
?>
<div class="swa-activity-inner">
<?php
bp_activity_content_body();
?>
</div>
<?php
}
?>
<?php
do_action('bp_activity_entry_content');
?>
<div class="swa-activity-meta">
<?php
if (is_user_logged_in() && bp_activity_can_comment()) {
?>
<a href="<?php
bp_activity_comment_link();
?>
" class="acomment-reply" id="acomment-comment-<?php
bp_activity_id();
?>
"><?php
_e('Reply', 'buddypress');
?>
(<span><?php
bp_activity_comment_count();
?>
</span>)</a>
<?php
}
?>
<?php
if (is_user_logged_in()) {
?>
<?php
if (!bp_get_activity_is_favorite()) {
?>
<a href="<?php
bp_activity_favorite_link();
?>
" class="fav" title="<?php
_e('Mark as Favorite', 'swa');
?>
"><?php
_e('Favorite', 'swa');
?>
</a>
<?php
} else {
?>
<a href="<?php
bp_activity_unfavorite_link();
?>
" class="unfav" title="<?php
_e('Remove Favorite', 'swa');
?>
"><?php
_e('Remove Favorite', 'swa');
?>
//.........这里部分代码省略.........
示例13: do_action
?>
</div>
<?php
do_action('bp_before_activity_entry_comments');
?>
<?php
if (bp_activity_can_comment() || bp_activity_get_comment_count()) {
?>
<div class="activity-comments">
<?php
if (!bp_activity_can_comment() || !bp_activity_get_comment_count()) {
?>
<?php
wall_add_likes_comments();
?>
<?php
} else {
?>
<?php
bp_activity_comments();
?>
<?php
示例14: do_action
<?php
}
?>
<?php
do_action('bp_activity_entry_meta');
?>
</div>
</div>
<?php
do_action('bp_before_activity_entry_comments');
?>
<?php
if (bp_activity_can_comment() && bpgr_is_group_reviews()) {
?>
<div class="activity-comments">
<?php
bp_activity_comments();
?>
<?php
if (is_user_logged_in()) {
?>
<form action="<?php
bp_activity_comment_form_action();
?>
" method="post" id="ac-form-<?php
bp_activity_id();
?>
示例15: bp_follow_activity_can_follow
/**
* Check if the current activity item in the activity loop can be followed.
*
* There are two ways to register your activity item to be followed. Please
* see inline documentation for more details.
*
* @param int $activity_id The activity ID to check.
* @return bool
*/
function bp_follow_activity_can_follow($activity_id = 0)
{
// There are two ways to register a follow button for your activity item:
/**
* (1) Post type method.
*
* If you're registering a post type with BP activity support, and you want to
* show a 'Follow' button in the activity loop for this item, simply add the
* 'follow_button' key to the 'bp_activity' array.
*
* 'follow_type' is an optional argument, which is handy if you wanted to
* separate your post type from the generic followed activity tab/filter. If
* you do set this argument, you'll have to register your own activity nav
* items, adminbar menus, caching invalidation and activity scope manually.
*
* eg.
* 'bp_activity' => array(
* 'format_callback' => 'WHATEVER',
* 'follow_button' => true,
*
* // optional; defaults to 'activity' if not set.
* // handy if you want to separate
* 'follow_type' => 'UNIQUE_ID'
* )
*/
/**
* (2) Activity action method.
*
* If you're registering an activity action and you want to show a 'Follow'
* button in the activity loop, set the 'follow_button' key for the $context
* parameter.
*
* 'follow_type' is an optional argument, which is handy if you wanted to
* separate your post type from the generic followed activity tab/filter. If
* you do set this argument, you'll have to register your own activity nav
* items, adminbar menus, caching invalidation and activity scope manually.
*
* eg.
* bp_activity_set_action(
* $bp->activity->id,
* 'activity_update',
* __( 'Posted a status update', 'buddypress' ),
* 'bp_activity_format_activity_action_activity_update',
* __( 'Updates', 'buddypress' ),
*
* // Notice the change on the second line!
* array( 'activity', 'group', 'member', 'member_groups',
* 'follow_button' => true, 'follow_type' => 'UNIQUE_ID' )
* );
*/
// If in activity loop, use already-queried activity action
if (!empty($GLOBALS['activities_template']->in_the_loop)) {
$action = bp_activity_get_action(bp_get_activity_object_name(), bp_get_activity_type());
// Manually query for the activity action of a given activity item
} else {
// Do not do anything if empty
if (empty($activity_id)) {
return false;
}
$activity = new BP_Activity_Activity($activity_id);
if (empty($activity->type)) {
return false;
}
$action = bp_activity_get_action($activity->component, $activity->type);
}
// Success!
if (isset($action['follow_button']) && !empty($action['follow_button'])) {
$can_follow = true;
// Fallback to activity commenting setting
} else {
$can_follow = bp_activity_can_comment();
}
return apply_filters('bp_follow_can_follow_activity', $can_follow, $action);
}