本文整理汇总了PHP中bp_get_activity_user_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_activity_user_id函数的具体用法?PHP bp_get_activity_user_id怎么用?PHP bp_get_activity_user_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_activity_user_id函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rtmedia_api_get_feed
/**
* Fetches Activity for rtmedia updates, if user id for activity is provided fetches the user specific rtmedia updates
* @global type $activities_template
* @param type $activity_user_id
* @param type $activity_id
* @return array(), Activity data
*/
function rtmedia_api_get_feed($activity_user_id = FALSE, $activity_id = FALSE, $per_page = 10)
{
global $activities_template, $rtmediajsonapi;
$activity_feed = array();
extract($_REQUEST);
$i = 0;
$args = array('user_id' => $activity_user_id, 'action' => '', 'page' => !empty($_REQUEST['page']) ? $_REQUEST['page'] : 1, 'per_page' => $per_page, 'in' => $activity_id);
if (bp_has_activities($args)) {
$activity_feed['total_activity_count'] = $activities_template->total_activity_count;
$activity_feed['total'] = ceil((int) $activities_template->total_activity_count / (int) $activities_template->pag_num);
$activity_feed['current'] = $activities_template->pag_page;
while (bp_activities()) {
bp_the_activity();
//Activity basic details
$activity_feed[$i]['id'] = $activities_template->activity->id;
$activity_feed[$i]['activity_type'] = $activities_template->activity->type;
$activity_feed[$i]['activity_time'] = bp_get_activity_date_recorded();
$activity_feed[$i]['activity_time_human'] = strip_tags(bp_insert_activity_meta(''));
$activity_feed[$i]['activity_content'] = $activities_template->activity->content;
//activity User
if (!$activity_user_id) {
//Activity User data
$activity_feed[$i]['user'] = $this->rtmedia_api_user_data_from_id(bp_get_activity_user_id());
}
//Media Details
if (class_exists("RTMediaModel")) {
$model = new RTMediaModel();
$media = $model->get_by_activity_id($activities_template->activity->id);
if (isset($media['result']) && count($media['result']) > 0) {
//Create media array
$media = $this->rtmedia_api_media_details($media['result']);
} else {
$media = false;
}
}
if ($activity_id) {
//Activity Comment Count
$id = $media[0]['id'];
$activity_feed[$i]['comments'] = $this->rtmedia_api_get_media_comments($id);
}
//Activity Image
$activity_feed[$i]['media'] = $media;
$i++;
}
}
return $activity_feed;
}
示例2: activity_loop_link
function activity_loop_link()
{
$act_type = bp_get_activity_type();
if (empty($this->types_map[$act_type])) {
return;
}
$args = array('type' => $this->types_map[$act_type], 'id' => bp_get_activity_item_id(), 'id2' => bp_get_activity_secondary_item_id(), 'author_id' => bp_get_activity_user_id(), 'is_main_content' => bp_is_single_activity(), 'context' => 'activity-loop', 'custom_class' => 'button');
$args = apply_filters("bp_moderation_activity_loop_link_args_{$act_type}", $args);
if ($args) {
echo $this->generate_link($args);
}
}
示例3: bp_reshare_add_reshare_button
function bp_reshare_add_reshare_button()
{
global $bp;
if (!is_user_logged_in()) {
return false;
}
$activity_types_resharable = bp_reshare_activity_types();
if (!in_array(bp_get_activity_type(), $activity_types_resharable)) {
return false;
}
if (bp_reshare_activity_is_hidden()) {
return false;
}
if (bp_reshare_is_user_profile_reshares() && $bp->displayed_user->id != $bp->loggedin_user->id) {
return false;
}
$activity_first_id = bp_get_activity_id();
if ('reshare_update' == bp_get_activity_type()) {
$activity_first_id = bp_get_activity_secondary_item_id();
}
$rs_count = bp_activity_get_meta($activity_first_id, 'reshared_count');
$rs_count = !empty($rs_count) ? $rs_count : 0;
if ($bp->loggedin_user->id == bp_get_activity_user_id() || bp_reshare_user_did_reshared($activity_first_id)) {
$reshared_class = 'reshared';
}
$action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?to_reshare=' . $activity_first_id, '_reshare_update');
if ($_POST['scope'] == 'reshares' || bp_reshare_is_user_profile_reshares() || bp_is_activity_component() && !bp_displayed_user_id() && $_COOKIE['bp-activity-scope'] == 'reshares') {
$extra_class = 'unshare';
$action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?delete_reshare=' . bp_get_activity_id(), '_reshare_delete');
}
?>
<a href="<?php
echo $action_url;
?>
" class="button bp-primary-action bp-agu-reshare" id="bp-agu-reshare-<?php
bp_activity_id();
?>
" rel="<?php
echo $activity_first_id;
?>
"><span class="bp-agu-reshare-img <?php
echo $reshared_class . ' ' . $extra_class;
?>
"></span><span class="rs-count"><?php
echo $rs_count;
?>
</span></a>
<?php
}
示例4: 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;
}
示例5: 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());
?>
<!-- Delete -->
<?php
$owner = bp_get_activity_user_id() == $bp->loggedin_user->id;
?>
<?php
if (is_super_admin() || $bp->current_action != "just-me" && $bp->is_item_admin || $owner) {
?>
· <a href="<?php
echo wp_nonce_url($bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link');
?>
" class="delete acomment-delete confirm"><?php
_e('Delete', 'buddypress');
?>
</a>
<?php
示例6: build_html
function build_html()
{
// Store everything in an output buffer
ob_start();
?>
<div class="widget showcase-widget">
<header class="widget-header">
<h3 class="widget-title">Recent Discussion</h3>
</header>
<ul class="recent-discussion-list">
<?php
// Iterate topics
while (bp_activities()) {
bp_the_activity();
// Get the activity user
$user = new Apoc_User(bp_get_activity_user_id(), 'directory', 40);
// Get the activity type
$type = bp_get_activity_type();
// Format activity based on context
switch ($type) {
case 'bbp_topic_create':
$topic_id = bp_get_activity_item_id();
$link = '<a href="' . bbp_get_topic_permalink($topic_id) . '" title="Read topic" target="_blank">' . bbp_get_topic_title($topic_id) . '</a>';
$verb = 'created topic';
break;
case 'bbp_reply_create':
$reply_id = bp_get_activity_secondary_item_id();
$link = '<a href="' . bbp_get_topic_last_reply_url($reply_id) . '" title="Read reply" target="_blank">' . bbp_get_topic_title($reply_id) . '</a>';
$verb = 'replied to';
break;
case 'new_blog_comment':
$comment_id = bp_get_activity_secondary_item_id();
$comment = get_comment($comment_id);
$link = '<a href="' . get_comment_link($comment_id) . '" title="Read reply" target="_blank">' . get_the_title($comment->comment_post_ID) . '</a>';
$verb = 'commented on';
break;
}
// Get the activity time
$time = bp_core_time_since(bp_get_activity_date_recorded());
// Output the HTML
?>
<li class="recent-discussion double-border">
<?php
echo $user->avatar;
?>
<div class="recent-discussion-content">
<span class="recent-discussion-title"><?php
echo $user->link . ' ' . $verb . ' ' . $link;
?>
</span>
<span class="recent-discussion-time"><?php
echo $time;
?>
</div>
</li>
<?php
}
?>
</ul>
</div><?php
// Get the contents of the buffer
$html = ob_get_contents();
ob_end_clean();
// Return the html to the class
return $html;
}
示例7: GetBuddyPressRating
private function GetBuddyPressRating($ver, $horAlign = true)
{
RWLogger::LogEnterence('GetBuddyPressRating');
global $activities_template;
// Set current activity-comment to current activity update (recursive comments).
$this->current_comment = $activities_template->activity;
$rclass = str_replace('_', '-', bp_get_activity_type());
$is_forum_topic = $rclass === 'new-forum-topic';
if ($is_forum_topic && !$this->IsBBPressInstalled()) {
return false;
}
if (!in_array($rclass, array('forum-post', 'forum-reply', 'new-forum-post', 'user-forum-post', 'user', 'activity-update', 'user-activity-update', 'activity-comment', 'user-activity-comment'))) {
// If unknown activity type, change it to activity update.
$rclass = 'activity-update';
}
if ($is_forum_topic) {
$rclass = 'new-forum-post';
}
// Check if item rating is top positioned.
if (!isset($this->activity_align[$rclass]) || $ver !== $this->activity_align[$rclass]->ver) {
return false;
}
// Get item id.
$item_id = 'activity-update' === $rclass || 'activity-comment' === $rclass ? bp_get_activity_id() : bp_get_activity_secondary_item_id();
if ($is_forum_topic) {
// If forum topic, then we must extract post id
// from forum posts table, because secondary_item_id holds
// topic id.
if (function_exists('bb_get_first_post')) {
$post = bb_get_first_post($item_id);
} else {
// Extract post id straight from the BB DB.
global $bb_table_prefix;
// Load bbPress config file.
@(include_once WP_RW__BBP_CONFIG_LOCATION);
// Failed loading config file.
if (!defined('BBDB_NAME')) {
return false;
}
$connection = null;
if (!($connection = mysql_connect(BBDB_HOST, BBDB_USER, BBDB_PASSWORD, true))) {
return false;
}
if (!mysql_selectdb(BBDB_NAME, $connection)) {
return false;
}
$results = mysql_query("SELECT * FROM {$bb_table_prefix}posts WHERE topic_id={$item_id} AND post_position=1", $connection);
$post = mysql_fetch_object($results);
}
if (!isset($post->post_id) && empty($post->post_id)) {
return false;
}
$item_id = $post->post_id;
}
// If the item is post, queue rating with post title.
$title = 'new-blog-post' === $rclass ? get_the_title($item_id) : bp_get_activity_content_body();
// $activities_template->activity->content;
$options = array();
$owner_id = bp_get_activity_user_id();
// Add accumulator id if user accumulated rating.
if ($this->IsUserAccumulatedRating()) {
$options['uarid'] = $this->_getUserRatingGuid($owner_id);
}
return $this->EmbedRatingIfVisible($item_id, $owner_id, strip_tags($title), bp_activity_get_permalink(bp_get_activity_id()), $rclass, false, $horAlign ? $this->activity_align[$rclass]->hor : false, false, $options, false);
}
示例8: unpin_activity
//.........这里部分代码省略.........
echo $class;
?>
" title="<?php
echo $title;
?>
" data-post-nonces="<?php
echo $nonce;
?>
" data-post-id="<?php
echo bp_get_activity_id();
?>
"></a>
<?php
if (bp_activity_has_content() && bp_get_activity_type() != 'bbp_topic_create' && bp_get_activity_type() != 'bbp_reply_create') {
?>
<div class="activity-inner">
<?php
bp_activity_content_body();
?>
</div>
<?php
}
?>
<?php
if (bp_get_activity_type() == 'bp_doc_edited') {
?>
<div class="activity-inner"><p>
<?php
$doc = get_post(url_to_postid(bp_get_activity_feed_item_link()));
echo __('Doc: ', RW_Sticky_Activity::$textdomain);
echo "<a href='" . get_permalink($doc->ID) . "'>";
echo $doc->post_title;
echo "</a>";
?>
</p>
</div>
<?php
}
// New forum topic created
if (bp_get_activity_type() == 'bbp_topic_create') {
// url_to_postid fails on permalinks like http://gruppen.domain.tld/groups/frank-testgruppe/forum/topic/neues-thema/ !!!
?>
<div class="activity-inner"><p>
<?php
$link = bp_get_activity_feed_item_link();
$guid = substr($link, strpos($link, "/forum/topic") + 6);
$topicid = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid like '%%%s%%'", $guid));
$topic = get_post($topicid);
echo __('Forum new topic: ', RW_Sticky_Activity::$textdomain);
echo "<a href='" . get_permalink($topic->ID) . "'> ";
echo $topic->post_title;
echo "</a><br>";
?>
</p>
</div>
<?php
}
// New forum reply
if (bp_get_activity_type() == 'bbp_reply_create') {
// url_to_postid fails on permalinks like http://gruppen.domain.tld/groups/frank-testgruppe/forum/topic/neues-thema/ !!!
?>
<div class="activity-inner"><p>
<?php
$link = bp_get_activity_feed_item_link();
$id = substr($link, strpos($link, "/#post-") + 7);
$topic = get_post($id);
echo __('Forum reply: ', RW_Sticky_Activity::$textdomain);
echo "<a href='" . get_permalink($topic->ID) . "'> ";
$parent = get_post($topic->post_parent);
echo $parent->post_title;
echo "</a><br>";
?>
</p>
</div>
<?php
}
?>
<div class="activity-header">
<?php
$userid = bp_get_activity_user_id();
$user = get_user_by('id', $userid);
echo "(" . $user->nickname . ")";
?>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php
}
if (function_exists('bb_bp_activity_url_filter')) {
// activate BuddyBoss Wall activity url preview
add_action('bp_get_activity_content_body', 'bb_bp_activity_url_filter');
}
wp_die();
}
示例9: bp_activity_user_id
/**
* Outputs the activity user id
*
* @since 1.1.0
*
* @uses bp_get_activity_user_id()
*/
function bp_activity_user_id()
{
echo bp_get_activity_user_id();
}
示例10: bp_dtheme_new_activity_comment
function bp_dtheme_new_activity_comment() {
global $bp;
/* Check the nonce */
check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
if ( !is_user_logged_in() ) {
echo '-1';
return false;
}
if ( empty( $_POST['content'] ) ) {
echo '-1<div id="message" class="error"><p>' . __( 'Please do not leave the comment area blank.', 'buddypress' ) . '</p></div>';
return false;
}
if ( empty( $_POST['form_id'] ) || empty( $_POST['comment_id'] ) || !is_numeric( $_POST['form_id'] ) || !is_numeric( $_POST['comment_id'] ) ) {
echo '-1<div id="message" class="error"><p>' . __( 'There was an error posting that reply, please try again.', 'buddypress' ) . '</p></div>';
return false;
}
$comment_id = bp_activity_new_comment( array(
'content' => $_POST['content'],
'activity_id' => $_POST['form_id'],
'parent_id' => $_POST['comment_id']
));
if ( !$comment_id ) {
echo '-1<div id="message" class="error"><p>' . __( 'There was an error posting that reply, please try again.', 'buddypress' ) . '</p></div>';
return false;
}
if ( bp_has_activities ( 'include=' . $comment_id ) ) : ?>
<?php while ( bp_activities() ) : bp_the_activity(); ?>
<li id="acomment-<?php bp_activity_id() ?>">
<div class="acomment-avatar">
<?php bp_activity_avatar() ?>
</div>
<div class="acomment-meta">
<?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> · <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?> ·
<a class="acomment-reply" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo esc_attr( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ) ?></a>
· <a href="<?php echo wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm"><?php _e( 'Delete', 'buddypress' ) ?></a>
</div>
<div class="acomment-content">
<?php bp_activity_content_body() ?>
</div>
</li>
<?php endwhile; ?>
<?php endif;
}
示例11: bp_activity_avatar
?>
">
<?php
bp_activity_avatar('type=thumb&width=30&height=30');
?>
</a>
</div>
<div class="activity-content">
<div class="activity-header">
<?php
echo bpgr_get_review_rating_html(bp_activity_get_meta(bp_get_activity_id(), 'bpgr_rating'));
?>
<?php
printf(__('By %s', 'bpgr'), bp_core_get_userlink(bp_get_activity_user_id()));
?>
(<?php
printf(__('%s ago', 'bpgr'), bp_core_time_since(bp_get_activity_date_recorded()));
?>
) <a href="<?php
echo site_url(BP_ACTIVITY_SLUG . '/p/' . bp_get_activity_id() . '/');
?>
"><?php
_e('#', 'bpgr');
?>
</a>
</div>
<?php
if (bp_activity_has_content()) {
示例12: GetBuddyPressRating
private function GetBuddyPressRating($ver, $horAlign = true)
{
if (RWLogger::IsOn()) {
$params = func_get_args();
RWLogger::LogEnterence("GetBuddyPressRating", $params);
}
global $activities_template;
// Set current activity-comment to current activity update (recursive comments).
$this->current_comment = $activities_template->activity;
$rclass = str_replace("_", "-", bp_get_activity_type());
$is_forum_topic = $rclass === "new-forum-topic";
if ($is_forum_topic && !$this->IsBBPressInstalled()) {
return false;
}
if ($is_forum_topic) {
$rclass = "new-forum-post";
}
// Check if item rating is top positioned.
if (!isset($this->activity_align[$rclass]) || $ver !== $this->activity_align[$rclass]->ver) {
return false;
}
// Get item id.
$item_id = "activity-update" === $rclass || "activity-comment" === $rclass ? bp_get_activity_id() : bp_get_activity_secondary_item_id();
if ($is_forum_topic) {
// If forum topic, then we must extract post id
// from forum posts table, because secondary_item_id holds
// topic id.
if (function_exists("bb_get_first_post")) {
$post = bb_get_first_post($item_id);
} else {
// Extract post id straight from the BB DB.
global $bb_table_prefix;
// Load bbPress config file.
@(include_once WP_RW__BBP_CONFIG_LOCATION);
// Failed loading config file.
if (!defined("BBDB_NAME")) {
return false;
}
$connection = null;
if (!($connection = mysql_connect(BBDB_HOST, BBDB_USER, BBDB_PASSWORD, true))) {
return false;
}
if (!mysql_selectdb(BBDB_NAME, $connection)) {
return false;
}
$results = mysql_query("SELECT * FROM {$bb_table_prefix}posts WHERE topic_id={$item_id} AND post_position=1", $connection);
$post = mysql_fetch_object($results);
}
if (!isset($post->post_id) && empty($post->post_id)) {
return false;
}
$item_id = $post->post_id;
}
// If the item is post, queue rating with post title.
$title = "new-blog-post" === $rclass ? get_the_title($item_id) : bp_get_activity_content_body();
// $activities_template->activity->content;
$options = array();
$owner_id = bp_get_activity_user_id();
// Add accumulator id if user accumulated rating.
if ($this->IsUserAccumulatedRating()) {
$options['uarid'] = $this->_getUserRatingGuid($owner_id);
}
return $this->EmbedRatingIfVisible($item_id, $owner_id, strip_tags($title), bp_activity_get_permalink(bp_get_activity_id()), $rclass, false, $horAlign ? $this->activity_align[$rclass]->hor : false, false, $options, false);
/*
// Queue activity rating.
$this->QueueRatingData($urid, strip_tags($title), bp_activity_get_permalink($activities_template->activity->id), $rclass);
// Return rating html container.
return '<div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $urid . '"></div>';*/
}
示例13: Apoc_User
<?php
/**
* Apocrypha Theme Single Activity Entry
* Andrew Clayton
* Version 2.0
* 9-20-2014
*/
// Get the user info
$user = new Apoc_User(bp_get_activity_user_id(), 'directory', 60);
?>
<li id="activity-<?php
bp_activity_id();
?>
" class="<?php
bp_activity_css_class();
?>
directory-entry">
<div class="directory-member reply-author">
<?php
echo $user->block;
?>
</div>
<div class="directory-content">
<header class="activity-header">