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


PHP bp_activity_get_specific函数代码示例

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


在下文中一共展示了bp_activity_get_specific函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_like_post_to_stream

/**
 * bp_like_post_to_stream()
 * 
 * Posts to stream, depending on settings
 * 
 * TODO, Should we be posted that people like comments to the feed? This can get messy..
 * Also no point having 20 posts saying people liked the same status..
 * 
 */
function bp_like_post_to_stream($item_id, $user_id)
{
    if (bp_like_get_settings('post_to_activity_stream') == 1) {
        $activity = bp_activity_get_specific(array('activity_ids' => $item_id, 'component' => 'buddypress-like'));
        $author_id = $activity['activities'][0]->user_id;
        if ($user_id == $author_id) {
            $action = bp_like_get_text('record_activity_likes_own');
        } elseif ($user_id == 0) {
            $action = bp_like_get_text('record_activity_likes_an');
        } else {
            $action = bp_like_get_text('record_activity_likes_users');
        }
        $liker = bp_core_get_userlink($user_id);
        $author = bp_core_get_userlink($author_id);
        $activity_url = bp_activity_get_permalink($item_id);
        $content = '';
        //content must be defined...
        /* Grab the content and make it into an excerpt of 140 chars if we're allowed */
        if (bp_like_get_settings('show_excerpt') == 1) {
            $content = $activity['activities'][0]->content;
            if (strlen($content) > bp_like_get_settings('excerpt_length')) {
                $content = substr($content, 0, bp_like_get_settings('excerpt_length'));
                $content = strip_tags($content);
                $content = $content . '...';
            }
        }
        /* Filter out the placeholders */
        $action = str_replace('%user%', $liker, $action);
        $action = str_replace('%permalink%', $activity_url, $action);
        $action = str_replace('%author%', $author, $action);
        bp_activity_add(array('action' => $action, 'content' => $content, 'primary_link' => $activity_url, 'component' => 'bp-like', 'type' => 'activity_liked', 'user_id' => $user_id, 'item_id' => $item_id));
    }
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:42,代码来源:activity-functions.php

示例2: buddyreshare_ajax_delete_reshare

/**
 * Catches an activity to delete if js is enabled
 *
 * @package BP Reshare
 * @since    1.0
 *
 * @uses  check_ajax_referer() for security reasons
 * @uses  bp_activity_get_specific() to fetch the activity to delete
 * @uses  buddyreshare_reset_metas() to reset some metas for the parent activity
 * @uses  bp_activity_delete() to delete the reshare
 */
function buddyreshare_ajax_delete_reshare()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    check_ajax_referer('buddyreshare_delete', 'nonce');
    $response = array('result' => 'error', 'message' => __('OOps, error while trying to delete your reshare..', 'bp-reshare'));
    $reshare_id = intval($_POST['activity']);
    if (empty($reshare_id)) {
        $response['message'] = __('The reshare was not found.', 'bp-reshare');
        exit(json_encode($response));
    }
    $reshare_to_delete = bp_activity_get_specific(array('activity_ids' => $reshare_id));
    if (empty($reshare_to_delete)) {
        $response['message'] = __('The reshare was not found.', 'bp-reshare');
        exit(json_encode($response));
    }
    $reshare = $reshare_to_delete['activities'][0];
    $reset = buddyreshare_reset_metas($reshare->secondary_item_id, $reshare->user_id);
    if (empty($reset)) {
        $response['message'] = __('Unable to reset the properties of the reshared activity', 'bp-reshare');
        exit(json_encode($response));
    }
    $deleted_reshare = bp_activity_delete(array('type' => 'reshare_update', 'id' => $reshare_id));
    if (!empty($deleted_reshare)) {
        do_action('buddyreshare_reshare_deleted', $reshare_id);
        $response['result'] = 'success';
        $response['message'] = __('Reshare successfully deleted.', 'bp-reshare');
    } else {
        do_action('buddyreshare_reshare_deleted_error', $reshare_id);
    }
    exit(json_encode($response));
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:45,代码来源:ajax.php

示例3: bp_activity_action_permalink_router

/**
 * Catch and route requests for single activity item permalinks.
 *
 * @since 1.2.0
 *
 * @uses bp_is_activity_component()
 * @uses bp_is_current_action()
 * @uses bp_action_variable()
 * @uses bp_activity_get_specific()
 * @uses bp_is_active()
 * @uses bp_core_get_user_domain()
 * @uses groups_get_group()
 * @uses bp_get_group_permalink()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook.
 * @uses bp_core_redirect()
 * @uses bp_get_root_domain()
 *
 * @return bool False on failure.
 */
function bp_activity_action_permalink_router()
{
    // Not viewing activity.
    if (!bp_is_activity_component() || !bp_is_current_action('p')) {
        return false;
    }
    // No activity to display.
    if (!bp_action_variable(0) || !is_numeric(bp_action_variable(0))) {
        return false;
    }
    // Get the activity details.
    $activity = bp_activity_get_specific(array('activity_ids' => bp_action_variable(0), 'show_hidden' => true));
    // 404 if activity does not exist
    if (empty($activity['activities'][0])) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Do not redirect at default.
    $redirect = false;
    // Redirect based on the type of activity.
    if (bp_is_active('groups') && $activity->component == buddypress()->groups->id) {
        // Activity is a user update.
        if (!empty($activity->user_id)) {
            $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
            // Activity is something else.
        } else {
            // Set redirect to group activity stream.
            if ($group = groups_get_group(array('group_id' => $activity->item_id))) {
                $redirect = bp_get_group_permalink($group) . bp_get_activity_slug() . '/' . $activity->id . '/';
            }
        }
        // Set redirect to users' activity stream.
    } elseif (!empty($activity->user_id)) {
        $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
    }
    // If set, add the original query string back onto the redirect URL.
    if (!empty($_SERVER['QUERY_STRING'])) {
        $query_frags = array();
        wp_parse_str($_SERVER['QUERY_STRING'], $query_frags);
        $redirect = add_query_arg(urlencode_deep($query_frags), $redirect);
    }
    /**
     * Filter the intended redirect url before the redirect occurs for the single activity item.
     *
     * @since 1.2.2
     *
     * @param array $value Array with url to redirect to and activity related to the redirect.
     */
    if (!($redirect = apply_filters_ref_array('bp_activity_permalink_redirect_url', array($redirect, &$activity)))) {
        bp_core_redirect(bp_get_root_domain());
    }
    // Redirect to the actual activity permalink page.
    bp_core_redirect($redirect);
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:75,代码来源:bp-activity-actions.php

示例4: bp_reshare_prepare_reshare

function bp_reshare_prepare_reshare($activity_id)
{
    global $bp;
    $activity_to_reshare = bp_activity_get_specific('activity_ids=' . $activity_id);
    $activity = $activity_to_reshare['activities'][0];
    /* get and increment reshared count */
    $rs_count = bp_activity_get_meta($activity_id, 'reshared_count');
    $rs_count = !empty($rs_count) ? (int) $rs_count + 1 : 1;
    bp_activity_update_meta($activity_id, 'reshared_count', $rs_count);
    /* get an array of users that reshared the activity */
    $reshared_by = bp_activity_get_meta($activity_id, 'reshared_by');
    if (is_array($reshared_by) && !in_array($bp->loggedin_user->id, $reshared_by)) {
        $reshared_by[] = $bp->loggedin_user->id;
    } else {
        $reshared_by[] = $bp->loggedin_user->id;
    }
    bp_activity_update_meta($activity_id, 'reshared_by', $reshared_by);
    $secondary_avatar = bp_core_fetch_avatar(array('item_id' => $activity->user_id, 'object' => 'user', 'type' => 'thumb', 'alt' => $alt, 'class' => 'avatar', 'width' => 20, 'height' => 20));
    $component = $activity->component;
    $item_id = $activity->item_id;
    if ($component != 'activity') {
        if ($activity->type == 'new_blog_post') {
            $action = sprintf(__('%s reshared a <a href="%s">blog post</a> originally posted by %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id));
        } else {
            if ($activity->type == 'new_blog_comment') {
                $action = sprintf(__('%s reshared a <a href="%s">comment</a> originally posted by %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id));
            } else {
                if ($component == 'groups') {
                    $group = groups_get_group(array('group_id' => $item_id));
                    $group_link = '<a href="' . bp_get_group_permalink($group) . '">' . $group->name . '</a>';
                    if ($activity->type == 'new_forum_topic') {
                        $action = sprintf(__('%s reshared a <a href="%s">forum topic</a> originally posted by %s in the group %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
                    } else {
                        if ($activity->type == 'new_forum_post') {
                            $action = sprintf(__('%s reshared a <a href="%s">forum reply</a> originally posted by %s in the group %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
                        } else {
                            $action = sprintf(__("%s reshared an activity originally shared by %s in the group %s", 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
                        }
                    }
                }
            }
        }
    } else {
        $action = sprintf(__("%s reshared an activity originally shared by %s", 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $secondary_avatar . bp_core_get_userlink($activity->user_id));
    }
    $reshared_args = array('action' => apply_filters('bp_reshare_action_parent_activity', $action, $activity->type), 'content' => $activity->content, 'component' => $component, 'type' => 'reshare_update', 'user_id' => $bp->loggedin_user->id, 'secondary_item_id' => $activity_id, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => $activity->hide_sitewide);
    if (!empty($item_id)) {
        $reshared_args['item_id'] = $item_id;
    }
    return apply_filters('bp_reshare_prepare_reshare', $reshared_args, $activity_id);
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:51,代码来源:bp-reshare-functions.php

示例5: bp_activity_action_permalink_router

/**
 * Allow core components and dependent plugins to register activity actions
 *
 * @since BuddyPress (1.2)
 *
 * @global object $bp BuddyPress global settings
 * @uses bp_is_activity_component()
 * @uses bp_is_current_action()
 * @uses bp_action_variable()
 * @uses bp_activity_get_specific()
 * @uses bp_is_active()
 * @uses bp_core_get_user_domain()
 * @uses groups_get_group()
 * @uses bp_get_group_permalink()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook
 * @uses bp_core_redirect()
 * @uses bp_get_root_domain()
 *
 * @return bool False on failure
 */
function bp_activity_action_permalink_router()
{
    global $bp;
    // Not viewing activity
    if (!bp_is_activity_component() || !bp_is_current_action('p')) {
        return false;
    }
    // No activity to display
    if (!bp_action_variable(0) || !is_numeric(bp_action_variable(0))) {
        return false;
    }
    // Get the activity details
    $activity = bp_activity_get_specific(array('activity_ids' => bp_action_variable(0), 'show_hidden' => true));
    // 404 if activity does not exist
    if (empty($activity['activities'][0])) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Do not redirect at default
    $redirect = false;
    // Redirect based on the type of activity
    if (bp_is_active('groups') && $activity->component == $bp->groups->id) {
        // Activity is a user update
        if (!empty($activity->user_id)) {
            $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
            // Activity is something else
        } else {
            // Set redirect to group activity stream
            if ($group = groups_get_group(array('group_id' => $activity->item_id))) {
                $redirect = bp_get_group_permalink($group) . bp_get_activity_slug() . '/' . $activity->id . '/';
            }
        }
        // Set redirect to users' activity stream
    } else {
        $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
    }
    // If set, add the original query string back onto the redirect URL
    if (!empty($_SERVER['QUERY_STRING'])) {
        $query_frags = array();
        wp_parse_str($_SERVER['QUERY_STRING'], $query_frags);
        $redirect = add_query_arg(urlencode_deep($query_frags), $redirect);
    }
    // Allow redirect to be filtered
    if (!($redirect = apply_filters_ref_array('bp_activity_permalink_redirect_url', array($redirect, &$activity)))) {
        bp_core_redirect(bp_get_root_domain());
    }
    // Redirect to the actual activity permalink page
    bp_core_redirect($redirect);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:71,代码来源:bp-activity-actions.php

示例6: bp_reshare_ajax_delete_reshare

function bp_reshare_ajax_delete_reshare()
{
    check_ajax_referer('_reshare_delete', 'nonce');
    $reshare_id = intval($_POST['activity']);
    $reshare_to_delete = bp_activity_get_specific('activity_ids=' . $reshare_id);
    $reshare = $reshare_to_delete['activities'][0];
    bp_reshare_delete($reshare->secondary_item_id, $reshare->user_id);
    $deleted_reshare = bp_activity_delete(array('type' => 'reshare_update', 'id' => $reshare_id));
    if ($deleted_reshare) {
        echo '1';
    } else {
        _e('OOps, error while trying to delete your reshare..', 'bp-reshare');
    }
    die;
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:15,代码来源:bp-reshare-ajax.php

示例7: bp_reshare_delete_reshare

/**
* let's delete reshare update if js is disabled
*/
function bp_reshare_delete_reshare()
{
    if (!empty($_GET['delete_reshare']) && is_numeric($_GET['delete_reshare'])) {
        check_admin_referer('_reshare_delete');
        $redirect = remove_query_arg(array('delete_reshare', '_wpnonce'), wp_get_referer());
        $reshare_id = intval($_GET['delete_reshare']);
        $reshare_to_delete = bp_activity_get_specific('activity_ids=' . $reshare_id);
        $reshare = $reshare_to_delete['activities'][0];
        bp_reshare_delete($reshare->secondary_item_id, $reshare->user_id);
        $deleted_reshare = bp_activity_delete(array('type' => 'reshare_update', 'id' => $reshare_id));
        if (!empty($deleted_reshare)) {
            do_action('bp_reshare_handle_nojs_deleted', $reshare_id);
            bp_core_add_message(__('Reshare deleted !', 'bp-reshare'));
            bp_core_redirect($redirect);
        } else {
            do_action('bp_reshare_handle_nojs_missed', $reshare_id);
            bp_core_add_message(__('OOps, error while trying to reshare..', 'bp-reshare'), 'error');
            bp_core_redirect($redirect);
        }
    }
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:24,代码来源:bp-reshare-actions.php

示例8: bp_activity_get_user_favorites

function bp_activity_get_user_favorites( $user_id ) {
	$my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
	$existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs ) );

	foreach( (array)$existing_favs['activities'] as $fav )
		$new_favs[] = $fav->id;

	$new_favs = array_unique( (array)$new_favs );
	update_user_meta( $user_id, 'bp_favorite_activities', $new_favs );

	return apply_filters( 'bp_activity_get_user_favorites', $new_favs );
}
开发者ID:n-sane,项目名称:zaroka,代码行数:12,代码来源:bp-activity.php

示例9: bp_dtheme_get_single_activity_content

/**
 * Fetches full an activity's full, non-excerpted content via a POST request.
 * Used for the 'Read More' link on long activity items.
 *
 * @return string HTML
 * @since BuddyPress (1.5)
 */
function bp_dtheme_get_single_activity_content()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    $activity_array = bp_activity_get_specific(array('activity_ids' => $_POST['activity_id'], 'display_comments' => 'stream'));
    $activity = !empty($activity_array['activities'][0]) ? $activity_array['activities'][0] : false;
    if (empty($activity)) {
        exit;
    }
    // @todo: error?
    do_action_ref_array('bp_dtheme_get_single_activity_content', array(&$activity));
    // Activity content retrieved through AJAX should run through normal filters, but not be truncated
    remove_filter('bp_get_activity_content_body', 'bp_activity_truncate_entry', 5);
    $content = apply_filters('bp_get_activity_content_body', $activity->content);
    exit($content);
}
开发者ID:raminjan,项目名称:logicalbones_hug,代码行数:25,代码来源:ajax.php

示例10: bp_rbe_log_last_activity

/**
 * When posting via email, we also update the last activity entries in BuddyPress.
 *
 * This is so your BuddyPress site doesn't look dormant when your members
 * are emailing each other back and forth! :)
 *
 * @param array $args Depending on the filter that this function is hooked into, contents will vary
 * @since 1.0-RC1
 */
function bp_rbe_log_last_activity($args)
{
    // get user id from activity entry
    if (!empty($args['user_id'])) {
        $user_id = $args['user_id'];
    } elseif (!empty($args['sender_id'])) {
        $user_id = $args['sender_id'];
    } else {
        $user_id = false;
    }
    // if no user ID, return now
    if (empty($user_id)) {
        return;
    }
    // update user's last activity
    bp_update_user_last_activity($user_id);
    // now update 'last_activity' group meta entry if applicable
    if (!empty($args['type'])) {
        switch ($args['type']) {
            case 'new_forum_topic':
            case 'new_forum_post':
            case 'bbp_topic_create':
            case 'bbp_reply_create':
                // sanity check!
                if (!bp_is_active('groups')) {
                    return;
                }
                groups_update_last_activity($args['item_id']);
                break;
                // for group activity comments, we have to look up the parent activity to see
                // if the activity comment came from a group
            // for group activity comments, we have to look up the parent activity to see
            // if the activity comment came from a group
            case 'activity_comment':
                // we don't need to proceed if the groups component was disabled
                if (!bp_is_active('groups')) {
                    return;
                }
                // sanity check!
                if (!bp_is_active('activity')) {
                    return;
                }
                // grab the parent activity
                $activity = bp_activity_get_specific('activity_ids=' . $args['item_id']);
                if (!empty($activity['activities'][0])) {
                    $parent_activity = $activity['activities'][0];
                    // if parent activity update is from the groups component,
                    // that means the activity comment was in a group!
                    // so update group 'last_activity' meta entry
                    if ($parent_activity->component == 'groups') {
                        groups_update_last_activity($parent_activity->item_id);
                    }
                }
                break;
        }
    }
}
开发者ID:r-a-y,项目名称:bp-reply-by-email,代码行数:66,代码来源:bp-rbe-functions.php

示例11: get_activity_id

 /**
  * Check for an existing activity stream entry for a given post_id
  *
  * @param int $post_id ID of the topic or reply
  * @uses get_post_meta()
  * @uses bp_activity_get_specific()
  * @return int if an activity id is verified, false if not
  */
 private static function get_activity_id($post_id = 0)
 {
     // Try to get the activity ID of the post
     $activity_id = (int) get_post_meta($post_id, '_bbp_activity_id', true);
     // Bail if no activity ID is in post meta
     if (empty($activity_id)) {
         return null;
     }
     // Get the activity stream item, bail if it doesn't exist
     $existing = bp_activity_get_specific(array('activity_ids' => $activity_id, 'show_hidden' => true, 'spam' => 'all'));
     if (empty($existing['total']) || 1 != $existing['total']) {
         return null;
     }
     // Return the activity ID since we've verified the connection
     return $activity_id;
 }
开发者ID:hscale,项目名称:webento,代码行数:24,代码来源:activity.php

示例12: get_activity_user_id

 /**
  * Get the user id associated with a given activity item.
  *
  * Wraps bp_activity_get_specific(), with some additional logic for
  * avoiding duplicate queries.
  *
  * @since BuddyPress (1.6.0)
  *
  * @param int $activity_id Activity ID to retrieve User ID for.
  *
  * @return int User ID of the activity item in question.
  */
 protected function get_activity_user_id($activity_id)
 {
     // If there is an existing activity/user ID mapping, just return the user ID.
     if (!empty($this->activity_user_id[$activity_id])) {
         return $this->activity_user_id[$activity_id];
         /**
          * We don't have a mapping. This means the $activity_id is not on the current
          * page of results, so fetch its details from the database.
          */
     } else {
         $activity = bp_activity_get_specific(array('activity_ids' => $activity_id, 'show_hidden' => true, 'spam' => 'all'));
         /**
          * If, somehow, the referenced activity has been deleted, leaving its associated
          * activities as orphans, use the logged in user's ID to avoid errors.
          */
         if (empty($activity['activities'])) {
             return bp_loggedin_user_id();
         }
         // Store the new activity/user ID mapping for any later re-use
         $this->activity_user_id[$activity['activities'][0]->id] = $activity['activities'][0]->user_id;
         // Return the user ID
         return $activity['activities'][0]->user_id;
     }
 }
开发者ID:un1coin,项目名称:ovn-space,代码行数:36,代码来源:bp-activity-admin.php

示例13: bp_dtheme_get_single_activity_content

/**
 * AJAX handler for Read More link on long activity items
 *
 * @package BuddyPress
 * @since 1.5
 */
function bp_dtheme_get_single_activity_content()
{
    $activity_array = bp_activity_get_specific(array('activity_ids' => $_POST['activity_id'], 'display_comments' => 'stream'));
    $activity = !empty($activity_array['activities'][0]) ? $activity_array['activities'][0] : false;
    if (!$activity) {
        exit;
    }
    // todo: error?
    // Activity content retrieved through AJAX should run through normal filters, but not be
    // truncated
    remove_filter('bp_get_activity_content_body', 'bp_activity_truncate_entry', 5);
    $content = apply_filters('bp_get_activity_content_body', $activity->content);
    echo $content;
    exit;
}
开发者ID:hscale,项目名称:webento,代码行数:21,代码来源:ajax.php

示例14: __construct

 function __construct($page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden, $exclude = false, $in = false)
 {
     global $bp;
     $this->pag_page = isset($_REQUEST['acpage']) ? intval($_REQUEST['acpage']) : $page;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     // Check if blog/forum replies are disabled
     $this->disable_blogforum_replies = isset($bp->site_options['bp-disable-blogforum-comments']) ? $bp->site_options['bp-disable-blogforum-comments'] : false;
     // Get an array of the logged in user's favorite activities
     $this->my_favs = maybe_unserialize(bp_get_user_meta($bp->loggedin_user->id, 'bp_favorite_activities', true));
     // Fetch specific activity items based on ID's
     if (!empty($include)) {
         $this->activities = bp_activity_get_specific(array('activity_ids' => explode(',', $include), 'max' => $max, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments, 'show_hidden' => $show_hidden));
     } else {
         $this->activities = bp_activity_get(array('display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in));
     }
     if (!$max || $max >= (int) $this->activities['total']) {
         $this->total_activity_count = (int) $this->activities['total'];
     } else {
         $this->total_activity_count = (int) $max;
     }
     $this->activities = $this->activities['activities'];
     if ($max) {
         if ($max >= count($this->activities)) {
             $this->activity_count = count($this->activities);
         } else {
             $this->activity_count = (int) $max;
         }
     } else {
         $this->activity_count = count($this->activities);
     }
     $this->full_name = $bp->displayed_user->fullname;
     // Fetch parent content for activity comments so we do not have to query in the loop
     foreach ((array) $this->activities as $activity) {
         if ('activity_comment' != $activity->type) {
             continue;
         }
         $parent_ids[] = $activity->item_id;
     }
     if (!empty($parent_ids)) {
         $activity_parents = bp_activity_get_specific(array('activity_ids' => $parent_ids));
     }
     if (!empty($activity_parents['activities'])) {
         foreach ($activity_parents['activities'] as $parent) {
             $this->activity_parents[$parent->id] = $parent;
         }
         unset($activity_parents);
     }
     if ((int) $this->total_activity_count && (int) $this->pag_num) {
         $this->pag_links = paginate_links(array('base' => add_query_arg('acpage', '%#%'), 'format' => '', 'total' => ceil((int) $this->total_activity_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => _x('&larr;', 'Activity pagination previous text', 'buddypress'), 'next_text' => _x('&rarr;', 'Activity pagination next text', 'buddypress'), 'mid_size' => 1));
     }
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:51,代码来源:bp-activity-template.php

示例15: bp_legacy_theme_get_single_activity_content

/**
 * Fetches an activity's full, non-excerpted content via a POST request.
 * Used for the 'Read More' link on long activity items.
 *
 * @return string HTML
 * @since BuddyPress (1.5)
 */
function bp_legacy_theme_get_single_activity_content()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    $activity_array = bp_activity_get_specific(array('activity_ids' => $_POST['activity_id'], 'display_comments' => 'stream'));
    $activity = !empty($activity_array['activities'][0]) ? $activity_array['activities'][0] : false;
    if (empty($activity)) {
        exit;
    }
    // @todo: error?
    /**
     * Fires before the return of an activity's full, non-excerpted content via a POST request.
     *
     * @since BuddyPress (1.7.0)
     *
     * @param string $activity Activity content. Passed by reference.
     */
    do_action_ref_array('bp_legacy_theme_get_single_activity_content', array(&$activity));
    // Activity content retrieved through AJAX should run through normal filters, but not be truncated
    remove_filter('bp_get_activity_content_body', 'bp_activity_truncate_entry', 5);
    /** This filter is documented in bp-activity/bp-activity-template.php */
    $content = apply_filters('bp_get_activity_content_body', $activity->content);
    exit($content);
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:33,代码来源:buddypress-functions.php


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