本文整理汇总了PHP中bp_activity_get_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_activity_get_meta函数的具体用法?PHP bp_activity_get_meta怎么用?PHP bp_activity_get_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_activity_get_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rendez_vous_format_activity_action
/**
* format callback
*
* @package Rendez Vous
* @subpackage Activity
*
* @since Rendez Vous (1.0.0)
*/
function rendez_vous_format_activity_action($action, $activity)
{
$rendez_vous_id = $activity->item_id;
$organizer = $activity->secondary_item_id;
if ($activity->component != buddypress()->rendez_vous->id) {
$rendez_vous_id = $activity->secondary_item_id;
$organizer = $activity->user_id;
}
$rendez_vous_url = rendez_vous_get_single_link($rendez_vous_id, $organizer);
$rendez_vous_title = bp_activity_get_meta($activity->id, 'rendez_vous_title');
// Should only be empty at the time of rendez vous creation
if (empty($rendez_vous_title)) {
$rendez_vous = rendez_vous_get_item($rendez_vous_id);
if (is_a($rendez_vous, 'Rendez_Vous_Item')) {
$rendez_vous_title = $rendez_vous->title;
bp_activity_update_meta($activity->id, 'rendez_vous_title', $rendez_vous_title);
}
}
$rendez_vous_link = '<a href="' . esc_url($rendez_vous_url) . '">' . esc_html($rendez_vous_title) . '</a>';
$user_link = bp_core_get_userlink($activity->user_id);
$action_part = __('scheduled a new', 'rendez-vous');
if ('updated_rendez_vous' == $activity->type) {
$action_part = __('updated a', 'rendez-vous');
}
$action = sprintf(__('%1$s %2$s rendez-vous, %3$s', 'rendez-vous'), $user_link, $action_part, $rendez_vous_link);
return apply_filters('rendez_vous_format_activity_action', $action, $activity);
}
示例2: test_delete_activity_meta_entries
/**
* @ticket BP4804
* @group delete_activity_meta_entries
* @group activitymeta
*/
public function test_delete_activity_meta_entries()
{
$activity = $this->factory->activity->create(array('type' => 'activity_update'));
bp_activity_update_meta($activity, 'Paul', 'is cool');
BP_Activity_Activity::delete_activity_meta_entries($activity);
$meta = bp_activity_get_meta($activity, 'Paul');
$this->assertSame('', $meta);
}
示例3: vortex_get_meta
function vortex_get_meta($post_id, $key, $value)
{
$bbp = vortex_is_buddypress($post_id);
if ($bbp) {
return bp_activity_get_meta($post_id, $key, $value);
} else {
return get_post_meta($post_id, $key, $value);
}
}
示例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: bp_media_activity_permalink_filter
function bp_media_activity_permalink_filter($link, $activity_obj = null)
{
if ($activity_obj != null && 'media_upload' == $activity_obj->type) {
add_shortcode('bp_media_url', 'bp_media_shortcode_url');
$link = do_shortcode($activity_obj->primary_link);
remove_shortcode('bp_media_url');
}
if ($activity_obj != null && 'activity_comment' == $activity_obj->type) {
$parent = bp_activity_get_meta($activity_obj->item_id, 'bp_media_parent_post');
if ($parent) {
$parent = new BP_Media_Host_Wordpress($parent);
$link = $parent->get_url();
}
}
return $link;
}
示例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 = 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;
}
示例7: test_bp_blogs_format_activity_action_new_blog_post_ms_rootblog
/**
* @group activity_action
* @group bp_blogs_format_activity_action_new_blog_post
*/
public function test_bp_blogs_format_activity_action_new_blog_post_ms_rootblog()
{
if (!is_multisite()) {
return;
}
$u = $this->factory->user->create();
$p = $this->factory->post->create(array('post_author' => $u));
$a = $this->factory->activity->create(array('component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'user_id' => $u, 'item_id' => 1, 'secondary_item_id' => $p));
$a_obj = new BP_Activity_Activity($a);
$user_link = bp_core_get_userlink($u);
$blog_url = get_home_url();
$post_url = add_query_arg('p', $p, trailingslashit($blog_url));
$post_title = bp_activity_get_meta($a, 'post_title');
$post_link = '<a href="' . $post_url . '">' . $post_title . '</a>';
$expected = sprintf('%s wrote a new post, %s, on the site %s', $user_link, $post_link, '<a href="' . $blog_url . '">' . bp_blogs_get_blogmeta($a_obj->item_id, 'name') . '</a>');
$this->assertSame($expected, $a_obj->action);
}
示例8: test_bp_activity_update_meta_cache
/**
* @group bp_activity_update_meta_cache
*/
public function test_bp_activity_update_meta_cache()
{
$a1 = $this->factory->activity->create();
$a2 = $this->factory->activity->create();
// Set up some data
bp_activity_update_meta($a1, 'foo', 'bar');
bp_activity_update_meta($a1, 'Boone', 'Rules');
bp_activity_update_meta($a2, 'foo', 'baz');
bp_activity_update_meta($a2, 'BuddyPress', 'Is Cool');
// Prime the cache for $a1
bp_activity_get_meta($a1, 'foo');
// Ensure an empty cache for $a2
wp_cache_delete($a2, 'activity_meta');
bp_activity_update_meta_cache(array($a1, $a2));
$expected = array($a1 => array('foo' => array('bar'), 'Boone' => array('Rules')), $a2 => array('foo' => array('baz'), 'BuddyPress' => array('Is Cool')));
$found = array($a1 => wp_cache_get($a1, 'activity_meta'), $a2 => wp_cache_get($a2, 'activity_meta'));
$this->assertEquals($expected, $found);
}
示例9: bplike_activity_comment_button
function bplike_activity_comment_button()
{
$liked_count = 0;
if (is_user_logged_in()) {
if (bp_activity_get_meta(bp_get_activity_comment_id(), 'liked_count', true)) {
$users_who_like = array_keys(bp_activity_get_meta(bp_get_activity_comment_id(), 'liked_count', true));
$liked_count = count($users_who_like);
}
if (!bp_like_is_liked(bp_get_activity_comment_id(), 'activity_comment', get_current_user_id())) {
?>
<a href="#" class="acomment-reply bp-primary-action like" id="like-activity-<?php
echo bp_get_activity_comment_id();
?>
" title="<?php
echo bp_like_get_text('like_this_item');
?>
"><?php
echo bp_like_get_text('like');
if ($liked_count) {
echo ' <span><small>' . $liked_count . '</small></span>';
}
?>
</a>
<?php
} else {
?>
<a href="#" class="acomment-reply bp-primary-action unlike" id="unlike-activity-<?php
echo bp_get_activity_comment_id();
?>
" title="<?php
echo bp_like_get_text('unlike_this_item');
?>
"><?php
echo bp_like_get_text('unlike');
if ($liked_count) {
echo ' <span><small>' . $liked_count . '</small></span>';
}
?>
</a>
<?php
}
}
}
示例10: select_cover_for_group
function select_cover_for_group($activity_id)
{
global $bp;
$group_id = $bp->groups->current_group->id;
$activity_id = $_POST['activity_id'];
$attachment_id = bp_activity_get_meta($activity_id, 'all_bp_cover_group', true);
$fileurl = wp_get_attachment_image_src($attachment_id, 'full');
groups_update_groupmeta($group_id, 'bp_cover_group', $fileurl[0]);
groups_update_groupmeta($group_id, 'bp_cover_group_position', 0);
/*groups_record_activity( array(
'action' => sprintf( __( '%s changed their cover group %s', 'bp-cover' ),
bp_core_get_userlink( $bp->loggedin_user->id ),
'<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>') ,
'type' => 'cover_changed',
'item_id' => $group_id,
'content' =>bp_cover_group_get_image_scr() ,
'item_id' => $group_id,
) );*/
}
示例11: 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;
}
示例12: buddyreshare_extend_activities_template
/**
* Attach to the activities template the reshare datas
*
* @package BP Reshare
* @since 1.0
*
* @global $activities_template
* @param boolean $has_activities
* @param BP_Activity_Template $activities_template
* @param array $template_args
* @uses buddyreshare_can_reshare() to check if the activity can be reshared
* @uses bp_activity_get_meta() to fecth the number of reshares of this activity
* @uses buddyreshare_get_class() to eventually add the reshared class
* @return boolean $has_activities
*/
function buddyreshare_extend_activities_template($has_activities = false, $activities_template = null, $template_args = array())
{
global $activities_template;
if (empty($has_activities) || empty($activities_template)) {
return $has_activities;
}
foreach ($activities_template->activities as $activity) {
$activity->reshares = new StdClass();
$activity->reshares->can_reshare = buddyreshare_can_reshare($activity);
/* Reshare count */
$activity_first_id = $activity->id;
if ('reshare_update' == $activity->type) {
$activity_first_id = $activity->secondary_item_id;
}
$activity->reshares->activity_id = $activity_first_id;
$rs_count = bp_activity_get_meta($activity_first_id, 'reshared_count');
$rs_count = !empty($rs_count) ? $rs_count : 0;
$activity->reshares->count = $rs_count;
$activity->reshares->css_class = buddyreshare_get_class($activity, $activity_first_id);
}
return $has_activities;
}
示例13: 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;
}
}
示例14: bp_blogs_activity_comment_single_action
/**
* Formats single activity comment entries to use the blog comment action.
*
* This is only done if the activity comment is associated with a blog comment.
*
* @since BuddyPress (2.0.1)
*
* @param string $retval The activity action
* @param BP_Activity_Activity $activity
* @return string
*/
function bp_blogs_activity_comment_single_action( $retval, $activity ) {
if ( 'activity_comment' !== $activity->type ) {
return $retval;
}
$blog_comment_id = bp_activity_get_meta( $activity->id, 'bp_blogs_post_comment_id' );
if ( ! empty( $blog_comment_id ) ) {
// fetch the parent blog post activity item
$parent_blog_post_activity = new BP_Activity_Activity( $activity->item_id );
// fake a 'new_blog_comment' activity object
$object = $activity;
// override 'item_id' to use blog ID
$object->item_id = $parent_blog_post_activity->item_id;
// override 'secondary_item_id' to use comment ID
$object->secondary_item_id = $blog_comment_id;
// now format the activity action using the 'new_blog_comment' action callback
$retval = bp_blogs_format_activity_action_new_blog_comment( '', $object );
}
return $retval;
}
示例15: migrate_single_media
function migrate_single_media($result, $album = false)
{
$blog_id = get_current_blog_id();
$old = $result;
if (function_exists('bp_core_get_table_prefix')) {
$bp_prefix = bp_core_get_table_prefix();
} else {
$bp_prefix = '';
}
global $wpdb;
if (false !== $album && !is_object($result)) {
$id = $wpdb->get_var($wpdb->prepare("select ID from {$this->bmp_table} where media_id = %d", $result));
if (null == $id) {
$sql = "select\n a.post_id as 'post_id',\n a.meta_value as 'privacy',\n b.meta_value as 'context_id',\n c.meta_value as 'activity_id',\n p.post_type,\n p.post_mime_type,\n p.post_author as 'media_author',\n p.post_title as 'media_title',\n p.post_parent as 'parent'\n from\n {$wpdb->postmeta} a\n left join\n {$wpdb->postmeta} b ON ((a.post_id = b.post_id)\n and (b.meta_key = 'bp-media-key'))\n left join\n {$wpdb->postmeta} c ON (a.post_id = c.post_id)\n and (c.meta_key = 'bp_media_child_activity')\n left join\n {$wpdb->posts} p ON (a.post_id = p.ID)\n where\n a.post_id = %d and (NOT p.ID IS NULL)\n and a.meta_key = 'bp_media_privacy'";
$result = $wpdb->get_row($wpdb->prepare($sql, $result));
} else {
return $id;
}
}
if (!isset($result) || !isset($result->post_id)) {
return $old;
}
$media_id = $result->post_id;
if (intval($result->context_id) > 0) {
$media_context = 'profile';
$prefix = 'users/' . abs(intval($result->context_id));
} else {
$media_context = 'group';
$prefix = bp_get_groups_root_slug() . abs(intval($result->context_id));
}
$old_type = '';
if ('attachment' != $result->post_type) {
$media_type = 'album';
} else {
$mime_type = strtolower($result->post_mime_type);
$old_type = '';
if (0 === strpos($mime_type, 'image')) {
$media_type = 'photo';
$old_type = 'photos';
} else {
if (0 === strpos($mime_type, 'audio')) {
$media_type = 'music';
$old_type = 'music';
} else {
if (0 === strpos($mime_type, 'video')) {
$media_type = 'video';
$old_type = 'videos';
} else {
$media_type = 'other';
}
}
}
}
$activity_data = $wpdb->get_row($wpdb->prepare("select * from {$bp_prefix}bp_activity where id= %d", $result->activity_id));
if ('album' != $media_type) {
$this->importmedia($media_id, $prefix);
}
if ($this->table_exists($bp_prefix . 'bp_activity') && class_exists('BP_Activity_Activity')) {
$bp_activity = new BP_Activity_Activity();
$activity_sql = $wpdb->prepare("SELECT\n *\n FROM\n {$bp_prefix}bp_activity\n where\n id in (select distinct\n a.meta_value\n from\n {$wpdb->postmeta} a\n left join\n {$wpdb->posts} p ON (a.post_id = p.ID)\n where\n (NOT p.ID IS NULL) and p.ID = %d\n and a.meta_key = 'bp_media_child_activity')", $media_id);
$all_activity = $wpdb->get_results($activity_sql);
remove_all_actions('wp_insert_comment');
foreach ($all_activity as $activity) {
$comments = $bp_activity->get_activity_comments($activity->id, $activity->mptt_left, $activity->mptt_right);
$exclude = get_post_meta($media_id, 'rtmedia_imported_activity', true);
if (!is_array($exclude)) {
$exclude = array();
}
if ($comments) {
$this->insert_comment($media_id, $comments, $exclude);
}
}
}
if (0 !== intval($result->parent)) {
$album_id = $this->migrate_single_media($result->parent, true);
} else {
$album_id = 0;
}
if (function_exists('bp_activity_get_meta')) {
$likes = bp_activity_get_meta($result->activity_id, 'favorite_count');
} else {
$likes = 0;
}
$wpdb->insert($this->bmp_table, array('blog_id' => $blog_id, 'media_id' => $media_id, 'media_type' => $media_type, 'context' => $media_context, 'context_id' => abs(intval($result->context_id)), 'activity_id' => $result->activity_id, 'privacy' => intval($result->privacy) * 10, 'media_author' => $result->media_author, 'media_title' => $result->media_title, 'album_id' => $album_id, 'likes' => $likes), array('%d', '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d'));
$last_id = $wpdb->insert_id;
// Photo tag meta migration
//$photo_tag_meta = get_post_meta($media_id, "bp-media-user-tags", true);
// if($photo_tag_meta && !empty($photo_tag_meta)){
// $wpdb->insert(
// $wpdb->prefix . "rt_rtm_media_meta", array(
// 'media_id' => $media_id,
// 'meta_key' => "user-tags",
// "meta_value" => maybe_serialize($photo_tag_meta)), array('%d', '%s', '%s'));
// }
if ('album' != $media_type && function_exists('bp_core_get_user_domain') && $activity_data) {
if (function_exists('bp_core_get_table_prefix')) {
$bp_prefix = bp_core_get_table_prefix();
} else {
$bp_prefix = '';
}
//.........这里部分代码省略.........