本文整理汇总了PHP中bp_get_activity_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_activity_id函数的具体用法?PHP bp_get_activity_id怎么用?PHP bp_get_activity_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_activity_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_get_activity_id
<?php
// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
exit;
}
/***
*
* Attachment in single media comment
* This is a fallback template for new media types
*
*/
$activity_id = bp_get_activity_id();
$mppq = new MPP_Cached_Media_Query(array('in' => (array) mpp_activity_get_media_id($activity_id)));
if ($mppq->have_media()) {
?>
<div class="mpp-container mpp-media-list mpp-activity-media-list">
<?php
while ($mppq->have_media()) {
$mppq->the_media();
?>
<a href="<?php
mpp_media_permalink();
?>
" ><img src="<?php
mpp_media_src('thumbnail');
?>
" class='mpp-attached-media-item' data-mpp-activity-id="<?php
echo $activity_id;
示例2: mpp_activity_has_media
/**
* Check if activity has associated media
*
* @param int $activity_id
* @return mixed false if no attachment else array of attachment ids
*/
function mpp_activity_has_media($activity_id = false)
{
if (!$activity_id) {
$activity_id = bp_get_activity_id();
}
return mpp_activity_get_attached_media_ids($activity_id);
}
示例3: bp_reshare_replace_activity_delete_link
function bp_reshare_replace_activity_delete_link($link)
{
// if activity type is a reshare, then we replace the delete link behavior
if (bp_get_activity_type() == 'reshare_update') {
$class = 'delete-reshare';
$action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?delete_reshare=' . bp_get_activity_id(), '_reshare_delete');
$link = '<a href="' . $action_url . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __('Delete', 'bp-reshare') . '</a>';
}
return apply_filters('bp_reshare_replace_activity_delete_link', $link);
}
示例4: bplike_activity_update_button
function bplike_activity_update_button()
{
$liked_count = 0;
if (is_user_logged_in() && bp_get_activity_type() !== 'activity_liked') {
if (bp_activity_get_meta(bp_get_activity_id(), 'liked_count', true)) {
$users_who_like = array_keys(bp_activity_get_meta(bp_get_activity_id(), 'liked_count', true));
$liked_count = count($users_who_like);
}
if (!bp_like_is_liked(bp_get_activity_id(), 'activity_update', get_current_user_id())) {
?>
<a href="#" class="button bp-primary-action like" id="like-activity-<?php
echo bp_get_activity_id();
?>
" title="<?php
echo bp_like_get_text('like_this_item');
?>
">
<?php
echo bp_like_get_text('like');
if ($liked_count) {
echo ' <span>' . $liked_count . '</span>';
}
?>
</a>
<?php
} else {
?>
<a href="#" class="button bp-primary-action unlike" id="unlike-activity-<?php
echo bp_get_activity_id();
?>
" title="<?php
echo bp_like_get_text('unlike_this_item');
?>
">
<?php
echo bp_like_get_text('unlike');
if ($liked_count) {
echo '<span>' . $liked_count . '</span>';
}
?>
</a>
<?php
}
// Checking if there are users who like item.
if (isset($users_who_like)) {
view_who_likes(bp_get_activity_id(), 'activity_update');
}
}
}
示例5: process_images_tag
/**
* Processes images-type shortcode and create proper markup.
* Relies on ./forms/images_tag_template.php for markup rendering.
*/
function process_images_tag($atts, $content)
{
$images = explode("\n", trim(strip_tags($content)));
//return var_export($images,1);
$activity_id = bp_get_activity_id();
global $blog_id;
$activity_blog_id = $blog_id;
$use_thickbox = defined('BPFB_USE_THICKBOX') ? esc_attr(BPFB_USE_THICKBOX) : 'thickbox';
if ($activity_id) {
$activity_blog_id = bp_activity_get_meta($activity_id, 'bpfb_blog_id');
}
ob_start();
@(include BPFB_PLUGIN_BASE_DIR . '/lib/forms/images_tag_template.php');
$out = ob_get_clean();
return $out;
}
示例6: process_images_tag
/**
* Processes images-type shortcode and create proper markup.
* Relies on ./forms/images_tag_template.php for markup rendering.
*/
function process_images_tag($atts, $content)
{
$images = self::extract_images($content);
//return var_export($images,1);
$activity_id = bp_get_activity_id();
global $blog_id;
$activity_blog_id = $blog_id;
$use_thickbox = defined('BPFB_USE_THICKBOX') ? esc_attr(BPFB_USE_THICKBOX) : 'thickbox';
if ($activity_id) {
$activity_blog_id = bp_activity_get_meta($activity_id, 'bpfb_blog_id');
}
$template = locate_template(array('images_tag_template.php'));
if (empty($template)) {
$template = BPFB_PLUGIN_BASE_DIR . '/lib/forms/images_tag_template.php';
}
ob_start();
@(include $template);
$out = ob_get_clean();
return $out;
}
示例7: 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;
}
示例8: mpp_activity_inject_media_in_comment_replies
function mpp_activity_inject_media_in_comment_replies()
{
$activity_id = bp_get_activity_id();
$media_id = mpp_activity_get_media_id($activity_id);
if (empty($media_id)) {
return;
}
$media = mpp_get_media($media_id);
if (!$media) {
return;
}
// $gallery_id = mpp_activity_get_gallery_id( $activity_id );
//
// $gallery = mpp_get_gallery( $gallery_id );
//
// if( ! $gallery ) {
// return ;
// }
$slug = $media->type;
//media-loop-audio/media-loop-video,media-loop-photo, media-loop
mpp_get_template_part('buddypress/activity/entry-comment', $slug);
}
示例9: mpp_activity_inject_attached_media_html
/**
* Show the list of attached media in an activity
* Should we add a link to view gallery too?
*
* @return type
*/
function mpp_activity_inject_attached_media_html()
{
$media_list = mpp_activity_get_attached_media_ids(bp_get_activity_id());
if (empty($media_list)) {
return;
}
$activity_id = bp_get_activity_id();
$gallery_id = mpp_activity_get_gallery_id($activity_id);
$gallery = mpp_get_gallery($gallery_id);
//in case we are using oembed or other storage method
$storage_method = mpp_get_media_meta($gallery->id, '_mpp_storage_method', true);
if ($storage_method == mpp_get_default_storage_method()) {
$storage_method = '';
}
$slug = $gallery->type;
if (!empty($storage_method)) {
$slug = $slug . '-' . $storage_method;
}
//eg. video-oembed
//media-loop-audio/media-loop-video,media-loop-photo, media-loop
mpp_get_template_part('gallery/activity/loop', $slug);
}
示例10: bp_checkins_attach_thumb
function bp_checkins_attach_thumb($activity_content)
{
$activity_id = bp_get_activity_id();
$pictures = bp_activity_get_meta($activity_id, 'bpci_picture');
if ($pictures) {
foreach ($pictures as $pic) {
if ($pic->width == 100) {
$src["100"] = $pic->url;
}
if ($pic->width == 960) {
$src["960"] = $pic->url;
}
}
if ($src) {
$image = '<a href="' . esc_attr($src["960"]) . '" class="bp-ci-zoompic align-left"><img src="' . esc_attr($src["100"]) . '" width="100px" alt="' . __('Thumbnail', 'bp-checkins') . '" class="align-left thumbnail" /></a>';
return $image . $activity_content;
} else {
return $activity_content;
}
} else {
return $activity_content;
}
}
示例11: show_tags_from_activity
function show_tags_from_activity()
{
// var_dump( get_terms( 'activity_tags', $args = '' ) );
// var_dump( wp_get_object_terms( bp_get_activity_id(), 'activity_tags', $args = array()) );
?>
<div class='activity-content activity-tag-list activity-tag-list-<?php
echo bp_get_activity_id();
?>
'>
<?php
foreach (wp_get_object_terms(bp_get_activity_id(), 'activity_tags') as $term) {
?>
<a href="#" class="fa fa-tag activity-tag"><?php
echo $term->name;
?>
</a>
<?php
}
?>
</div>
<?php
}
示例12: extract
extract(shortcode_atts(array('show' => false, 'number' => 6, 'show_button' => 'yes', 'button_link' => '/activity', 'button_label' => 'View All Activity', 'post_form' => ''), $atts));
if (function_exists('bp_is_active') && bp_is_active('activity')) {
$output = '';
$params = array('max' => $number, 'object' => $show);
$output .= '<div class="wpb_wrapper">';
$output .= '<div class="activity kleo-activity-streams">';
if (is_user_logged_in() && $post_form == 'yes') {
ob_start();
bp_get_template_part('activity/post-form');
$output .= ob_get_clean();
}
if (bp_has_activities($params)) {
$output .= '<ul id="activity-stream" class="activity-list item-list">';
while (bp_activities()) {
bp_the_activity();
$output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">';
$output .= '<div class="activity-avatar rounded">';
$output .= '<a class="kleo-activity-avatar" title="' . __('View Profile', 'kleo_framework') . '" 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>';
示例13: bp_blogs_disable_activity_commenting
/**
* Disable activity commenting for blog posts based on certain criteria.
*
* If activity commenting is enabled for blog posts, we still need to disable
* commenting if:
* - comments are disabled for the WP blog post from the admin dashboard
* - the WP blog post is supposed to be automatically closed from comments
* based on a certain age
* - the activity entry is a 'new_blog_comment' type
*
* @since BuddyPress (2.0.0)
*
* @param bool $retval Is activity commenting enabled for this activity entry?
* @return bool
*/
function bp_blogs_disable_activity_commenting( $retval ) {
// if activity commenting is disabled, return current value
if ( bp_disable_blogforum_comments() ) {
return $retval;
}
// activity commenting is enabled for blog posts
switch ( bp_get_activity_action_name() ) {
// we still have to disable activity commenting for 'new_blog_comment' items
// commenting should only be done on the parent 'new_blog_post' item
case 'new_blog_comment' :
$retval = false;
break;
// check if commenting is disabled for the WP blog post
// we should extrapolate this and automate this for plugins... or not
case 'new_blog_post' :
global $activities_template;
// setup some globals we'll need to reference later
bp_blogs_setup_activity_loop_globals( $activities_template->activity );
// if comments are closed for the WP blog post, we should disable
// activity comments for this activity entry
if ( empty( buddypress()->blogs->allow_comments[bp_get_activity_id()] ) ) {
$retval = false;
}
break;
}
return $retval;
}
示例14: bp_activity_truncate_entry
/**
* Truncate long activity entries when viewed in activity streams.
*
* This method can only be used inside the Activity loop.
*
* @since 1.5.0
*
* @uses bp_is_single_activity()
* @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook.
* @uses apply_filters() To call the 'bp_activity_excerpt_length' hook.
* @uses bp_create_excerpt()
* @uses bp_get_activity_id()
* @uses bp_get_activity_thread_permalink()
* @uses apply_filters() To call the 'bp_activity_truncate_entry' hook.
*
* @param string $text The original activity entry text.
* @return string $excerpt The truncated text.
*/
function bp_activity_truncate_entry($text)
{
global $activities_template;
/**
* Provides a filter that lets you choose whether to skip this filter on a per-activity basis.
*
* @since 2.3.0
*
* @param bool $value If true, text should be checked to see if it needs truncating.
*/
$maybe_truncate_text = apply_filters('bp_activity_maybe_truncate_entry', isset($activities_template->activity->type) && !in_array($activities_template->activity->type, array('new_blog_post'), true));
// The full text of the activity update should always show on the single activity screen.
if (!$maybe_truncate_text || bp_is_single_activity()) {
return $text;
}
/**
* Filters the appended text for the activity excerpt.
*
* @since 1.5.0
*
* @param string $value Internationalized "Read more" text.
*/
$append_text = apply_filters('bp_activity_excerpt_append_text', __('[Read more]', 'buddypress'));
/**
* Filters the excerpt length for the activity excerpt.
*
* @since 1.5.0
*
* @param int $value Number indicating how many words to trim the excerpt down to.
*/
$excerpt_length = apply_filters('bp_activity_excerpt_length', 358);
// Run the text through the excerpt function. If it's too short, the original text will be returned.
$excerpt = bp_create_excerpt($text, $excerpt_length, array('ending' => __('…', 'buddypress')));
/*
* If the text returned by bp_create_excerpt() is different from the original text (ie it's
* been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping
* shortcodes, so we have strip them from the $text before the comparison.
*/
if ($excerpt != strip_shortcodes($text)) {
$id = !empty($activities_template->activity->current_comment->id) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
$excerpt = sprintf('%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text);
}
/**
* Filters the composite activity excerpt entry.
*
* @since 1.5.0
*
* @param string $excerpt Excerpt text and markup to be displayed.
* @param string $text The original activity entry text.
* @param string $append_text The final append text applied.
*/
return apply_filters('bp_activity_truncate_entry', $excerpt, $text, $append_text);
}
示例15: buddyreshare_list_user_avatars
/**
* List the users that have reshared an activity
*
* @package BP Reshare
* @since 1.0
*
* @uses bp_get_option() to get the setting for the number of users to display
* @uses bp_activity_get_meta() to get some meta about the activity
* @uses bp_get_activity_id() to get activity id
* @uses bp_core_get_userlink() to build user's profile link
* @uses bp_core_fetch_avatar() to get user's avatar
* @return string html output
*/
function buddyreshare_list_user_avatars()
{
$max = (int) bp_get_option('bp-reshare-user-amount', 5);
if (empty($max)) {
return;
}
$user_list = bp_activity_get_meta(bp_get_activity_id(), 'reshared_by');
if (is_array($user_list) && count($user_list) >= 1) {
rsort($user_list);
$output = '<div class="reshared-list activity-content">' . __('Reshared by :', 'bp-reshare') . '<ul>';
$step = 0;
foreach ($user_list as $user) {
if ($step == $max) {
break;
}
$output .= '<li><a href="' . bp_core_get_userlink($user, false, true) . '">' . bp_core_fetch_avatar(array('item_id' => $user, 'object' => 'user', 'type' => 'thumb', 'class' => 'avatar reshared', 'width' => '40', 'height' => '40')) . '</a></li>';
$step += 1;
}
$output .= '</ul><br style="clear:both"></div>';
echo $output;
}
}