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


PHP bp_activity_can_favorite函数代码示例

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


在下文中一共展示了bp_activity_can_favorite函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:Ritesh-patel,项目名称:BP-API,代码行数:27,代码来源:bp-api-activity.php

示例2: bp_get_activity_comment_link

        bp_get_activity_comment_link();
        ?>
" class="button btn btn-default btn-xs acomment-reply bp-primary-action" id="acomment-comment-<?php 
        bp_activity_id();
        ?>
"><?php 
        printf(__('Comment <span>%s</span>', 'firmasite'), bp_activity_get_comment_count());
        ?>
</a>

				<?php 
    }
    ?>

				<?php 
    if (bp_activity_can_favorite()) {
        ?>

					<?php 
        if (!bp_get_activity_is_favorite()) {
            ?>

						<a href="<?php 
            bp_activity_favorite_link();
            ?>
" class="button btn btn-default btn-xs fav bp-secondary-action" title="<?php 
            esc_attr_e('Mark as Favorite', 'firmasite');
            ?>
"><?php 
            _e('Favorite', 'firmasite');
            ?>
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:31,代码来源:entry.php

示例3: 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'); ?>" /> &nbsp; <?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;
	}
开发者ID:rolandinsh,项目名称:buddypress-media,代码行数:77,代码来源:bp-media-class-wordpress.php

示例4: setup_admin_bar

 /**
  * Set up the component entries in the WordPress Admin Bar.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of the $wp_admin_nav
  *      parameter array.
  * @uses is_user_logged_in()
  * @uses trailingslashit()
  * @uses bp_get_total_mention_count_for_user()
  * @uses bp_loggedin_user_id()
  * @uses bp_is_active()
  * @uses bp_get_friends_slug()
  * @uses bp_get_groups_slug()
  *
  * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a
  *                            description.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Menus for logged in user.
     if (is_user_logged_in()) {
         // Setup the logged in user variables.
         $activity_link = trailingslashit(bp_loggedin_user_domain() . bp_get_activity_slug());
         // Unread message count.
         if (bp_activity_do_mentions()) {
             $count = bp_get_total_mention_count_for_user(bp_loggedin_user_id());
             if (!empty($count)) {
                 $title = sprintf(_x('Mentions <span class="count">%s</span>', 'Toolbar Mention logged in user', 'buddypress'), bp_core_number_format($count));
             } else {
                 $title = _x('Mentions', 'Toolbar Mention logged in user', 'buddypress');
             }
         }
         // Add the "Activity" sub menu.
         $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => _x('Activity', 'My Account Activity sub nav', 'buddypress'), 'href' => $activity_link);
         // Personal.
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-personal', 'title' => _x('Personal', 'My Account Activity sub nav', 'buddypress'), 'href' => $activity_link);
         // Mentions.
         if (bp_activity_do_mentions()) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-mentions', 'title' => $title, 'href' => trailingslashit($activity_link . 'mentions'));
         }
         // Favorite activity items.
         if (bp_activity_can_favorite()) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => _x('Favorites', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . 'favorites'));
         }
         // Friends?
         if (bp_is_active('friends')) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friends', 'title' => _x('Friends', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_friends_slug()));
         }
         // Groups?
         if (bp_is_active('groups')) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-groups', 'title' => _x('Groups', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_groups_slug()));
         }
     }
     parent::setup_admin_bar($wp_admin_nav);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:56,代码来源:bp-activity-loader.php

示例5: bp_get_total_favorite_count_for_user

/**
 * Return the total favorite count for a specified user.
 *
 * @since 1.2.0
 *
 * @uses bp_activity_total_favorites_for_user()
 * @uses apply_filters() To call the 'bp_get_total_favorite_count_for_user' hook.
 *
 * @param int $user_id ID of user being queried. Default: displayed user ID.
 * @return int The total favorite count for the specified user.
 */
function bp_get_total_favorite_count_for_user($user_id = 0)
{
    $retval = false;
    if (bp_activity_can_favorite()) {
        // Default to displayed user if none is passed.
        $user_id = empty($user_id) ? bp_displayed_user_id() : $user_id;
        // Get user meta if user ID exists.
        if (!empty($user_id)) {
            $retval = bp_activity_total_favorites_for_user($user_id);
        }
    }
    /**
     * Filters the total favorite count for a user.
     *
     * @since 1.2.0
     *
     * @param int|bool $retval Total favorite count for a user. False on no favorites.
     */
    return apply_filters('bp_get_total_favorite_count_for_user', $retval);
}
开发者ID:divemasterza,项目名称:Checkedin,代码行数:31,代码来源:bp-activity-template.php

示例6: do_action

		<?php 
do_action('humcore_deposits_entry_content');
?>

		<?php 
if (is_user_logged_in()) {
    ?>

			<div class="activity-meta">
<!--disable favroites -->
				<?php 
    $activity_id = humcore_get_deposit_activity_id();
    ?>

				<?php 
    if (1 == 2 && bp_activity_can_favorite()) {
        ?>

					<?php 
        if (!humcore_deposit_activity_is_favorite($activity_id)) {
            ?>

						<a href="<?php 
            humcore_deposit_activity_favorite_link($activity_id);
            ?>
" class="button fav bp-secondary-action" title="<?php 
            esc_attr_e('Mark as Favorite', 'humcore_domain');
            ?>
"><?php 
            _e('Favorite', 'humcore_domain');
            ?>
开发者ID:MartinPaulEve,项目名称:humcore,代码行数:31,代码来源:entry.php

示例7: bp_core_time_since

?>

		<?php 
if (is_user_logged_in()) {
    ?>

			<div class="activity-meta">

				<?php 
    echo bp_core_time_since(bp_get_activity_date_recorded());
    ?>
				
				<!-- Like (Favorite) -->
			
				<?php 
    if (bp_activity_can_favorite() && is_user_logged_in()) {
        ?>
	
					<?php 
        if (!bp_get_activity_is_favorite()) {
            ?>
	
						&middot; <a href="<?php 
            bp_activity_favorite_link();
            ?>
" class="fav bp-secondary-action" title="Like"> Like</a>
	
					<?php 
        } else {
            ?>
	
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:30,代码来源:entry.php

示例8: gears_get_activity_stream

 /**
  * @deprecated gears_get_activity_stream
  */
 function gears_get_activity_stream()
 {
     $output = '';
     $output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">';
     $output .= '<div class="activity-avatar">';
     $output .= '<a class="gears-activity-avatar" title="' . __('View Profile', 'gears') . '" href="' . bp_get_activity_user_link() . '">';
     $output .= bp_get_activity_avatar();
     $output .= '</a>';
     $output .= '</div>';
     // activity content
     $output .= '<div class="activity-content">';
     $output .= '<div class="activity-header">';
     $output .= bp_get_activity_action();
     $output .= '</div>';
     $output .= '<div class="activity-inner">';
     if (bp_activity_has_content()) {
         $output .= bp_get_activity_content_body();
     }
     $output .= '</div>';
     do_action('bp_activity_entry_content');
     $output .= '<div class="activity-meta">';
     if (bp_get_activity_type() == 'activity_comment') {
         $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears') . '</a>';
     }
     if (is_user_logged_in()) {
         if (bp_activity_can_favorite()) {
             if (!bp_get_activity_is_favorite()) {
                 $output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'gears')) . '">' . __('Favorite', 'gears') . '</a>';
             } else {
                 $output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'gears')) . '">' . __('Remove Favorite', 'gears') . '</a>';
             }
         }
         if (bp_activity_user_can_delete()) {
             $output .= bp_get_activity_delete_link();
         }
         do_action('bp_activity_entry_meta');
     }
     $output .= '</div>';
     if (bp_get_activity_type() == 'activity_comment') {
         $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears');
     }
     // end bp_get_activity_type()
     $output .= '</div>';
     // end activity content
     $output .= '</li>';
     return $output;
 }
开发者ID:poweronio,项目名称:mbsite,代码行数:50,代码来源:library.php


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