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


PHP bp_core_get_user_displayname函数代码示例

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


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

示例1: friends_format_notifications

/**
 * Format the BuddyBar/Toolbar notifications for the Friends component
 *
 * @package BuddyPress
 *
 * @param string $action The kind of notification being rendered
 * @param int $item_id The primary item id
 * @param int $secondary_item_id The secondary item id
 * @param int $total_items The total number of messaging-related notifications waiting for the user
 * @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar
 */
function friends_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
    switch ($action) {
        case 'friendship_accepted':
            $link = trailingslashit(bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends');
            // Set up the string and the filter
            if ((int) $total_items > 1) {
                $text = sprintf(__('%d friends accepted your friendship requests', 'buddypress'), (int) $total_items);
                $filter = 'bp_friends_multiple_friendship_accepted_notification';
            } else {
                $text = sprintf(__('%s accepted your friendship request', 'buddypress'), bp_core_get_user_displayname($item_id));
                $filter = 'bp_friends_single_friendship_accepted_notification';
            }
            break;
        case 'friendship_request':
            $link = bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/?new';
            // Set up the string and the filter
            if ((int) $total_items > 1) {
                $text = sprintf(__('You have %d pending friendship requests', 'buddypress'), (int) $total_items);
                $filter = 'bp_friends_multiple_friendship_request_notification';
            } else {
                $text = sprintf(__('You have a friendship request from %s', 'buddypress'), bp_core_get_user_displayname($item_id));
                $filter = 'bp_friends_single_friendship_request_notification';
            }
            break;
    }
    // Return either an HTML link or an array, depending on the requested format
    if ('string' == $format) {
        $return = apply_filters($filter, '<a href="' . $link . '">' . $text . '</a>', (int) $total_items);
    } else {
        $return = apply_filters($filter, array('link' => $link, 'text' => $text), (int) $total_items);
    }
    do_action('friends_format_notifications', $action, $item_id, $secondary_item_id, $total_items, $return);
    return $return;
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:46,代码来源:bp-friends-activity.php

示例2: bbp_format_buddypress_notifications

/**
 * Format the BuddyBar/Toolbar notifications
 *
 * @since 2.5.0 bbPress (r5155)
 *
 * @package bbPress
 *
 * @param string $action The kind of notification being rendered
 * @param int $item_id The primary item id
 * @param int $secondary_item_id The secondary item id
 * @param int $total_items The total number of messaging-related notifications waiting for the user
 * @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar
 */
function bbp_format_buddypress_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
    // Bail if not the notification action we are looking for
    if ('bbp_new_reply' !== $action) {
        return $action;
    }
    // New reply notifications
    $topic_id = bbp_get_reply_topic_id($item_id);
    $topic_title = bbp_get_topic_title($topic_id);
    $topic_link = wp_nonce_url(add_query_arg(array('action' => 'bbp_mark_read', 'topic_id' => $topic_id), bbp_get_reply_url($item_id)), 'bbp_mark_topic_' . $topic_id);
    $title_attr = __('Topic Replies', 'bbpress');
    if ((int) $total_items > 1) {
        $text = sprintf(__('You have %d new replies', 'bbpress'), (int) $total_items);
        $filter = 'bbp_multiple_new_subscription_notification';
    } else {
        if (!empty($secondary_item_id)) {
            $text = sprintf(__('You have %d new reply to %2$s from %3$s', 'bbpress'), (int) $total_items, $topic_title, bp_core_get_user_displayname($secondary_item_id));
        } else {
            $text = sprintf(__('You have %d new reply to %s', 'bbpress'), (int) $total_items, $topic_title);
        }
        $filter = 'bbp_single_new_subscription_notification';
    }
    // WordPress Toolbar
    if ('string' === $format) {
        $return = apply_filters($filter, '<a href="' . esc_url($topic_link) . '" title="' . esc_attr($title_attr) . '">' . esc_html($text) . '</a>', (int) $total_items, $text, $topic_link);
        // Deprecated BuddyBar
    } else {
        $return = apply_filters($filter, array('text' => $text, 'link' => $topic_link), $topic_link, (int) $total_items, $text, $topic_title);
    }
    do_action('bbp_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items);
    return $return;
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:45,代码来源:notifications.php

示例3: 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

示例4: bp_chat_send_high_five_notification

/**
 * Notification functions are used to send email notifications to users on specific events
 * They will check to see the users notification settings first, if the user has the notifications
 * turned on, they will be sent a formatted email notification. 
 *
 * You should use your own custom actions to determine when an email notification should be sent.
 */
function bp_chat_send_high_five_notification($to_user_id, $from_user_id)
{
    global $bp;
    /* Let's grab both user's names to use in the email. */
    $sender_name = bp_core_get_user_displayname($from_user_id, false);
    $reciever_name = bp_core_get_user_displayname($to_user_id, false);
    /* We need to check to see if the recipient has opted not to recieve high-five emails */
    if ('no' == get_usermeta((int) $to_user_id, 'notification_chat_new_high_five')) {
        return false;
    }
    /* Get the userdata for the reciever and sender, this will include usernames and emails that we need. */
    $reciever_ud = get_userdata($to_user_id);
    $sender_ud = get_userdata($from_user_id);
    /* Now we need to construct the URL's that we are going to use in the email */
    $sender_profile_link = site_url(BP_MEMBERS_SLUG . '/' . $sender_ud->user_login . '/' . $bp->profile->slug);
    $sender_highfive_link = site_url(BP_MEMBERS_SLUG . '/' . $sender_ud->user_login . '/' . $bp->chat->slug . '/screen-one');
    $reciever_settings_link = site_url(BP_MEMBERS_SLUG . '/' . $reciever_ud->user_login . '/settings/notifications');
    /* Set up and send the message */
    $to = $reciever_ud->user_email;
    $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('%s high-fived you!', 'bp-chat'), stripslashes($sender_name));
    $message = sprintf(__('%s sent you a high-five! Why not send one back?

To see %s\'s profile: %s

To send %s a high five: %s

---------------------
', 'bp-chat'), $sender_name, $sender_name, $sender_profile_link, $sender_name, $sender_highfive_link);
    $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'bp-chat'), $reciever_settings_link);
    // Send it!
    wp_mail($to, $subject, $message);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:39,代码来源:bp-chat-notifications.php

示例5: 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!';
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:29,代码来源:involved.php

示例6: 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

示例7: 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

示例8: bp_course_bp_mail_filter

 function bp_course_bp_mail_filter($email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud)
 {
     $settings = get_option('lms_settings');
     if (!empty($this->html_emails)) {
         $email_content = bp_course_process_mail(bp_core_get_user_displayname($ud->ID), $subject, $email_content);
     }
     return $email_content;
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:8,代码来源:bp-course-mailer.php

示例9: dln_get_avatar_link

function dln_get_avatar_link()
{
    if (!bp_loggedin_user_id()) {
        return '';
    }
    $user_id = bp_loggedin_user_id();
    $link = bp_core_fetch_avatar(array('item_id' => $user_id, 'width' => 40, 'height' => 40, 'class' => 'img-circle', 'alt' => bp_core_get_user_displayname($user_id)));
    return $link;
}
开发者ID:httvncoder,项目名称:151722441,代码行数:9,代码来源:functions.php

示例10: 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

示例11: bp_xprofile_format_activity_action_updated_profile

/**
 * Format 'updated_profile' 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_updated_profile($action, $activity)
{
    // Note for translators: The natural phrasing in English, "Joe updated
    // his profile", requires that we know Joe's gender, which we don't. If
    // your language doesn't have this restriction, feel free to use a more
    // natural translation.
    $profile_link = trailingslashit(bp_core_get_user_domain($activity->user_id) . buddypress()->profile->slug);
    $action = sprintf(__('%s&#8217;s profile was updated', 'buddypress'), '<a href="' . $profile_link . '">' . bp_core_get_user_displayname($activity->user_id) . '</a>');
    return apply_filters('bp_xprofile_format_activity_action_updated_profile', $action, $activity);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:19,代码来源:bp-xprofile-activity.php

示例12: 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&nbsp;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

示例13: setup_globals

 /**
  * Setup globals
  *
  * The BP_MEMBERS_SLUG constant is deprecated, and only used here for
  * backwards compatibility.
  *
  * @since 1.5
  * @global obj $bp
  */
 function setup_globals()
 {
     global $bp, $current_user, $displayed_user_id;
     // Define a slug, if necessary
     if (!defined('BP_MEMBERS_SLUG')) {
         define('BP_MEMBERS_SLUG', $this->id);
     }
     $globals = array('path' => BP_PLUGIN_DIR, 'slug' => BP_MEMBERS_SLUG, 'root_slug' => isset($bp->pages->members->slug) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 'has_directory' => true, 'search_string' => __('Search Members...', 'buddypress'));
     parent::setup_globals($globals);
     /** Logged in user ****************************************************/
     // Fetch the full name for the logged in user
     $bp->loggedin_user->fullname = bp_core_get_user_displayname(bp_loggedin_user_id());
     // Hits the DB on single WP installs so get this separately
     $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin(bp_loggedin_user_id());
     // The domain for the user currently logged in. eg: http://domain.com/members/andy
     $bp->loggedin_user->domain = bp_core_get_user_domain(bp_loggedin_user_id());
     // The core userdata of the user who is currently logged in.
     $bp->loggedin_user->userdata = bp_core_get_core_userdata(bp_loggedin_user_id());
     /** Displayed user ****************************************************/
     // The domain for the user currently being displayed
     $bp->displayed_user->domain = bp_core_get_user_domain(bp_displayed_user_id());
     // The core userdata of the user who is currently being displayed
     $bp->displayed_user->userdata = bp_core_get_core_userdata(bp_displayed_user_id());
     // Fetch the full name displayed user
     $bp->displayed_user->fullname = bp_core_get_user_displayname(bp_displayed_user_id());
     /** Profiles Fallback *************************************************/
     if (!bp_is_active('xprofile')) {
         $bp->profile->slug = 'profile';
         $bp->profile->id = 'profile';
     }
     /** Default Profile Component *****************************************/
     if (!defined('BP_DEFAULT_COMPONENT')) {
         if (bp_is_active('activity') && isset($bp->pages->activity)) {
             $bp->default_component = bp_get_activity_slug();
         } else {
             $bp->default_component = 'xprofile' == $bp->profile->id ? 'profile' : $bp->profile->id;
         }
     } else {
         $bp->default_component = BP_DEFAULT_COMPONENT;
     }
     if (!bp_current_component() && bp_displayed_user_id()) {
         /**
          * BuddyPress will attempt to resolve to the most specific URL possible,
          * to avoid search-engine-unfriendly content reduplication. Filter
          * bp_guarantee_unique_uris (and return false) to avoid this behavior
          */
         if (apply_filters('bp_guarantee_unique_uris', true)) {
             bp_core_redirect(bp_displayed_user_domain() . $bp->default_component);
         } else {
             $bp->current_component = $bp->default_component;
         }
     }
 }
开发者ID:newington,项目名称:buddypress,代码行数:62,代码来源:bp-members-loader.php

示例14: messages_notification_new_message

function messages_notification_new_message($args = array())
{
    // These should be extracted below
    $recipients = array();
    $email_subject = $email_content = '';
    extract($args);
    $sender_name = bp_core_get_user_displayname($sender_id);
    // Bail if no recipients
    if (!empty($recipients)) {
        foreach ($recipients as $recipient) {
            if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) {
                continue;
            }
            // User data and links
            $ud = get_userdata($recipient->user_id);
            // Bail if user cannot be found
            if (empty($ud)) {
                continue;
            }
            $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/';
            $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
            $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/';
            // Sender info
            $sender_name = stripslashes($sender_name);
            $subject = stripslashes(wp_filter_kses($subject));
            $content = stripslashes(wp_filter_kses($content));
            // Set up and send the message
            $email_to = $ud->user_email;
            $email_subject = bp_get_email_subject(array('text' => sprintf(__('New message from %s', 'buddypress'), $sender_name)));
            $email_content = sprintf(__('%1$s sent you a new message:

Subject: %2$s

"%3$s"

To view and read your messages please log in and visit: %4$s

---------------------
', 'buddypress'), $sender_name, $subject, $content, $message_link);
            // Only show the disable notifications line if the settings component is enabled
            if (bp_is_active('settings')) {
                $email_content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
            }
            // Send the message
            $email_to = apply_filters('messages_notification_new_message_to', $email_to);
            $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name);
            $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link);
            wp_mail($email_to, $email_subject, $email_content);
        }
    }
    do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:52,代码来源:bp-messages-notifications.php

示例15: bpchat_extend_messages

/**
 * Extend chat messages by injecting the username, avatar image and escaping the message
 * 
 * @param array $messages
 * @param type $uid
 * @return type
 */
function bpchat_extend_messages($messages, $uid = 'sender_id')
{
    if (empty($messages)) {
        return $messages;
    }
    $message_count = count($messages);
    for ($i = 0; $i < $message_count; $i++) {
        $messages[$i]->name = bp_core_get_user_displayname($messages[$i]->{$uid});
        $messages[$i]->message = stripslashes($messages[$i]->message);
        $messages[$i]->thumb = bp_core_fetch_avatar(array('item_id' => $messages[$i]->{$uid}, 'type' => 'thumb', 'width' => 50, 'height' => 50, 'html' => false));
    }
    return $messages;
}
开发者ID:Lady1178,项目名称:bp-chat,代码行数:20,代码来源:functions.php


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