本文整理汇总了PHP中bp_core_get_user_domain函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_get_user_domain函数的具体用法?PHP bp_core_get_user_domain怎么用?PHP bp_core_get_user_domain使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_get_user_domain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_listings
function create_listings()
{
global $wpdb, $bp;
$current_user = wp_get_current_user();
//categories
$user_ID = $bp->displayed_user->id;
if (isset($_POST["save_bepro_listing"]) && !empty($_POST["save_bepro_listing"])) {
$success = false;
$success = bepro_listings_save();
if ($success) {
$message = urlencode("Success saving listing");
} else {
$message = urlencode("Error saving listing");
}
$current_user = wp_get_current_user();
$bp_profile_link = bp_core_get_user_domain($bp->displayed_user->id);
wp_redirect($bp_profile_link . BEPRO_LISTINGS_SLUG . "?message=" . $message);
exit;
} elseif (isset($bp->action_variables[0]) && $bp->current_action == BEPRO_LISTINGS_CREATE_SLUG) {
add_action('bp_template_content', 'update_listing_content');
} else {
add_action('bp_template_content', 'create_listing_content');
}
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
示例2: bp_adminbar_authors_menu
function bp_adminbar_authors_menu()
{
global $bp, $nxtdb;
// Only for multisite
if (!is_multisite()) {
return false;
}
// Hide on root blog
if ($nxtdb->blogid == bp_get_root_blog_id() || !bp_is_active('blogs')) {
return false;
}
$blog_prefix = $nxtdb->get_blog_prefix($nxtdb->blogid);
$authors = $nxtdb->get_results("SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM {$nxtdb->users} u, {$nxtdb->usermeta} um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id");
if (!empty($authors)) {
// This is a blog, render a menu with links to all authors
echo '<li id="bp-adminbar-authors-menu"><a href="/">';
_e('Blog Authors', 'buddypress');
echo '</a>';
echo '<ul class="author-list">';
foreach ((array) $authors as $author) {
$caps = maybe_unserialize($author->caps);
if (isset($caps['subscriber']) || isset($caps['contributor'])) {
continue;
}
echo '<li>';
echo '<a href="' . bp_core_get_user_domain($author->user_id, $author->user_nicename, $author->user_login) . '">';
echo bp_core_fetch_avatar(array('item_id' => $author->user_id, 'email' => $author->user_email, 'width' => 15, 'height' => 15));
echo ' ' . $author->display_name . '</a>';
echo '<div class="admin-bar-clear"></div>';
echo '</li>';
}
echo '</ul>';
echo '</li>';
}
}
示例3: get_user_url
function get_user_url($user)
{
if (function_exists('bp_core_get_user_domain')) {
return bp_core_get_user_domain($user);
}
return get_author_posts_url($user);
}
示例4: test_bp_activity_at_name_filter
/**
* @group mentions
* @group bp_activity_at_name_filter
*/
public function test_bp_activity_at_name_filter()
{
$u1 = $this->factory->user->create(array('user_login' => 'foobarbaz', 'user_nicename' => 'foobarbaz'));
$u2 = $this->factory->user->create(array('user_login' => 'foo2', 'user_nicename' => 'foo2'));
$u1_mention_name = bp_activity_get_user_mentionname($u1);
$u1_domain = bp_core_get_user_domain($u1);
$u2_mention_name = bp_activity_get_user_mentionname($u2);
$u2_domain = bp_core_get_user_domain($u2);
// mentions normal text should be replaced
$at_name_in_text = sprintf('Hello @%s', $u1_mention_name);
$at_name_in_text_final = "Hello <a href='" . $u1_domain . "' rel='nofollow'>@{$u1_mention_name}</a>";
$this->assertEquals($at_name_in_text_final, bp_activity_at_name_filter($at_name_in_text));
// mentions inside links sholudn't be replaced
// inside href
$at_name_in_mailto = sprintf("Send messages to <a href='mail@%s.com'>Foo Bar Baz</a>", $u1_mention_name);
$at_name_in_mailto_final = sprintf("Send messages to <a href='mail@%s.com'>Foo Bar Baz</a>", $u1_mention_name);
$this->assertEquals($at_name_in_mailto_final, bp_activity_at_name_filter($at_name_in_mailto));
// inside linked text
$at_name_in_link = sprintf('<a href="https://twitter.com/%1$s">@%1$s</a>', $u1_mention_name);
$at_name_in_link_final = sprintf('<a href="https://twitter.com/%1$s">@%1$s</a>', $u1_mention_name);
$this->assertEquals($at_name_in_link_final, bp_activity_at_name_filter($at_name_in_link));
// Don't link non-existent users
$text = "Don't link @non @existent @users";
$this->assertSame($text, bp_activity_at_name_filter($text));
// Don't link the domain name of the site
preg_match('|https?://([^/]+)|', home_url(), $matches);
if (!empty($matches[1])) {
$text = $matches[1] . " Don't link the domain name " . $matches[1];
}
$this->assertSame($text, bp_activity_at_name_filter($text));
// Multiples
$at_name_in_mailto = sprintf("Send messages to @%s <a href='mail@%s.com'>Foo Bar Baz</a>. Please CC <a href='http://twitter.com/foo2'>@foo2</a>.", $u1_mention_name, $u1_mention_name, $u2_mention_name, $u2_mention_name);
$at_name_in_mailto_final = sprintf('Send messages to <a href=\'%s\' rel=\'nofollow\'>@%s</a> <a href=\'mail@%s.com\'>Foo Bar Baz</a>. Please CC <a href=\'http://twitter.com/%s\'>@%s</a>.', $u1_domain, $u1_mention_name, $u1_mention_name, $u2_mention_name, $u2_mention_name);
$this->assertEquals($at_name_in_mailto_final, bp_activity_at_name_filter($at_name_in_mailto));
}
示例5: init
/**
* Initializes the object with the variables from the post
*
* @param mixed $media_id Media ID of the element to be initialized. Can be the ID or the object of the Media
*
* @since BP Media 2.0
*/
function init($media_id = '') {
if (is_object($media_id)) {
$media = $media_id;
} else {
$media = &get_post($media_id);
}
if (empty($media->ID))
throw new Exception(__('Sorry, the requested media does not exist.', 'bp-media'));
$this->id = $media->ID;
$this->description = $media->post_content;
$this->name = $media->post_title;
$this->owner = $media->post_author;
$this->type = get_post_meta($media->ID, 'bp_media_type', true);
switch ($this->type) {
case 'video' :
$this->url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_ENTRY_SLUG . '/' . $this->id);
$this->edit_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_EDIT_SLUG . '/' . $this->id);
$this->delete_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
break;
case 'audio' :
$this->url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_ENTRY_SLUG . '/' . $this->id);
$this->edit_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_EDIT_SLUG . '/' . $this->id);
$this->delete_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
break;
case 'image' :
$this->url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_ENTRY_SLUG . '/' . $this->id);
$this->edit_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_EDIT_SLUG . '/' . $this->id);
$this->delete_url = trailingslashit(bp_core_get_user_domain($this->owner) . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_DELETE_SLUG . '/' . $this->id);
break;
default :
return false;
}
$this->attachment_id = get_post_meta($this->id, 'bp_media_child_attachment', true);
}
示例6: test_should_return_true_on_own_profile
public function test_should_return_true_on_own_profile()
{
$users = $this->factory->user->create_many(2);
$this->set_current_user($users[0]);
$this->go_to(bp_core_get_user_domain($users[0]));
$this->assertTrue(bp_user_has_access($users[0]));
}
示例7: getPostData
public function getPostData()
{
$fooName = 'bbp_get_' . $this->postType . '_content';
$content = $fooName($this->postId);
$return = array('autor' => array('isCurrentUser' => $this->autorId == get_current_user_id(), 'url' => bp_core_get_user_domain($this->autorId), 'avatar' => bp_core_fetch_avatar(array('item_id' => $autorId, 'height' => $imgSize, 'width' => $imgSize)), 'name' => bbp_get_reply_author_display_name($this->postId)), 'type' => $this->postType, 'attachmentList' => $this->_getAttachmentList(), 'sContent' => bbp_get_reply_content($this->postId), 'id' => $this->postId, 'likes' => 0, 'sDate' => get_post_time('j F ', false, $this->postId, true) . __('at', 'qode') . get_post_time(' H:i', false, $this->postId, true), 'sContentShort' => mb_substr($content, 0, 500), 'sContent' => $content, 'like' => get_post_meta($this->postId, 'likes', true), 'isLiked' => get_post_meta($this->postId, 'like_' . $autorId, true));
return $return;
}
示例8: friends_notification_accepted_request
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
$friend_name = bp_core_get_user_displayname($friend_id);
if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) {
return false;
}
$ud = get_userdata($initiator_id);
$friend_link = bp_core_get_user_domain($friend_id);
$settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
$settings_link = trailingslashit(bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications');
// Set up and send the message
$to = $ud->user_email;
$subject = bp_get_email_subject(array('text' => sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name)));
$message = sprintf(__('%1$s accepted your friend request.
To view %2$s\'s profile: %3$s
---------------------
', 'buddypress'), $friend_name, $friend_name, $friend_link);
// Only show the disable notifications line if the settings component is enabled
if (bp_is_active('settings')) {
$message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
}
/* Send the message */
$to = apply_filters('friends_notification_accepted_request_to', $to);
$subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name);
$message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link);
wp_mail($to, $subject, $message);
do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id);
}
示例9: 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' ) );
}
示例10: 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;
}
示例11: friends_notification_accepted_request
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
global $bp;
$friendship = new BP_Friends_Friendship($friendship_id, false, false);
$friend_name = bp_core_get_user_displayname($friend_id);
if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) {
return false;
}
$ud = get_userdata($initiator_id);
$friend_link = bp_core_get_user_domain($friend_id);
$settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
$settings_link = bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications';
// Set up and send the message
$to = $ud->user_email;
$sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
$subject = '[' . $sitename . '] ' . sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name);
$message = sprintf(__('%1$s accepted your friend request.
To view %2$s\'s profile: %3$s
---------------------
', 'buddypress'), $friend_name, $friend_name, $friend_link);
$message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
/* Send the message */
$to = apply_filters('friends_notification_accepted_request_to', $to);
$subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name);
$message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link);
nxt_mail($to, $subject, $message);
do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id);
}
示例12: friends_notification_accepted_request
/**
* Send notifications related to the acceptance of a friendship request.
*
* When a friendship request is accepted, an email and a BP notification are
* sent to the user who requested the friendship ($initiator_id).
*
* @since 1.0.0
*
* @param int $friendship_id ID of the friendship object.
* @param int $initiator_id ID of the user who initiated the request.
* @param int $friend_id ID of the request recipient.
*/
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) {
return;
}
$args = array('tokens' => array('friend.id' => $friend_id, 'friendship.url' => esc_url(bp_core_get_user_domain($friend_id)), 'friend.name' => bp_core_get_user_displayname($friend_id), 'friendship.id' => $friendship_id, 'initiator.id' => $initiator_id));
bp_send_email('friends-request-accepted', $initiator_id, $args);
}
示例13: 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);
}
示例14: myfossil_buddypress_bbpress_redirect_profile
function myfossil_buddypress_bbpress_redirect_profile()
{
global $bp;
if (bbp_is_single_user_profile()) {
global $wp_query;
$author_page_link = trailingslashit(bp_core_get_user_domain($wp_query->query_vars["bbp_user_id"]) . 'forums');
wp_redirect($author_page_link, 301);
exit;
}
}
示例15: aps_news_author
function aps_news_author()
{
$id = get_the_author_meta('ID');
$link = bp_core_get_user_domain($id);
if (isset($link)) {
echo '<a href="' . $link . '">' . get_the_author() . '</a>';
} else {
the_author();
}
}