本文整理汇总了PHP中bp_get_current_group_name函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_current_group_name函数的具体用法?PHP bp_get_current_group_name怎么用?PHP bp_get_current_group_name使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_current_group_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_activity_at_message_notification
/**
* Sends an email notification and a BP notification when someone mentions you in an update
*
* @since BuddyPress (1.2)
*
* @param int $activity_id The id of the activity update
* @param int $receiver_user_id The unique user_id of the user who is receiving the update
*
* @uses bp_core_add_notification()
* @uses bp_get_user_meta()
* @uses bp_core_get_user_displayname()
* @uses bp_activity_get_permalink()
* @uses bp_core_get_user_domain()
* @uses bp_get_settings_slug()
* @uses bp_activity_filter_kses()
* @uses bp_core_get_core_userdata()
* @uses wp_specialchars_decode()
* @uses get_blog_option()
* @uses bp_is_active()
* @uses bp_is_group()
* @uses bp_get_current_group_name()
* @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook
* @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook
* @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook
* @uses wp_mail()
* @uses do_action() To call the 'bp_activity_sent_mention_email' hook
*/
function bp_activity_at_message_notification($activity_id, $receiver_user_id)
{
// Don't leave multiple notifications for the same activity item
$notifications = BP_Core_Notification::get_all_for_user($receiver_user_id, 'all');
foreach ($notifications as $notification) {
if ($activity_id == $notification->item_id) {
return;
}
}
$activity = new BP_Activity_Activity($activity_id);
$subject = '';
$message = '';
$content = '';
// Add the BP notification
bp_core_add_notification($activity_id, $receiver_user_id, 'activity', 'new_at_mention', $activity->user_id);
// Now email the user with the contents of the message (if they have enabled email notifications)
if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) {
$poster_name = bp_core_get_user_displayname($activity->user_id);
$message_link = bp_activity_get_permalink($activity_id);
$settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
$settings_link = bp_core_get_user_domain($receiver_user_id) . $settings_slug . '/notifications/';
$poster_name = stripslashes($poster_name);
$content = bp_activity_filter_kses(strip_tags(stripslashes($activity->content)));
// Set up and send the message
$ud = bp_core_get_core_userdata($receiver_user_id);
$to = $ud->user_email;
$subject = bp_get_email_subject(array('text' => sprintf(__('%s mentioned you in an update', 'buddypress'), $poster_name)));
if (bp_is_active('groups') && bp_is_group()) {
$message = sprintf(__('%1$s mentioned you in the group "%2$s":
"%3$s"
To view and respond to the message, log in and visit: %4$s
---------------------
', 'buddypress'), $poster_name, bp_get_current_group_name(), $content, $message_link);
} else {
$message = sprintf(__('%1$s mentioned you in an update:
"%2$s"
To view and respond to the message, log in and visit: %3$s
---------------------
', 'buddypress'), $poster_name, $content, $message_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('bp_activity_at_message_notification_to', $to);
$subject = apply_filters('bp_activity_at_message_notification_subject', $subject, $poster_name);
$message = apply_filters('bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link);
wp_mail($to, $subject, $message);
}
do_action('bp_activity_sent_mention_email', $activity, $subject, $message, $content);
}
示例2: bp_activity_at_message_notification
/**
* Sends an email notification and a BP notification when someone mentions you in an update
*
* @since 1.2.0
*
* @param int $activity_id The id of the activity update
* @param int $receiver_user_id The unique user_id of the user who is receiving the update
*
* @global object $bp BuddyPress global settings
* @uses bp_core_add_notification()
* @uses bp_get_user_meta()
* @uses bp_core_get_user_displayname()
* @uses bp_activity_get_permalink()
* @uses bp_core_get_user_domain()
* @uses bp_get_settings_slug()
* @uses bp_activity_filter_kses()
* @uses bp_core_get_core_userdata()
* @uses nxt_specialchars_decode()
* @uses get_blog_option()
* @uses bp_is_active()
* @uses bp_is_group()
* @uses bp_get_current_group_name()
* @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook
* @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook
* @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook
* @uses nxt_mail()
* @uses do_action() To call the 'bp_activity_sent_mention_email' hook
*/
function bp_activity_at_message_notification($activity_id, $receiver_user_id)
{
global $bp;
$activity = new BP_Activity_Activity($activity_id);
$subject = '';
$message = '';
// Add the BP notification
bp_core_add_notification($activity_id, $receiver_user_id, 'activity', 'new_at_mention', $activity->user_id);
// Now email the user with the contents of the message (if they have enabled email notifications)
if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) {
$poster_name = bp_core_get_user_displayname($activity->user_id);
$message_link = bp_activity_get_permalink($activity_id);
$settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
$settings_link = bp_core_get_user_domain($receiver_user_id) . $settings_slug . '/notifications/';
$poster_name = stripslashes($poster_name);
$content = bp_activity_filter_kses(strip_tags(stripslashes($activity->content)));
// Set up and send the message
$ud = bp_core_get_core_userdata($receiver_user_id);
$to = $ud->user_email;
$sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
$subject = '[' . $sitename . '] ' . sprintf(__('%s mentioned you in an update', 'buddypress'), $poster_name);
if (bp_is_active('groups') && bp_is_group()) {
$message = sprintf(__('%1$s mentioned you in the group "%2$s":
"%3$s"
To view and respond to the message, log in and visit: %4$s
---------------------
', 'buddypress'), $poster_name, bp_get_current_group_name(), $content, $message_link);
} else {
$message = sprintf(__('%1$s mentioned you in an update:
"%2$s"
To view and respond to the message, log in and visit: %3$s
---------------------
', 'buddypress'), $poster_name, $content, $message_link);
}
$message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
/* Send the message */
$to = apply_filters('bp_activity_at_message_notification_to', $to);
$subject = apply_filters('bp_activity_at_message_notification_subject', $subject, $poster_name);
$message = apply_filters('bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link);
nxt_mail($to, $subject, $message);
}
do_action('bp_activity_sent_mention_email', $activity, $subject, $message, $content);
}
示例3: bp_groups_group_admin_menu
/**
* Adds the Group Admin top-level menu to group pages
*
* @package BuddyPress
* @since 1.5
*
* @todo Add dynamic menu items for group extensions
*/
function bp_groups_group_admin_menu()
{
global $nxt_admin_bar, $bp;
// Only show if viewing a group
if (!bp_is_group()) {
return false;
}
// Only show this menu to group admins and super admins
if (!is_super_admin() && !bp_group_is_admin()) {
return false;
}
if ('3.2' == bp_get_major_nxt_version()) {
// Group avatar
$avatar = bp_core_fetch_avatar(array('object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'item_id' => $bp->groups->current_group->id, 'width' => 16, 'height' => 16));
// Unique ID for the 'My Account' menu
$bp->group_admin_menu_id = !empty($avatar) ? 'group-admin-with-avatar' : 'group-admin';
// Add the top-level Group Admin button
$nxt_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => $avatar . bp_get_current_group_name(), 'href' => bp_get_group_permalink($bp->groups->current_group)));
} elseif ('3.3' == bp_get_major_nxt_version()) {
// Unique ID for the 'My Account' menu
$bp->group_admin_menu_id = 'group-admin';
// Add the top-level Group Admin button
$nxt_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => __('Edit Group', 'buddypress'), 'href' => bp_get_group_permalink($bp->groups->current_group)));
}
// Group Admin > Edit details
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'edit-details', 'title' => __('Edit Details', 'buddypress'), 'href' => bp_get_groups_action_link('admin/edit-details')));
// Group Admin > Group settings
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-settings', 'title' => __('Edit Settings', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-settings')));
// Group Admin > Group avatar
if (!(int) bp_get_option('bp-disable-avatar-uploads')) {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-avatar', 'title' => __('Edit Avatar', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-avatar')));
}
// Group Admin > Manage invitations
if (bp_is_active('friends')) {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-invitations', 'title' => __('Manage Invitations', 'buddypress'), 'href' => bp_get_groups_action_link('send-invites')));
}
// Group Admin > Manage members
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-members', 'title' => __('Manage Members', 'buddypress'), 'href' => bp_get_groups_action_link('admin/manage-members')));
// Group Admin > Membership Requests
if (bp_get_group_status($bp->groups->current_group) == 'private') {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'membership-requests', 'title' => __('Membership Requests', 'buddypress'), 'href' => bp_get_groups_action_link('admin/membership-requests')));
}
// Delete Group
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'delete-group', 'title' => __('Delete Group', 'buddypress'), 'href' => bp_get_groups_action_link('admin/delete-group')));
}
示例4: bp_activity_at_message_notification
/**
* Send email and BP notifications when a user is mentioned in an update.
*
* @since 1.2.0
*
* @uses bp_notifications_add_notification()
* @uses bp_get_user_meta()
* @uses bp_core_get_user_displayname()
* @uses bp_activity_get_permalink()
* @uses bp_core_get_user_domain()
* @uses bp_get_settings_slug()
* @uses bp_activity_filter_kses()
* @uses bp_core_get_core_userdata()
* @uses wp_specialchars_decode()
* @uses get_blog_option()
* @uses bp_is_active()
* @uses bp_is_group()
* @uses bp_get_current_group_name()
* @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook.
* @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook.
* @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook.
* @uses wp_mail()
* @uses do_action() To call the 'bp_activity_sent_mention_email' hook.
*
* @param int $activity_id The ID of the activity update.
* @param int $receiver_user_id The ID of the user who is receiving the update.
*/
function bp_activity_at_message_notification($activity_id, $receiver_user_id)
{
$notifications = BP_Core_Notification::get_all_for_user($receiver_user_id, 'all');
// Don't leave multiple notifications for the same activity item.
foreach ($notifications as $notification) {
if ($activity_id == $notification->item_id) {
return;
}
}
$activity = new BP_Activity_Activity($activity_id);
$email_type = 'activity-at-message';
$group_name = '';
$message_link = bp_activity_get_permalink($activity_id);
$poster_name = bp_core_get_user_displayname($activity->user_id);
remove_filter('bp_get_activity_content_body', 'convert_smilies');
remove_filter('bp_get_activity_content_body', 'wpautop');
remove_filter('bp_get_activity_content_body', 'bp_activity_truncate_entry', 5);
/** This filter is documented in bp-activity/bp-activity-template.php */
$content = apply_filters('bp_get_activity_content_body', $activity->content);
add_filter('bp_get_activity_content_body', 'convert_smilies');
add_filter('bp_get_activity_content_body', 'wpautop');
add_filter('bp_get_activity_content_body', 'bp_activity_truncate_entry', 5);
// Now email the user with the contents of the message (if they have enabled email notifications).
if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) {
if (bp_is_active('groups') && bp_is_group()) {
$email_type = 'groups-at-message';
$group_name = bp_get_current_group_name();
}
$args = array('tokens' => array('activity' => $activity, 'usermessage' => wp_strip_all_tags($content), 'group.name' => $group_name, 'mentioned.url' => $message_link, 'poster.name' => $poster_name, 'receiver-user.id' => $receiver_user_id));
bp_send_email($email_type, $receiver_user_id, $args);
}
/**
* Fires after the sending of an @mention email notification.
*
* @since 1.5.0
* @since 2.5.0 $subject, $message, $content arguments unset and deprecated.
*
* @param BP_Activity_Activity $activity Activity Item object.
* @param string $deprecated Removed in 2.5; now an empty string.
* @param string $deprecated Removed in 2.5; now an empty string.
* @param string $deprecated Removed in 2.5; now an empty string.
* @param int $receiver_user_id The ID of the user who is receiving the update.
*/
do_action('bp_activity_sent_mention_email', $activity, '', '', '', $receiver_user_id);
}
示例5: x_buddypress_get_the_title
function x_buddypress_get_the_title()
{
if (x_is_buddypress_user()) {
$output = bp_get_displayed_user_fullname();
} else {
if (x_is_buddypress_component('activity')) {
$output = x_get_option('x_buddypress_activity_title', __('Activity', '__x__'));
} else {
if (x_is_buddypress_component('groups')) {
if (x_is_buddypress_group()) {
$output = bp_get_current_group_name();
} else {
$output = x_get_option('x_buddypress_groups_title', __('Groups', '__x__'));
}
} else {
if (x_is_buddypress_component('members')) {
$output = x_get_option('x_buddypress_members_title', __('Members', '__x__'));
} else {
if (x_is_buddypress_component('blogs')) {
$output = x_get_option('x_buddypress_blogs_title', __('Sites', '__x__'));
} else {
if (x_is_buddypress_component('register')) {
$output = x_get_option('x_buddypress_register_title', __('Create an Account', '__x__'));
} else {
if (x_is_buddypress_component('activate')) {
$output = x_get_option('x_buddypress_activate_title', __('Activate Your Account', '__x__'));
} else {
$output = get_the_title();
}
}
}
}
}
}
}
return $output;
}
示例6: groups_update_group_forum_post
/**
* Update an existing group forum post.
*
* Uses the bundled version of bbPress packaged with BuddyPress.
*
* @since BuddyPress (1.1.0)
*
* @param int $post_id The post ID of the existing forum post.
* @param string $post_text The text for the forum post.
* @param int $topic_id The topic ID of the existing forum topic.
* @param mixed $page The page number where the new forum post should reside.
* Optional.
* @return mixed The forum post ID on success. Boolean false on failure.
*/
function groups_update_group_forum_post($post_id, $post_text, $topic_id, $page = false)
{
$bp = buddypress();
$post_text = apply_filters('group_forum_post_text_before_save', $post_text);
$topic_id = apply_filters('group_forum_post_topic_id_before_save', $topic_id);
$post = bp_forums_get_post($post_id);
$post_id = bp_forums_insert_post(array('post_id' => $post_id, 'post_text' => $post_text, 'post_time' => $post->post_time, 'topic_id' => $topic_id, 'poster_id' => $post->poster_id));
if (empty($post_id)) {
return false;
}
$topic = bp_forums_get_topic_details($topic_id);
$activity_action = sprintf(__('%1$s replied to the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink($post->poster_id), '<a href="' . bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic->topic_slug . '">' . esc_attr($topic->topic_title) . '</a>', '<a href="' . bp_get_group_permalink(groups_get_current_group()) . '">' . esc_attr(bp_get_current_group_name()) . '</a>');
$activity_content = bp_create_excerpt($post_text);
$primary_link = bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic->topic_slug . '/';
if (!empty($page)) {
$primary_link .= "?topic_page=" . $page;
}
// Get the corresponding activity item
if (bp_is_active('activity')) {
$id = bp_activity_get_activity_id(array('user_id' => $post->poster_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post', 'item_id' => bp_get_current_group_id(), 'secondary_item_id' => $post_id));
}
// Update the entry in activity streams
groups_record_activity(array('id' => $id, 'action' => apply_filters_ref_array('groups_activity_new_forum_post_action', array($activity_action, $post_text, &$topic, &$topic)), 'content' => apply_filters_ref_array('groups_activity_new_forum_post_content', array($activity_content, $post_text, &$topic, &$topic)), 'primary_link' => apply_filters('groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id), 'type' => 'new_forum_post', 'item_id' => (int) bp_get_current_group_id(), 'user_id' => (int) $post->poster_id, 'secondary_item_id' => $post_id, 'recorded_time' => $post->post_time));
do_action_ref_array('groups_update_group_forum_post', array($post, &$topic));
return $post_id;
}
示例7: x_buddypress_get_the_title
function x_buddypress_get_the_title()
{
if (x_is_buddypress_user()) {
$output = bp_get_displayed_user_fullname();
} else {
if (x_is_buddypress_component('activity')) {
$output = x_get_option('x_buddypress_activity_title');
} else {
if (x_is_buddypress_component('groups')) {
if (x_is_buddypress_group()) {
$output = bp_get_current_group_name();
} else {
$output = x_get_option('x_buddypress_groups_title');
}
} else {
if (x_is_buddypress_component('members')) {
$output = x_get_option('x_buddypress_members_title');
} else {
if (x_is_buddypress_component('blogs')) {
$output = x_get_option('x_buddypress_blogs_title');
} else {
if (x_is_buddypress_component('register')) {
$output = x_get_option('x_buddypress_register_title');
} else {
if (x_is_buddypress_component('activate')) {
$output = x_get_option('x_buddypress_activate_title');
} else {
$output = get_the_title();
}
}
}
}
}
}
}
return $output;
}
示例8: bp_activity_at_message_notification
/**
* Send email and BP notifications when a user is mentioned in an update.
*
* @since 1.2.0
*
* @uses bp_notifications_add_notification()
* @uses bp_get_user_meta()
* @uses bp_core_get_user_displayname()
* @uses bp_activity_get_permalink()
* @uses bp_core_get_user_domain()
* @uses bp_get_settings_slug()
* @uses bp_activity_filter_kses()
* @uses bp_core_get_core_userdata()
* @uses wp_specialchars_decode()
* @uses get_blog_option()
* @uses bp_is_active()
* @uses bp_is_group()
* @uses bp_get_current_group_name()
* @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook.
* @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook.
* @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook.
* @uses wp_mail()
* @uses do_action() To call the 'bp_activity_sent_mention_email' hook.
*
* @param int $activity_id The ID of the activity update.
* @param int $receiver_user_id The ID of the user who is receiving the update.
*/
function bp_activity_at_message_notification($activity_id, $receiver_user_id)
{
// Don't leave multiple notifications for the same activity item.
$notifications = BP_Core_Notification::get_all_for_user($receiver_user_id, 'all');
foreach ($notifications as $notification) {
if ($activity_id == $notification->item_id) {
return;
}
}
$activity = new BP_Activity_Activity($activity_id);
$subject = '';
$message = '';
$content = '';
// Now email the user with the contents of the message (if they have enabled email notifications).
if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) {
$poster_name = bp_core_get_user_displayname($activity->user_id);
$message_link = bp_activity_get_permalink($activity_id);
$settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
$settings_link = bp_core_get_user_domain($receiver_user_id) . $settings_slug . '/notifications/';
$poster_name = stripslashes($poster_name);
$content = bp_activity_filter_kses(strip_tags(stripslashes($activity->content)));
// Set up and send the message.
$ud = bp_core_get_core_userdata($receiver_user_id);
$to = $ud->user_email;
$subject = bp_get_email_subject(array('text' => sprintf(__('%s mentioned you in an update', 'buddypress'), $poster_name)));
if (bp_is_active('groups') && bp_is_group()) {
$message = sprintf(__('%1$s mentioned you in the group "%2$s":
"%3$s"
To view and respond to the message, log in and visit: %4$s
---------------------
', 'buddypress'), $poster_name, bp_get_current_group_name(), $content, $message_link);
} else {
$message = sprintf(__('%1$s mentioned you in an update:
"%2$s"
To view and respond to the message, log in and visit: %3$s
---------------------
', 'buddypress'), $poster_name, $content, $message_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);
}
/**
* Filters the user email that the @mention notification will be sent to.
*
* @since 1.2.0
*
* @param string $to User email the notification is being sent to.
*/
$to = apply_filters('bp_activity_at_message_notification_to', $to);
/**
* Filters the @mention notification subject that will be sent to user.
*
* @since 1.2.0
*
* @param string $subject Email notification subject text.
* @param string $poster_name Name of the person who made the @mention.
*/
$subject = apply_filters('bp_activity_at_message_notification_subject', $subject, $poster_name);
/**
* Filters the @mention notification message that will be sent to user.
*
* @since 1.2.0
*
* @param string $message Email notification message text.
* @param string $poster_name Name of the person who made the @mention.
* @param string $content Content of the @mention.
//.........这里部分代码省略.........
示例9: rt_theme_compat_reset_post
function rt_theme_compat_reset_post($args = array())
{
global $wp_query, $post;
// Switch defaults if post is set
global $rtmedia_query;
if (isset($wp_query->post)) {
if (isset($rtmedia_query->query) && isset($rtmedia_query->query["media_type"]) && $rtmedia_query->query["media_type"] == "album" && isset($rtmedia_query->media_query["album_id"])) {
foreach ($rtmedia_query->album as $al) {
if ($al->id == $rtmedia_query->media_query["album_id"]) {
$wp_query->post = get_post($al->media_id);
break;
}
}
} else {
if (isset($rtmedia_query->media) && count($rtmedia_query->media) == 1 && $rtmedia_query->media) {
$wp_query->post = get_post($rtmedia_query->media[0]->media_id);
}
}
$dummy = wp_parse_args($args, array('ID' => $wp_query->post->ID, 'post_status' => $wp_query->post->post_status, 'post_author' => $wp_query->post->post_author, 'post_parent' => $wp_query->post->post_parent, 'post_type' => 'rtmedia', 'post_date' => $wp_query->post->post_date, 'post_date_gmt' => $wp_query->post->post_date_gmt, 'post_modified' => $wp_query->post->post_modified, 'post_modified_gmt' => $wp_query->post->post_modified_gmt, 'post_content' => $wp_query->post->post_content, 'post_title' => $wp_query->post->post_title, 'post_excerpt' => $wp_query->post->post_excerpt, 'post_content_filtered' => $wp_query->post->post_content_filtered, 'post_mime_type' => $wp_query->post->post_mime_type, 'post_password' => $wp_query->post->post_password, 'post_name' => $wp_query->post->post_name, 'guid' => $wp_query->post->guid, 'menu_order' => $wp_query->post->menu_order, 'pinged' => $wp_query->post->pinged, 'to_ping' => $wp_query->post->to_ping, 'ping_status' => $wp_query->post->ping_status, 'comment_status' => $wp_query->post->comment_status, 'comment_count' => $wp_query->post->comment_count, 'filter' => $wp_query->post->filter, 'is_404' => false, 'is_page' => false, 'is_single' => false, 'is_archive' => false, 'is_tax' => false));
} else {
$dummy = wp_parse_args($args, array('ID' => 0, 'post_status' => 'public', 'post_author' => 0, 'post_parent' => 0, 'post_type' => 'bp_member', 'post_date' => 0, 'post_date_gmt' => 0, 'post_modified' => 0, 'post_modified_gmt' => 0, 'post_content' => '', 'post_title' => '', 'post_excerpt' => '', 'post_content_filtered' => '', 'post_mime_type' => '', 'post_password' => '', 'post_name' => '', 'guid' => '', 'menu_order' => 0, 'pinged' => '', 'to_ping' => '', 'ping_status' => '', 'comment_status' => 'closed', 'comment_count' => 0, 'filter' => 'raw', 'is_404' => false, 'is_page' => false, 'is_single' => false, 'is_archive' => false, 'is_tax' => false));
}
if (function_exists("bp_is_group")) {
if (bp_is_group()) {
$dummy['post_type'] = "bp_group";
if ("bp-default" != get_option('stylesheet')) {
$dummy['post_title'] = '<a href="' . bp_get_group_permalink(groups_get_current_group()) . '">' . bp_get_current_group_name() . '</a>';
}
} else {
$dummy['post_type'] = "bp_member";
if ("bp-default" != get_option('stylesheet')) {
$dummy['post_title'] = '<a href="' . bp_get_displayed_user_link() . '">' . bp_get_displayed_user_fullname() . '</a>';
}
}
} else {
global $rtmedia_query;
$dummy['comment_status'] = 'closed';
if (isset($rtmedia_query->media_query)) {
if (isset($rtmedia_query->media_query["media_author"])) {
$dummy["post_author"] = $rtmedia_query->media_query["media_author"];
}
if (isset($rtmedia_query->media_query["id"])) {
//var_dump($rtmedia_query);
//echo $rtmedia_query->media_query["id"];
}
}
}
// Bail if dummy post is empty
if (empty($dummy)) {
return;
}
// Set the $post global
$post = new WP_Post((object) $dummy);
// Copy the new post global into the main $wp_query
$wp_query->post = $post;
$wp_query->posts = array($post);
// Prevent comments form from appearing
$wp_query->post_count = 1;
$wp_query->is_404 = $dummy['is_404'];
$wp_query->is_page = $dummy['is_page'];
$wp_query->is_single = $dummy['is_single'];
$wp_query->is_archive = $dummy['is_archive'];
$wp_query->is_tax = $dummy['is_tax'];
// Clean up the dummy post
unset($dummy);
/**
* Force the header back to 200 status if not a deliberate 404
*
* @see http://bbpress.trac.wordpress.org/ticket/1973
*/
if (!$wp_query->is_404()) {
status_header(200);
}
}
示例10: do_action
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
<?php
do_action('bp_activity_group_feed');
?>
>
<channel>
<?php
/* translators: Single group activity RSS title - "[Site Name] | [Group Name] | Group Activity" */
?>
<title><?php
printf('%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_current_group_name(), __('Group Activity', 'buddypress'));
?>
</title>
<atom:link href="<?php
self_link();
?>
" rel="self" type="application/rss+xml" />
<link><?php
echo bp_get_group_permalink($bp->groups->current_group) . bp_get_activity_slug() . '/feed';
?>
</link>
<description><?php
printf(__('%s - Group Activity Feed', 'buddypress'), $bp->groups->current_group->name);
?>
</description>
<pubDate><?php
示例11: bp_docs_tabs
/**
* Outputs the tabs at the top of the Docs view (All Docs, New Doc, etc)
*
* At the moment, the group-specific stuff is hard coded in here.
* @todo Get the group stuff out
*/
function bp_docs_tabs($show_create_button = true)
{
$current_view = '';
?>
<ul id="bp-docs-all-docs">
<li<?php
if (bp_docs_is_global_directory()) {
?>
class="current"<?php
}
?>
><a href="<?php
bp_docs_archive_link();
?>
"><?php
_e('All Docs', 'bp-docs');
?>
</a></li>
<?php
if (is_user_logged_in()) {
?>
<?php
if (function_exists('bp_is_group') && bp_is_group()) {
?>
<li<?php
if (bp_is_current_action('docs')) {
?>
class="current"<?php
}
?>
><a href="<?php
bp_group_permalink(groups_get_current_group());
bp_docs_slug();
?>
"><?php
printf(__("%s's Docs", 'bp-docs'), bp_get_current_group_name());
?>
</a></li>
<?php
} else {
?>
<li><a href="<?php
bp_docs_mydocs_started_link();
?>
"><?php
_e('Started By Me', 'bp-docs');
?>
</a></li>
<li><a href="<?php
bp_docs_mydocs_edited_link();
?>
"><?php
_e('Edited By Me', 'bp-docs');
?>
</a></li>
<?php
if (bp_is_active('groups')) {
?>
<li<?php
if (bp_docs_is_mygroups_docs()) {
?>
class="current"<?php
}
?>
><a href="<?php
bp_docs_mygroups_link();
?>
"><?php
_e('My Groups', 'bp-docs');
?>
</a></li>
<?php
}
?>
<?php
}
?>
<?php
}
?>
<?php
if ($show_create_button) {
?>
<?php
bp_docs_create_button();
?>
<?php
}
?>
//.........这里部分代码省略.........
示例12: ass_admin_notice
function ass_admin_notice()
{
if (bp_is_groups_component() && bp_is_current_action('admin') && bp_is_action_variable('notifications', 0)) {
// Make sure the user is an admin
if (!groups_is_user_admin(bp_loggedin_user_id(), bp_get_current_group_id()) && !is_super_admin()) {
return;
}
if (get_option('ass-admin-can-send-email') == 'no') {
return;
}
// make sure the correct form variables are here
if (!isset($_POST['ass_admin_notice_send'])) {
return;
}
if (empty($_POST['ass_admin_notice'])) {
bp_core_add_message(__('The email notice was sent not sent. Please enter email content.', 'bp-ass'), 'error');
} else {
$group = groups_get_current_group();
$group_id = $group->id;
$group_name = bp_get_current_group_name();
$group_link = bp_get_group_permalink($group);
if ($group->status != 'public') {
$group_link = ass_get_login_redirect_url($group_link, 'admin_notice');
}
$blogname = '[' . get_blog_option(BP_ROOT_BLOG, 'blogname') . ']';
$subject = $_POST['ass_admin_notice_subject'];
$subject .= __(' - sent from the group ', 'bp-ass') . $group_name . ' ' . $blogname;
$subject = apply_filters('ass_admin_notice_subject', $subject, $_POST['ass_admin_notice_subject'], $group_name, $blogname);
$subject = ass_clean_subject($subject, false);
$notice = apply_filters('ass_admin_notice_message', $_POST['ass_admin_notice']);
$notice = ass_clean_content($notice);
$message = sprintf(__('This is a notice from the group \'%s\':
"%s"
To view this group log in and follow the link below:
%s
---------------------
', 'bp-ass'), $group_name, $notice, $group_link);
$message .= __('Please note: admin notices are sent to everyone in the group and cannot be disabled.
If you feel this service is being misused please speak to the website administrator.', 'bp-ass');
$user_ids = BP_Groups_Member::get_group_member_ids($group_id);
// allow others to perform an action when this type of email is sent, like adding to the activity feed
do_action('ass_admin_notice', $group_id, $subject, $notice);
// cycle through all group members
foreach ((array) $user_ids as $user_id) {
$user = bp_core_get_core_userdata($user_id);
// Get the details for the user
if ($user->user_email) {
wp_mail($user->user_email, $subject, $message);
}
// Send the email
//echo '<br>Email: ' . $user->user_email;
}
bp_core_add_message(__('The email notice was sent successfully.', 'bp-ass'));
//echo '<p>Subject: ' . $subject;
//echo '<pre>'; print_r( $message ); echo '</pre>';
}
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/notifications/');
}
}
示例13: cp_bp_post_activity_do
//.........这里部分代码省略.........
function cp_bp_post_activity_do($action, $type, $author, $cp_post_id)
{
global $bp;
// Bail if the Activity component is inactive
if (!bp_is_active('activity')) {
return;
}
// This hyphen is getting stripped somewhere
if ('task list' == $type) {
$type = 'task-list';
}
$bp_activity_add_args = array('component' => 'collabpress', 'user_id' => $author, 'secondary_item_id' => $cp_post_id);
// Get the user display name
$display_name = bp_core_get_user_displayname($author);
switch ($type) {
case 'task':
$task_link = cp_bp_get_task_permalink($cp_post_id);
$bp_activity_add_args['primary_link'] = $task_link;
$task_obj = get_post($cp_post_id);
$task_name = $task_obj->post_title;
switch ($action) {
case 'updated':
$bp_activity_add_args['type'] = 'cp_task_updated';
$bp_activity_add_args['action'] = sprintf(__('%1$s updated the task "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_link . '">' . $task_name . '</a>');
break;
case 'opened':
$bp_activity_add_args['type'] = 'cp_task_opened';
$bp_activity_add_args['action'] = sprintf(__('%1$s reopened the task "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_link . '">' . $task_name . '</a>');
break;
case 'deleted':
$bp_activity_add_args['type'] = 'cp_task_deleted';
$bp_activity_add_args['action'] = sprintf(__('%1$s deleted the task "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_link . '">' . $task_name . '</a>');
break;
case 'edited':
$bp_activity_add_args['type'] = 'cp_task_edited';
$bp_activity_add_args['action'] = sprintf(__('%1$s edited the task "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_link . '">' . $task_name . '</a>');
break;
case 'added':
$bp_activity_add_args['type'] = 'cp_task_added';
$bp_activity_add_args['action'] = sprintf(__('%1$s added the task "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_link . '">' . $task_name . '</a>');
break;
case 'completed':
$bp_activity_add_args['type'] = 'cp_task_completed';
$bp_activity_add_args['action'] = sprintf(__('%1$s completed the task "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_link . '">' . $task_name . '</a>');
break;
case 'commented':
$bp_activity_add_args['type'] = 'cp_task_commented';
$bp_activity_add_args['action'] = sprintf(__('%1$s commented on the task "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_link . '">' . $task_name . '</a>');
break;
}
break;
case 'task-list':
$task_list_link = cp_bp_get_task_list_permalink($cp_post_id);
$bp_activity_add_args['primary_link'] = $task_list_link;
$task_list_obj = get_post($cp_post_id);
$task_list_name = $task_list_obj->post_title;
switch ($action) {
case 'deleted':
$bp_activity_add_args['type'] = 'cp_task_list_deleted';
$bp_activity_add_args['action'] = sprintf(__('%1$s deleted the task list "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_list_link . '">' . $task_list_name . '</a>');
break;
case 'edited':
$bp_activity_add_args['type'] = 'cp_task_list_edited';
$bp_activity_add_args['action'] = sprintf(__('%1$s edited the task list "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_list_link . '">' . $task_list_name . '</a>');
break;
case 'added':
$bp_activity_add_args['type'] = 'cp_task_list_added';
$bp_activity_add_args['action'] = sprintf(__('%1$s added the task list "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $task_list_link . '">' . $task_list_name . '</a>');
break;
}
break;
case 'project':
$project_link = cp_bp_get_project_permalink($cp_post_id);
$bp_activity_add_args['primary_link'] = $project_link;
$project_obj = get_post($cp_post_id);
$project_name = $project_obj->post_title;
switch ($action) {
case 'deleted':
$bp_activity_add_args['type'] = 'cp_project_deleted';
$bp_activity_add_args['action'] = sprintf(__('%1$s deleted the project "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $project_link . '">' . $project_name . '</a>');
break;
case 'edited':
$bp_activity_add_args['type'] = 'cp_project_edited';
$bp_activity_add_args['action'] = sprintf(__('%1$s edited the project "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $project_link . '">' . $project_name . '</a>');
break;
case 'added':
$bp_activity_add_args['type'] = 'cp_project_added';
$bp_activity_add_args['action'] = sprintf(__('%1$s added the project "%2$s"', 'collabpress'), bp_core_get_userlink($author), '<a href="' . $project_link . '">' . $project_name . '</a>');
break;
}
break;
}
if (bp_is_active('groups') && bp_is_group()) {
$bp_activity_add_args['component'] = 'groups';
$bp_activity_add_args['item_id'] = bp_get_current_group_id();
$bp_activity_add_args['hide_sitewide'] = 'public' != $bp->groups->current_group->status;
$bp_activity_add_args['action'] .= sprintf(__(' in the group %s', 'collabpress'), '<a href="' . bp_get_group_permalink(groups_get_current_group()) . '">' . bp_get_current_group_name() . '</a>');
}
bp_activity_add($bp_activity_add_args);
}
示例14: bplf_feed_secondary_title
/**
* Outputs the secondary title. Used in the second part of the <title> attribute.
*
* @since 1.1
* @author r-a-y
*/
function bplf_feed_secondary_title()
{
global $this_bp_feed;
switch ($this_bp_feed) {
case 'member_comments':
case 'member_blog_posts':
case 'member_updates':
case 'friendships':
case 'member_topics':
case 'member_replies':
case 'member_forums':
bp_displayed_user_fullname();
break;
case 'group_updates':
case 'group_topics':
case 'group_replies':
case 'group_forums':
case 'group_membership':
echo bp_get_current_group_name();
break;
case 'forum_topic':
global $bplf_topic;
echo $bplf_topic->topic_title;
break;
}
}
示例15: email_message
//.........这里部分代码省略.........
$t[1] = $args[1];
$t[2] = $args[2];
// Notification settings
$replace_last_i18n = 3;
break;
case __('You have been promoted in the group: "%s"', 'buddypress'):
$t[0] = $args[1];
$t[1] = $args[0]->name;
$t[2] = $args[2];
$t[3] = $args[3];
// Notification settings
$replace_last_i18n = 4;
break;
case __('You have an invitation to the group: "%s"', 'buddypress'):
$t[0] = $args[1];
$t[1] = $args[0]->name;
$t[2] = $args[3];
$t[3] = $args[4];
$t[4] = $args[1];
$t[5] = $args[2];
$t[6] = $args[5];
// Notification settings
$replace_last_i18n = 7;
break;
case __('%s accepted your friendship request', 'buddypress'):
$t[0] = $args[0];
$t[1] = $args[0];
$t[2] = $args[1];
$t[3] = $args[2];
// Notification settings
$replace_last_i18n = 4;
break;
case __('New friendship request from %s', 'buddypress'):
$t[0] = $args[0];
$t[1] = $args[2];
$t[2] = $args[0];
$t[3] = $args[1];
$t[4] = $args[3];
// Notification settings
$replace_last_i18n = 5;
break;
case __('%s mentioned you in an update', 'buddypress'):
if (bp_is_active('groups') && bp_is_group()) {
$t[0] = $args[0];
$t[1] = bp_get_current_group_name();
$t[2] = $args[1];
$t[3] = $args[2];
$t[4] = $args[3];
// Notification settings
$replace_last_i18n = 5;
} else {
$t[0] = $args[0];
$t[1] = $args[1];
$t[2] = $args[2];
$t[3] = $args[3];
// Notification settings
$replace_last_i18n = 4;
}
break;
case __('%s replied to one of your updates', 'buddypress'):
$t[0] = $args[0];
$t[1] = $args[1];
$t[2] = $args[2];
$t[3] = $args[3];
// Notification settings
$replace_last_i18n = 4;
break;
// See http://buddypress.trac.wordpress.org/ticket/3634
/*case __( '%s replied to one of your comments', 'buddypress' ):
$t[0] = $args[0];
$t[1] = $args[1];
$t[2] = $args[3]; xxx thread_link
$t[3] = $args[2]; // Notification settings
$replace_last_i18n = 4;
break;*/
}
$msg = $bp->welcome_pack[$subject]->message;
if ($replace_last_i18n) {
$last_pos = strrpos($msg, '%s');
$msg = substr_replace($msg, '%' . $replace_last_i18n . '$s', $last_pos, 2);
}
$new_message = sprintf($msg, $t[0], $t[1], $t[2], $t[3], $t[4], $t[5], $t[6], $t[7], $t[8], $t[9]);
// Find the email template
$template_path = locate_template($bp->welcome_pack[$subject]->template);
if (empty($template_path)) {
if ('simplicity.php' == $bp->welcome_pack[$subject]->template) {
$template_path = apply_filters('dpw_default_email_template', WP_PLUGIN_DIR . '/welcome-pack/templates/simplicity.php');
} else {
$template_path = apply_filters('dpw_default_email_template', WP_PLUGIN_DIR . '/welcome-pack/templates/welcome_pack_default.php');
}
}
ob_start();
include $template_path;
$template = ob_get_contents();
ob_end_clean();
// Keyword replacement
$template = str_replace('DPW_CONTENT', $new_message, $template);
// Filter the message so 3rd party plugins can affect the output
return apply_filters('dpw_email_message', $template, $new_message);
}