本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'));
}
开发者ID:baljindersingh88,项目名称:bepro-listings,代码行数:25,代码来源:bepro-listings-bp.php
示例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>';
}
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:35,代码来源:bp-members-buddybar.php
示例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);
}
开发者ID:konnektiv,项目名称:do-you-know-widget,代码行数:7,代码来源:do-you-know-widget-class.php
示例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));
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:39,代码来源:filters.php
示例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);
}
开发者ID:rolandinsh,项目名称:buddypress-media,代码行数:41,代码来源:bp-media-class-wordpress.php
示例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]));
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:7,代码来源:bpUserHasAccess.php
示例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;
}
开发者ID:Bnei-Baruch,项目名称:Forum-bbpres-,代码行数:7,代码来源:forum-bbpAjaxIntegrator.php
示例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);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:30,代码来源:bp-friends-notifications.php
示例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' ) );
}
开发者ID:n-sane,项目名称:zaroka,代码行数:41,代码来源:bp-core-classes.php
示例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;
}
开发者ID:ncrocfer,项目名称:BP-Portfolio,代码行数:38,代码来源:bp-portfolio-functions.php
示例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);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:30,代码来源:bp-friends-notifications.php
示例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);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:20,代码来源:bp-friends-notifications.php
示例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);
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:75,代码来源:bp-activity-actions.php
示例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;
}
}
开发者ID:par-orillonsoft,项目名称:myfossil-theme,代码行数:10,代码来源:plugins.php
示例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();
}
}
开发者ID:gato-gordo,项目名称:association-print-scholars,代码行数:10,代码来源:news_functions.php
示例16: dpw_do_keyword_replacement
/**
* Basic keyword substitution routine for welcome message and start page values.
*
* @param string $text
* @param int $user_id
* @since 2.0
*/
function dpw_do_keyword_replacement($text, $user_id)
{
// [admin]
$text = str_replace("USERNAME", bp_core_get_username($user_id), $text);
// [Admin McAdmin]
$text = str_replace("NICKNAME", bp_core_get_user_displayname($user_id), $text);
// http://www.example.com/members/[admin]/
$text = str_replace("USER_URL", bp_core_get_user_domain($user_id), $text);
return $text;
}
开发者ID:hscale,项目名称:webento,代码行数:17,代码来源:welcome-pack-filters.php
示例17: login_redirect
/**
* makes a user logged in and redirect to his/her profile
*/
public static function login_redirect($user_login, $password)
{
$creds = array('user_login' => $user_login, 'user_password' => $password);
//make the user login
$user = wp_signon($creds);
if (!is_wp_error($user)) {
//if the signup was success full.redirect to the membership page
bp_core_redirect(apply_filters('bpdev_autoactivate_redirect_url', bp_core_get_user_domain($user->ID), $user->ID));
}
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:13,代码来源:bp-auto-activate-auto-login.php
示例18: buddystreamCreateActivity
/**
* Create a activity item
* @param $params
* @return string
*/
function buddystreamCreateActivity($params)
{
global $bp, $wpdb;
$buddyStreamExtensions = new BuddyStreamExtensions();
$buddyStreamFilters = new BuddyStreamFilters();
/**
* buddystreamCreateActivity(array(
* 'user_id' => $user_meta->user_id,
* 'extension' => 'facebook',
* 'type' => 'photo',
* 'content' => $content,
* 'item_id' => $item['id'],
* 'raw_date' => $item['created_time'],
* 'actionlink' => 'url_to_original_item')
* ));
*
*/
if (is_array($params)) {
//load config of extension
$originalText = $params['content'];
foreach ($buddyStreamExtensions->getExtensionsConfigs() as $extension) {
if (isset($extension['hashtag'])) {
$originalText = str_replace($extension['hashtag'], "", $originalText);
$originalText = trim($originalText);
}
}
//set the content
$content = "";
$content = '<div class="buddystream_activity_container ' . $params['extension'] . '">' . $originalText . '</div>';
if (!buddyStreamCheckImportLog($params['user_id'], $params['item_id'], $params['extension']) && !buddyStreamCheckExistingContent($content) && !buddyStreamCheckExistingContent($originalText)) {
buddyStreamAddToImportLog($params['user_id'], $params['item_id'], $params['extension']);
remove_filter('bp_activity_action_before_save', 'bp_activity_filter_kses', 1);
$activity = new BP_Activity_Activity();
$activity->user_id = $params['user_id'];
$activity->component = $params['extension'];
$activity->type = $params['extension'];
$activity->content = $content;
$activity->item_id = $params['item_id'];
$activity->secondary_item_id = '';
$activity->date_recorded = $params['raw_date'];
$activity->hide_sitewide = 0;
$activity->action .= '<a href="' . bp_core_get_user_domain($params['user_id']) . '" title="' . bp_core_get_username($params['user_id']) . '">' . bp_core_get_user_displayname($params['user_id']) . '</a>';
$activity->action .= ' ' . __('posted a', 'buddystream_lang') . ' ';
$activity->action .= '<a href="' . $params['actionlink'] . '" target="_blank" rel="external"> ' . __($params['type'], 'buddystream_' . $extension['name']);
$activity->action .= '</a>: ';
$activity->primary_link = $params['actionlink'];
if (!preg_match("/" . $params['item_id'] . "/i", get_user_meta($params['user_id'], 'buddystream_blacklist_ids', 1))) {
$activity->save();
$buddyStreamFilters->updateDayLimitByOne($params['extension'], $params['user_id']);
return true;
}
}
}
return false;
}
开发者ID:BonoboDesigns,项目名称:buddystream,代码行数:60,代码来源:BuddyStreamCore.php
示例19: bp_members_edit_profile_url
/**
* Filter the user profile URL to point to BuddyPress profile edit
*
* @since BuddyPress 1.6
*
* @param string $url
* @param int $user_id
* @param string $scheme
* @return string
*/
function bp_members_edit_profile_url($url, $user_id, $scheme = 'admin')
{
// If xprofile is active, use profile domain link
if (!is_admin() && bp_is_active('xprofile')) {
$profile_link = trailingslashit(bp_core_get_user_domain($user_id) . buddypress()->profile->slug . '/edit');
// Default to $url
} else {
$profile_link = $url;
}
return apply_filters('bp_members_edit_profile_url', $profile_link, $url, $user_id, $scheme);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:21,代码来源:bp-members-filters.php
示例20: dpa_get_user_avatar_link
/**
* Return the avatar link of a user
*
* @param array $args This function supports these arguments:
* - int $size If we're showing an avatar, set it to this size
* - string $type What type of link to return; either "avatar", "name", or "both", or "url".
* - int $user_id The ID for the user.
* @return string
* @since Achievements (3.0)
*/
function dpa_get_user_avatar_link($args = array())
{
$defaults = array('size' => 50, 'type' => 'both', 'user_id' => 0);
$r = dpa_parse_args($args, $defaults, 'get_user_avatar_link');
extract($r);
// Default to current user
if (empty($user_id) && is_user_logged_in()) {
$user_id = get_current_user_id();
}
// Assemble some link bits
$user_link = array();
// BuddyPress
if (dpa_integrate_into_buddypress()) {
$user_url = user_trailingslashit(bp_core_get_user_domain($user_id) . dpa_get_authors_endpoint());
// WordPress
} else {
$user_url = user_trailingslashit(trailingslashit(get_author_posts_url($user_id)) . dpa_get_authors_endpoint());
/**
* Multisite, running network-wide.
*
* When this function is used by the "unlocked achievement" popup, if multisite + running network-wide + and not subdomains,
* we'll have already done switch_to_blog( DPA_ROOT_BLOG ) by the time that this function is called. This makes inspecting
* the current site ID, and is_main_site(), both useless as the globals will have already been changed.
*
* We need to find out if the user is likely to be on the "main site" in this situation. so we can modify our link.
* The main site's author URLs are prefixed with "/blog". We do this by inspecting the _wp_switched_stack global.
*
* I think this solution might result in a wrong link in multi-network configuration, or if the main site has been set
* to something non-default, but these are edge-cases for now.
*/
if (is_multisite() && !is_subdomain_install() && dpa_is_running_networkwide() && DPA_DATA_STORE === 1 && !empty($GLOBALS['_wp_switched_stack'])) {
$last_element = count($GLOBALS['_wp_switched_stack']) - 1;
if (isset($GLOBALS['_wp_switched_stack'][$last_element]) && $GLOBALS['_wp_switched_stack'][$last_element] != 1) {
$user_url = str_replace(home_url(), home_url() . '/blog', $user_url);
}
}
}
// Get avatar
if ('avatar' === $type || 'both' === $type) {
$user_link[] = sprintf('<a href="%1$s">%2$s</a>', esc_url($user_url), get_avatar($user_id, $size));
}
// Get display name
if ('avatar' !== $type) {
$user_link[] = sprintf('<a href="%1$s">%2$s</a>', esc_url($user_url), get_the_author_meta('display_name', $user_id));
}
// Maybe return user URL only
if ('url' === $type) {
$user_link = $user_url;
// Otherwise piece together the link parts and return
} else {
$user_link = join(' ', $user_link);
}
return apply_filters('dpa_get_user_avatar_link', $user_link, $args);
}
开发者ID:rlybbert,项目名称:achievements,代码行数:64,代码来源:template.php
注:本文中的bp_core_get_user_domain函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论