本文整理汇总了PHP中bp_core_get_userlink函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_get_userlink函数的具体用法?PHP bp_core_get_userlink怎么用?PHP bp_core_get_userlink使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_get_userlink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_gtm_email_notify
function bp_gtm_email_notify()
{
global $bp;
// Get user data
$reciever_name = bp_core_get_user_displayname($_GET['resp_id'], false);
$reciever_ud = get_userdata($_GET['resp_id']);
$sender_name = bp_core_get_user_displayname($bp->loggedin_user->id, false);
$sender_link = bp_core_get_userlink($bp->loggedin_user->id, false, true);
// Lunks to use in email
$reciever_personal_tasks_link = site_url(BP_MEMBERS_SLUG . '/' . $reciever_ud->user_login . '/' . $bp->gtm->slug . '/tasks');
$reciever_personal_projects_link = site_url(BP_MEMBERS_SLUG . '/' . $reciever_ud->user_login . '/' . $bp->gtm->slug . '/projects');
/* Set up and send the message */
$to = $reciever_ud->user_email;
$subject = get_blog_option(1, 'blogname') . ': ' . __('Assignments');
$message = sprintf(__('Hello there %s,
%s (%s) reminds you, that pending tasks and projects you are responsible for need to be done.
To see your personal tasks click here: %s
To see your personal projects click here: %s
---------------------
%s. %s
', 'bp_gtm'), $reciever_name, $sender_name, $sender_link, $reciever_personal_tasks_link, $reciever_personal_projects_link, get_blog_option(1, 'blogname'), get_blog_option(1, 'blogdescription'));
// Send it!
wp_mail($to, $subject, $message);
echo 'sent!';
}
示例2: block_message
function block_message($message_info)
{
global $bp;
$recipients = $message_info->recipients;
foreach ($recipients as $key => $recipient) {
// if site admin, skip check
if ($bp->loggedin_user->is_site_admin == 1) {
continue;
}
// make sure sender is not trying to send to themselves
if ($recipient->user_id == $bp->loggedin_user->id) {
unset($message_info->recipients[$key]);
continue;
}
// check if the attempted recipient is block user
// if we get a match, remove person from recipient list
if ($this->check_blocking($bp->loggedin_user->id, $recipient->user_id)) {
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
//if ajax - just unset
unset($message_info->recipients[$key]);
} else {
wp_redirect(bp_core_get_userlink($recipient->user_id, false, true));
exit;
}
}
}
}
示例3: bp_group_documents_record_delete
function bp_group_documents_record_delete($document)
{
global $bp;
$params = array('action' => sprintf(__('%s deleted the file: %s from %s', 'bp-group-documents'), bp_core_get_userlink($bp->loggedin_user->id), $document->name, '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_attr($bp->groups->current_group->name) . '</a>'), 'component_action' => 'deleted_group_document', 'secondary_item_id' => $document->id);
bp_group_documents_record_activity($params);
do_action('bp_group_documents_record_delete', $document);
}
示例4: populate
/**
* populate()
*
* Populate the instantiated class with data based on the User ID provided.
*
* @package BuddyPress Core
* @global $userdata WordPress user data for the current logged in user.
* @uses bp_core_get_userurl() Returns the URL with no HTML markup for a user based on their user id
* @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text
* @uses bp_core_get_user_email() Returns the email address for the user based on user ID
* @uses get_user_meta() WordPress function returns the value of passed usermeta name from usermeta table
* @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
* @uses bp_profile_last_updated_date() Returns the last updated date for a user.
*/
function populate() {
if ( function_exists( 'xprofile_install' ) )
$this->profile_data = $this->get_profile_data();
if ( $this->profile_data ) {
$this->user_url = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] );
$this->fullname = esc_attr( $this->profile_data[BP_XPROFILE_FULLNAME_FIELD_NAME]['field_data'] );
$this->user_link = "<a href='{$this->user_url}' title='{$this->fullname}'>{$this->fullname}</a>";
$this->email = esc_attr( $this->profile_data['user_email'] );
} else {
$this->user_url = bp_core_get_user_domain( $this->id );
$this->user_link = bp_core_get_userlink( $this->id );
$this->fullname = esc_attr( bp_core_get_user_displayname( $this->id ) );
$this->email = esc_attr( bp_core_get_user_email( $this->id ) );
}
/* Cache a few things that are fetched often */
wp_cache_set( 'bp_user_fullname_' . $this->id, $this->fullname, 'bp' );
wp_cache_set( 'bp_user_email_' . $this->id, $this->email, 'bp' );
wp_cache_set( 'bp_user_url_' . $this->id, $this->user_url, 'bp' );
$this->avatar = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'full' ) );
$this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) );
$this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) );
$this->last_active = bp_core_get_last_activity( get_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );
}
示例5: 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));
}
}
示例6: messages_ajax_send_reply
function messages_ajax_send_reply()
{
global $bp;
check_ajax_referer('messages_send_message');
$result = messages_send_message($_REQUEST['send_to'], $_REQUEST['subject'], $_REQUEST['content'], $_REQUEST['thread_id'], true, false, true);
if ($result['status']) {
?>
<div class="avatar-box">
<?php
if (function_exists('bp_core_get_avatar')) {
echo bp_core_get_avatar($result['reply']->sender_id, 1);
}
?>
<h3><?php
echo bp_core_get_userlink($result['reply']->sender_id);
?>
</h3>
<small><?php
echo bp_format_time($result['reply']->date_sent);
?>
</small>
</div>
<?php
echo stripslashes(apply_filters('bp_get_message_content', $result['reply']->message));
?>
<div class="clear"></div>
<?php
} else {
$result['message'] = '<img src="' . $bp->messages->image_base . '/warning.gif" alt="Warning" /> ' . $result['message'];
echo "-1[[split]]" . $result['message'];
}
}
示例7: bp_portfolio_save_item
/**
* Save the new item and records an activity item for it
*/
function bp_portfolio_save_item($args = array())
{
global $bp;
$defaults = array('id' => null, 'author_id' => $bp->loggedin_user->id, 'title' => null, 'description' => null, 'url' => null, 'screenshot' => null);
$db_args = wp_parse_args($args, $defaults);
extract($db_args, EXTR_SKIP);
$portfolio = new BP_Portfolio_Item($db_args);
// Records an activity
if ($result = $portfolio->save()) {
/* Now record the activity item */
$user_link = bp_core_get_userlink($bp->loggedin_user->id);
$project = new BP_Portfolio_Item(array('id' => $result));
$project->get();
$title = $project->query->post->post_title;
$user_portfolio_link = '<a href="' . bp_core_get_user_domain($bp->loggedin_user->id) . BP_PORTFOLIO_SLUG . '">portfolio</a>';
if ($id) {
// Edit an existing item
bp_portfolio_record_activity(array('type' => 'edit_project', 'action' => apply_filters('bp_edit_portfolio_activity_action', sprintf(__('%s edited the <strong>%s</strong> project in his %s', 'bp-portfolio'), $user_link, $title, $user_portfolio_link), $user_link, $title, $user_portfolio_link), 'item_id' => $bp->loggedin_user->id));
} else {
// New item, so new activity
$description = $project->query->post->post_content;
$url = get_post_meta($result, 'bp_portfolio_url', true);
$attachment = wp_get_attachment_image_src($project->query->post->post_parent, 'portfolio-thumb');
if ($attachment != 0) {
$thumbnail = apply_filters('bp_portfolio_get_item_thumbnail', $attachment[0]);
} else {
$thumbnail = apply_filters('bp_portfolio_get_item_thumbnail', BP_PORTFOLIO_PLUGIN_URL . '/templates/' . BP_PORTFOLIO_TEMPLATE . '/img/default.png');
}
$activity_content = sprintf(__('<div class="item-project"><div class="item-project-pictures"><img width="250px" height="170px" src="%s"></div><div class="item-project-content"><div class="item-project-title">%s</div><div class="item-project-url"><a href="%s">%s</a></div><div class="item-project-desc">%s</div></div></div></div>', 'bp-portfolio'), $thumbnail, $title, $url, $url, $description);
bp_portfolio_record_activity(array('type' => 'new_project', 'action' => apply_filters('bp_new_portfolio_activity_action', sprintf(__('%s created a new project in his %s', 'bp-portfolio'), $user_link, $user_portfolio_link), $user_link, $user_portfolio_link), 'content' => $activity_content, 'item_id' => $bp->loggedin_user->id));
}
return true;
}
return false;
}
示例8: display_cols
public function display_cols($col, $post_id)
{
$allowed = array('type', 'status', 'component', 'user_id', 'media_count');
if (!in_array($col, $allowed)) {
return $col;
}
$gallery = mpp_get_gallery(get_post($post_id));
switch ($col) {
case 'type':
echo $gallery->type;
break;
case 'status':
echo $gallery->status;
break;
case 'component':
echo $gallery->component;
break;
case 'media_count':
echo $gallery->media_count;
break;
case 'user_id':
echo bp_core_get_userlink($gallery->user_id);
break;
}
}
示例9: post_review
function post_review($args = '')
{
global $bp;
$defaults = array('content' => false, 'rating' => false, 'user_id' => $bp->loggedin_user->id, 'group_id' => $bp->groups->current_group->id);
$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
if (empty($content) || !strlen(trim($content)) || empty($user_id) || empty($group_id)) {
return false;
}
// Be sure the user is a member of the group before posting.
if (!is_super_admin() && !groups_is_user_member($user_id, $group_id)) {
return false;
}
// Record this in activity streams
$activity_action = sprintf(__('%s reviewed %s:', 'bpgr'), bp_core_get_userlink($user_id), '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_html($bp->groups->current_group->name) . '</a>');
$rating_content = false;
if (!empty($rating)) {
$rating_content = '<span class="p-rating">' . bpgr_get_review_rating_html($rating) . '</span>';
}
$activity_content = $rating_content . $content;
$activity_id = groups_record_activity(array('user_id' => $user_id, 'action' => $activity_action, 'content' => $activity_content, 'type' => 'review', 'item_id' => $group_id));
$this->add_rating(array('score' => $rating, 'activity_id' => $activity_id, 'group_id' => $group_id));
groups_update_groupmeta($group_id, 'last_activity', gmdate("Y-m-d H:i:s"));
do_action('bpgr_posted_review', $args, $activity_id);
return $activity_id;
}
示例10: test_bp_members_format_activity_action_new_member
/**
* @group activity_action
* @group bp_core_format_activity_action_new_member
*/
public function test_bp_members_format_activity_action_new_member()
{
$u = $this->factory->user->create();
$a = $this->factory->activity->create(array('component' => buddypress()->members->id, 'type' => 'new_member', 'user_id' => $u));
$expected = sprintf(__('%s became a registered member', 'buddypress'), bp_core_get_userlink($u));
$a_obj = new BP_Activity_Activity($a);
$this->assertSame($expected, $a_obj->action);
}
示例11: wp_crm_user_action
/**
* Modify the default buddypress_profile action's HTML to include a link to the profile.
*
* @author potanin@UD
*/
function wp_crm_user_action($action)
{
if ($action['action'] != 'buddypress_profile') {
return $action;
}
$action['html'] = sprintf(__('<a href="%1s">BuddyPress Profile</a>', 'wp_crm'), bp_core_get_userlink($action['user_id'], false, true));
return $action;
}
示例12: em_bp_events_format_activity_action_events
/**
* Not yet used fully - formats event-related actions
* @param string $action
* @param object $activity
* @return string
*/
function em_bp_events_format_activity_action_events($action, $activity)
{
return '';
$member_link = bp_core_get_userlink($activity->user_id);
$EM_Event = em_get_event($activity->item_id);
$action = sprintf(__('%s added the event %s', 'dbem'), $member_link, $EM_Event->output('#_EVENTLINK'));
return apply_filters('bp_events_format_activity_action_events', $action, $activity);
}
示例13: bp_xprofile_new_avatar_activity
/**
* Adds an activity stream item when a user has uploaded a new avatar.
*
* @package BuddyPress XProfile
* @global BuddyPress $bp The one true BuddyPress instance
* @uses bp_activity_add() Adds an entry to the activity component tables for a specific activity
*/
function bp_xprofile_new_avatar_activity()
{
if (!bp_is_active('activity')) {
return false;
}
$user_id = apply_filters('bp_xprofile_new_avatar_user_id', bp_displayed_user_id());
$userlink = bp_core_get_userlink($user_id);
bp_activity_add(array('user_id' => $user_id, 'action' => apply_filters('bp_xprofile_new_avatar_action', sprintf(__('%s changed their profile picture', 'buddypress'), $userlink), $user_id), 'component' => 'profile', 'type' => 'new_avatar'));
}
示例14: test_bp_friends_format_activity_action_friendship_created
/**
* @group activity_action
* @group bp_friends_format_activity_action_friendship_created
*/
public function test_bp_friends_format_activity_action_friendship_created()
{
$u1 = $this->factory->user->create();
$u2 = $this->factory->user->create();
$a = $this->factory->activity->create(array('component' => buddypress()->friends->id, 'type' => 'friendship_created', 'user_id' => $u1, 'secondary_item_id' => $u2));
$expected = sprintf(__('%1$s and %2$s are now friends', 'buddypress'), bp_core_get_userlink($u1), bp_core_get_userlink($u2));
$a_obj = new BP_Activity_Activity($a);
$this->assertSame($expected, $a_obj->action);
}
示例15: bp_xprofile_format_activity_action_new_member
/**
* Format 'new_member' activity actions.
*
* @since BuddyPress (2.0.0)
*
* @param string $action Static activity action.
* @param object $activity Activity object.
* @return string
*/
function bp_xprofile_format_activity_action_new_member($action, $activity)
{
$userlink = bp_core_get_userlink($activity->user_id);
$action = sprintf(__('%s became a registered member', 'buddypress'), $userlink);
// Legacy filter - pass $user_id instead of $activity
if (has_filter('bp_core_activity_registered_member_action')) {
$action = apply_filters('bp_core_activity_registered_member_action', $action, $activity->user_id);
}
return apply_filters('bp_xprofile_format_activity_action_new_member', $action, $activity);
}