本文整理汇总了PHP中bp_get_messages_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_messages_slug函数的具体用法?PHP bp_get_messages_slug怎么用?PHP bp_get_messages_slug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_messages_slug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
$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;
$sitename = wp_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
$email_subject = '[' . $sitename . '] ' . 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);
$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);
}
示例3: messages_action_bulk_delete
function messages_action_bulk_delete()
{
if (!bp_is_messages_component() || !bp_is_action_variable('bulk-delete', 0)) {
return false;
}
$thread_ids = $_POST['thread_ids'];
if (!$thread_ids || !messages_check_thread_access($thread_ids)) {
bp_core_redirect(trailingslashit(bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action()));
} else {
if (!check_admin_referer('messages_delete_thread')) {
return false;
}
if (!messages_delete_thread($thread_ids)) {
bp_core_add_message(__('There was an error deleting messages.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('Messages deleted.', 'buddypress'));
}
bp_core_redirect(trailingslashit(bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action()));
}
}
示例4: bp_loggedin_user_domain
<div class="cb-login-modal clearfix <?php
echo $cb_menu_color;
?>
">
<div class="lwa cb-logged-in clearfix">
<?php
if (class_exists('buddypress')) {
global $bp;
$cb_buddypress_current_user_id = $bp->loggedin_user->id;
if (function_exists('bp_get_groups_root_slug')) {
$cb_buddypress_user_group_link = bp_loggedin_user_domain() . bp_get_groups_root_slug();
}
if (function_exists('bp_get_messages_slug')) {
$cb_buddypress_user_message_link = bp_loggedin_user_domain() . bp_get_messages_slug();
}
if (function_exists('bp_get_activity_slug')) {
$cb_buddypress_user_activity_link = bp_loggedin_user_domain() . bp_get_activity_slug();
}
$cb_buddypress_user_avatar = bp_core_fetch_avatar(array('item_id' => $cb_buddypress_current_user_id, 'type' => 'full', 'width' => 120, 'height' => 120));
$cb_buddypress_mystery_man = 'mystery-man.jpg';
$cb_buddypress_avatar_check = strpos($cb_buddypress_user_avatar, $cb_buddypress_mystery_man);
if ($cb_buddypress_avatar_check === false) {
$cb_buddypress_final_avatar = $cb_buddypress_user_avatar;
} else {
$cb_buddypress_final_avatar = get_avatar($cb_author_id, $size = '150');
}
?>
<div class="cb-header">
示例5: messages_format_notifications
/**
* Format notifications for the Messages component.
*
* @since BuddyPress (1.0.0)
*
* @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 Return value format. 'string' for BuddyBar-compatible
* notifications; 'array' for WP Toolbar. Default: 'string'.
* @return string|array Formatted notifications.
*/
function messages_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
$total_items = (int) $total_items;
$link = trailingslashit(bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox');
$title = __('Inbox', 'buddypress');
if ('new_message' === $action) {
if ($total_items > 1) {
$text = sprintf(__('You have %d new messages', 'buddypress'), $total_items);
$filter = 'bp_messages_multiple_new_message_notification';
} else {
// get message thread ID
$message = new BP_Messages_Message($item_id);
$thread_id = $message->thread_id;
$link = !empty($thread_id) ? bp_get_message_thread_view_link($thread_id) : false;
if (!empty($secondary_item_id)) {
$text = sprintf(__('%s sent you a new private message', 'buddypress'), bp_core_get_user_displayname($secondary_item_id));
} else {
$text = sprintf(_n('You have %s new private message', 'You have %s new private messages', $total_items, 'buddypress'), bp_core_number_format($total_items));
}
$filter = 'bp_messages_single_new_message_notification';
}
}
if ('string' === $format) {
if (!empty($link)) {
$retval = '<a href="' . esc_url($link) . '" title="' . esc_attr($title) . '">' . esc_html($text) . '</a>';
} else {
$retval = esc_html($text);
}
$return = apply_filters($filter, $retval, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
} else {
$return = apply_filters($filter, array('text' => $text, 'link' => $link), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
}
do_action('messages_format_notifications', $action, $item_id, $secondary_item_id, $total_items);
return $return;
}
示例6: bp_loggedin_user_domain
</span>
</a>
</li>
<?php
if ($count == 5) {
break;
}
?>
<?php
}
?>
<?php
}
?>
<li class="new"><a href="<?php
echo bp_loggedin_user_domain() . bp_get_messages_slug();
?>
">Read All Messages</a></li>
</ul>
</div>
</div>
</li>
<li>
<div class="btn-group">
<button class="btn btn-default dropdown-toggle tp-icon"
data-toggle="dropdown">
<i class="glyphicon glyphicon-globe"></i> <span class="badge"><?php
echo bp_notifications_get_unread_notification_count();
?>
</span>
</button>
示例7: test_member_messages_notices
function test_member_messages_notices()
{
$this->go_to(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_messages_slug() . '/notices');
$this->assertTrue(bp_is_notices());
}
示例8: messages_screen_notices
function messages_screen_notices()
{
global $notice_id;
if (!is_super_admin()) {
return false;
}
$notice_id = (int) bp_action_variable(1);
if (!empty($notice_id) && is_numeric($notice_id)) {
$notice = new BP_Messages_Notice($notice_id);
if (bp_is_action_variable('deactivate', 0)) {
if (!$notice->deactivate()) {
bp_core_add_message(__('There was a problem deactivating that notice.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('Notice deactivated.', 'buddypress'));
}
} else {
if (bp_is_action_variable('activate', 0)) {
if (!$notice->activate()) {
bp_core_add_message(__('There was a problem activating that notice.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('Notice activated.', 'buddypress'));
}
} else {
if (bp_is_action_variable('delete')) {
if (!$notice->delete()) {
bp_core_add_message(__('There was a problem deleting that notice.', 'buddypress'), 'buddypress');
} else {
bp_core_add_message(__('Notice deleted.', 'buddypress'));
}
}
}
}
bp_core_redirect(bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices');
}
if (bp_action_variables()) {
bp_do_404();
return;
}
do_action('messages_screen_notices');
bp_core_load_template(apply_filters('messages_template_notices', 'members/single/home'));
}
示例9: kleo_entry_meta
/**
* Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
* Create your own kleo_entry_meta() to override in a child theme.
* @since 1.0
*/
function kleo_entry_meta($echo = true, $att = array())
{
global $kleo_config;
$meta_list = array();
$author_links = '';
$meta_elements = sq_option('blog_meta_elements', $kleo_config['blog_meta_defaults']);
// Translators: used between list items, there is a space after the comma.
if (in_array('categories', $meta_elements)) {
$categories_list = get_the_category_list(__(', ', 'kleo_framework'));
}
// Translators: used between list items, there is a space after the comma.
if (in_array('tags', $meta_elements)) {
$tag_list = get_the_tag_list('', __(', ', 'kleo_framework'));
}
$date = sprintf('<a href="%1$s" rel="bookmark" class="post-time">' . '<time class="entry-date" datetime="%2$s">%3$s</time>' . '<time class="modify-date hide hidden updated" datetime="%4$s">%5$s</time>' . '</a>', esc_url(get_permalink()), esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_html(get_the_modified_date('c')), esc_html(get_the_modified_date()));
if (is_array($meta_elements) && !empty($meta_elements)) {
if (in_array('author_link', $meta_elements) || in_array('avatar', $meta_elements)) {
/* If buddypress is active then create a link to Buddypress profile instead */
if (function_exists('bp_is_active')) {
$author_link = esc_url(bp_core_get_userlink(get_the_author_meta('ID'), $no_anchor = false, $just_link = true));
$author_title = esc_attr(sprintf(__('View %s\'s profile', 'kleo_framework'), get_the_author()));
} else {
$author_link = esc_url(get_author_posts_url(get_the_author_meta('ID')));
$author_title = esc_attr(sprintf(__('View all POSTS by %s', 'kleo_framework'), get_the_author()));
}
$author = sprintf('<a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s %4$s</a>', $author_link, $author_title, in_array('avatar', $meta_elements) ? get_avatar(get_the_author_meta('ID'), 50) : '', in_array('author_link', $meta_elements) ? '<span class="author-name">' . get_the_author() . '</span>' : '');
$meta_list[] = '<small class="meta-author author vcard">' . $author . '</small>';
}
if (function_exists('bp_is_active')) {
if (in_array('profile', $meta_elements)) {
$author_links .= '<a href="' . bp_core_get_userlink(get_the_author_meta('ID'), $no_anchor = false, $just_link = true) . '">' . '<i class="icon-user-1 hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('View profile', 'kleo_framework'), get_the_author())) . '"' . 'data-toggle="tooltip"' . 'data-placement="top"></i>' . '</a>';
}
if (bp_is_active('messages')) {
if (in_array('message', $meta_elements)) {
$author_links .= '<a href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username(get_the_author_meta('ID'))) . '">' . '<i class="icon-mail hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('Contact %s', 'kleo_framework'), get_the_author())) . '" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a>';
}
}
}
if (in_array('archive', $meta_elements)) {
$author_links .= '<a href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . '<i class="icon-docs hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('View all posts by %s', 'kleo_framework'), get_the_author())) . '" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a>';
}
}
if ($author_links != '') {
$meta_list[] = '<small class="meta-links">' . $author_links . '</small>';
}
if (in_array('date', $meta_elements)) {
$meta_list[] = '<small>' . $date . '</small>';
}
$cat_tag = array();
if (isset($categories_list) && $categories_list) {
$cat_tag[] = $categories_list;
}
if (isset($tag_list) && $tag_list) {
$cat_tag[] = $tag_list;
}
if (!empty($cat_tag)) {
$meta_list[] = '<small class="meta-category">' . implode(", ", $cat_tag) . '</small>';
}
//comments
if ((!isset($att['comments']) || isset($att['comments']) && $att['comments'] !== false) && in_array('comments', $meta_elements)) {
$meta_list[] = '<small class="meta-comment-count"><a href="' . get_permalink() . '#comments">' . get_comments_number() . ' <i class="icon-chat-1 hover-tip" ' . 'data-original-title="' . sprintf(_n('This article has one comment', 'This article has %1$s comments', get_comments_number(), 'kleo_framework'), number_format_i18n(get_comments_number())) . '" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a></small>';
}
$meta_separator = isset($att['separator']) ? $att['separator'] : sq_option('blog_meta_sep', ', ');
if ($echo) {
echo implode($meta_separator, $meta_list);
} else {
return implode($meta_separator, $meta_list);
}
}
示例10: bp_legacy_theme_ajax_messages_autocomplete_results
/**
* AJAX handler for autocomplete.
*
* Displays friends only, unless BP_MESSAGES_AUTOCOMPLETE_ALL is defined.
*
* @since BuddyPress (1.2.0)
*
* @return string HTML.
*/
function bp_legacy_theme_ajax_messages_autocomplete_results()
{
// Include everyone in the autocomplete, or just friends?
if (bp_is_current_component(bp_get_messages_slug())) {
$autocomplete_all = buddypress()->messages->autocomplete_all;
}
$pag_page = 1;
$limit = (int) $_GET['limit'] ? $_GET['limit'] : apply_filters('bp_autocomplete_max_results', 10);
$search_terms = isset($_GET['q']) ? $_GET['q'] : '';
$user_query_args = array('search_terms' => $search_terms, 'page' => intval($pag_page), 'per_page' => intval($limit));
// If only matching against friends, get an $include param for
// BP_User_Query
if (!$autocomplete_all && bp_is_active('friends')) {
$include = BP_Friends_Friendship::get_friend_user_ids(bp_loggedin_user_id());
// Ensure zero matches if no friends are found
if (empty($include)) {
$include = array(0);
}
$user_query_args['include'] = $include;
}
$user_query = new BP_User_Query($user_query_args);
// Backward compatibility - if a plugin is expecting a legacy
// filter, pass the IDs through the filter and requery (groan)
if (has_filter('bp_core_autocomplete_ids') || has_filter('bp_friends_autocomplete_ids')) {
$found_user_ids = wp_list_pluck($user_query->results, 'ID');
if ($autocomplete_all) {
$found_user_ids = apply_filters('bp_core_autocomplete_ids', $found_user_ids);
} else {
$found_user_ids = apply_filters('bp_friends_autocomplete_ids', $found_user_ids);
}
if (empty($found_user_ids)) {
$found_user_ids = array(0);
}
// Repopulate the $user_query variable
$user_query = new BP_User_Query(array('include' => $found_user_ids));
}
if (!empty($user_query->results)) {
foreach ($user_query->results as $user) {
if (bp_is_username_compatibility_mode()) {
// Sanitize for spaces. Use urlencode() rather
// than rawurlencode() because %20 breaks JS
$username = urlencode($user->user_login);
} else {
$username = $user->user_nicename;
}
// Note that the final line break acts as a delimiter for the
// autocomplete javascript and thus should not be removed
echo '<span id="link-' . esc_attr($username) . '" href="' . bp_core_get_user_domain($user->ID) . '"></span>' . bp_core_fetch_avatar(array('item_id' => $user->ID, 'type' => 'thumb', 'width' => 15, 'height' => 15, 'alt' => $user->display_name)) . ' ' . bp_core_get_user_displayname($user->ID) . ' (' . esc_html($username) . ')' . "\n";
}
}
exit;
}
示例11: messages_format_notifications
/**
* Format notifications for the Messages component.
*
* @since 1.0.0
*
* @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 Return value format. 'string' for BuddyBar-compatible
* notifications; 'array' for WP Toolbar. Default: 'string'.
* @return string|array Formatted notifications.
*/
function messages_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
$total_items = (int) $total_items;
$text = '';
$link = trailingslashit(bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox');
$title = __('Inbox', 'buddypress');
$amount = 'single';
if ('new_message' === $action) {
if ($total_items > 1) {
$amount = 'multiple';
$text = sprintf(__('You have %d new messages', 'buddypress'), $total_items);
} else {
// Get message thread ID.
$message = new BP_Messages_Message($item_id);
$thread_id = $message->thread_id;
$link = !empty($thread_id) ? bp_get_message_thread_view_link($thread_id) : false;
if (!empty($secondary_item_id)) {
$text = sprintf(__('%s sent you a new private message', 'buddypress'), bp_core_get_user_displayname($secondary_item_id));
} else {
$text = sprintf(_n('You have %s new private message', 'You have %s new private messages', $total_items, 'buddypress'), bp_core_number_format($total_items));
}
}
if ('string' === $format) {
if (!empty($link)) {
$return = '<a href="' . esc_url($link) . '" title="' . esc_attr($title) . '">' . esc_html($text) . '</a>';
} else {
$return = esc_html($text);
}
/**
* Filters the new message notification text before the notification is created.
*
* This is a dynamic filter. Possible filter names are:
* - 'bp_messages_multiple_new_message_notification'.
* - 'bp_messages_single_new_message_notification'.
*
* @param string $return Notification text.
* @param int $total_items Number of messages referred to by the notification.
* @param string $text The raw notification test (ie, not wrapped in a link).
* @param int $item_id ID of the associated item.
* @param int $secondary_item_id ID of the secondary associated item.
*/
$return = apply_filters('bp_messages_' . $amount . '_new_message_notification', $return, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
} else {
/** This filter is documented in bp-messages/bp-messages-notifications.php */
$return = apply_filters('bp_messages_' . $amount . '_new_message_notification', array('text' => $text, 'link' => $link), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
}
// Custom notification action for the Messages component
} else {
if ('string' === $format) {
$return = $text;
} else {
$return = array('text' => $text, 'link' => $link);
}
/**
* Backcompat for plugins that used to filter bp_messages_single_new_message_notification
* for their custom actions. These plugins should now use 'bp_messages_' . $action . '_notification'
*/
if (has_filter('bp_messages_single_new_message_notification')) {
if ('string' === $format) {
/** This filter is documented in bp-messages/bp-messages-notifications.php */
$return = apply_filters('bp_messages_single_new_message_notification', $return, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
// Notice that there are seven parameters instead of six? Ugh...
} else {
/** This filter is documented in bp-messages/bp-messages-notifications.php */
$return = apply_filters('bp_messages_single_new_message_notification', $return, $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id);
}
}
/**
* Filters the custom action notification before the notification is created.
*
* This is a dynamic filter based on the message notification action.
*
* @since 2.6.0
*
* @param array $value An associative array containing the text and the link of the notification
* @param int $item_id ID of the associated item.
* @param int $secondary_item_id ID of the secondary associated item.
* @param int $total_items Number of messages referred to by the notification.
* @param string $format Return value format. 'string' for BuddyBar-compatible
* notifications; 'array' for WP Toolbar. Default: 'string'.
*/
$return = apply_filters("bp_messages_{$action}_notification", $return, $item_id, $secondary_item_id, $total_items, $format);
}
/**
* Fires right before returning the formatted message notifications.
*
//.........这里部分代码省略.........
示例12: bp_get_send_private_message_link
function bp_get_send_private_message_link()
{
if (bp_is_my_profile() || !is_user_logged_in()) {
return false;
}
return apply_filters('bp_get_send_private_message_link', wp_nonce_url(bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username(bp_displayed_user_id())));
}
示例13: private_message_super_admin_override
function private_message_super_admin_override()
{
if (!isset($_GET['bpmSuperAdminOverridePrivateMessage']) || !is_super_admin()) {
return;
}
check_admin_referer('bpmSuperAdminOverridePrivateMessage');
$thread_id = (int) bp_action_variable(0);
bp_core_new_subnav_item(array('name' => sprintf(__('Review message by %s', 'bp-moderation'), bp_get_displayed_user_username()), 'slug' => 'view', 'parent_url' => trailingslashit(bp_displayed_user_domain() . bp_get_messages_slug()), 'parent_slug' => bp_get_messages_slug(), 'screen_function' => true, 'position' => 40, 'user_has_access' => is_super_admin(), 'link' => bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . (int) $thread_id));
bp_core_load_template(apply_filters('messages_template_view_message', 'members/single/home'));
die;
}
示例14: bp_messages_slug
/**
* Output the messages component slug
*
* @package BuddyPress
* @subpackage Messages Template
* @since 1.5
*
* @uses bp_get_messages_slug()
*/
function bp_messages_slug()
{
echo bp_get_messages_slug();
}
示例15: messages_notification_new_message
/**
* Email message recipients to alert them of a new unread private message.
*
* @since 1.0.0
*
* @param array|BP_Messages_Message $raw_args {
* Array of arguments. Also accepts a BP_Messages_Message object.
* @type array $recipients User IDs of recipients.
* @type string $email_subject Subject line of message.
* @type string $email_content Content of message.
* @type int $sender_id User ID of sender.
* }
*/
function messages_notification_new_message($raw_args = array())
{
if (is_object($raw_args)) {
$args = (array) $raw_args;
} else {
$args = $raw_args;
}
// These should be extracted below.
$recipients = array();
$email_subject = $email_content = '';
$sender_id = 0;
// Barf.
extract($args);
if (empty($recipients)) {
return;
}
$sender_name = bp_core_get_user_displayname($sender_id);
// Send an email to each recipient.
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);
if (empty($ud)) {
continue;
}
$unsubscribe_args = array('user_id' => $recipient->user_id, 'notification_type' => 'messages-unread');
$args = array('tokens' => array('usermessage' => wp_strip_all_tags(stripslashes($message)), 'message.url' => esc_url(bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/view/' . $thread_id . '/'), 'sender.name' => $sender_name, 'usersubject' => sanitize_text_field(stripslashes($subject)), 'unsubscribe' => esc_url(bp_email_get_unsubscribe_link($unsubscribe_args))));
bp_send_email('messages-unread', $ud, $args);
}
/**
* Fires after the sending of a new message email notification.
*
* @since 1.5.0
* @deprecated 2.5.0 Use the filters in BP_Email.
* $email_subject and $email_content arguments unset and deprecated.
*
* @param array $recipients User IDs of recipients.
* @param string $email_subject Deprecated in 2.5; now an empty string.
* @param string $email_content Deprecated in 2.5; now an empty string.
* @param array $args Array of originally provided arguments.
*/
do_action('bp_messages_sent_notification_email', $recipients, '', '', $args);
}