/**
 * 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);
}
/**
 * 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);
}
/**
 * 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')));
}
/**
 * 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);
}
 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
0
/**
 * 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
0
 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;
 }
/**
 * 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.
         * @param string $message_link  URL permalink for the activity message.
         * @param string $settings_link URL permalink for the user's notification settings area.
         */
        $message = apply_filters('bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link);
        wp_mail($to, $subject, $message);
    }
    /**
     * Fires after the sending of an @mention email notification.
     *
     * @since 1.5.0
     *
     * @param BP_Activity_Activity $activity         Activity Item object.
     * @param string               $subject          Email notification subject text.
     * @param string               $message          Email notification message text.
     * @param string               $content          Content of the @mention.
     * @param int                  $receiver_user_id The ID of the user who is receiving the update.
     */
    do_action('bp_activity_sent_mention_email', $activity, $subject, $message, $content, $receiver_user_id);
}
示例#9
0
 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);
     }
 }
<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 
/**
 * 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 
    }
    ?>

	</ul>
	<?php 
}
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/');
    }
}
/**
 * Posts a BP activity item
 *
 * @package CollabPress
 * @since 1.2
 *
 * @param str $action 'updated', 'created', etc
 * @param str $type 'project', 'task-list', or 'task'
 * @param int $author The author ID
 * @param int $cp_post_id The ID of the CP post
 */
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
0
/**
 * 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
0
 /**
  * Get the new, customised, email message
  *
  * @global object $bp
  * @param string $original_message
  * @return string Email message
  * @see email_subject()
  * @since 3.0
  */
 public function email_message($original_message)
 {
     global $bp;
     if (empty($bp->welcome_pack['current_email_subject'])) {
         return $original_message;
     }
     // Find the stored subject line so that we can grab the appropriate email object
     $subject = $bp->welcome_pack['current_email_subject'];
     // Check that a new message is set; see email_subject()
     if (empty($bp->welcome_pack[$subject]->message)) {
         return $original_message;
     }
     // Get the unknown number of unknown strings which we need to run through sprintf() to rebuild the original email
     $args = func_get_args();
     array_shift($args);
     /**
      * Put the tokens back into the message.
      * BuddyPress 1.5's filters aren't helpful enough to JUST return the tokens we need, so here's a big huge SWITCH to figure it out.
      */
     $t = array('', '', '', '', '', '', '', '', '', '');
     /**
      * @todo $replace_last_i18n is used for the notification setting strings because
      * if the numbered gettext (%1$s, %2$s, etc) format is used, we get "%s" added
      * to the end and gettext defaults to the equivalent of %1$s. Oops.
      *
      * We're making this change here rather than when we insert the strings into the
      * database, so we don't break the i18n of the BuddyPress strings which we insert
      * into the database.
      *
      * Still, this sucks -- and probably a more elaborate regex should be used to
      * strip out all the positions, and then add them all back in again.
      */
     $replace_last_i18n = 0;
     switch ($subject) {
         case __('Activate Your Account', 'buddypress'):
             $t[0] = $args[1];
             break;
         case __('Activate %s', 'buddypress'):
             $t[0] = $args[0];
             $t[1] = $args[1];
             break;
         case __('New message from %s', 'buddypress'):
             $t[0] = $args[0];
             $t[1] = $args[1];
             $t[2] = $args[2];
             $t[3] = $args[3];
             $t[4] = $args[4];
             // Notification settings
             break;
         case __('Group Details Updated', 'buddypress'):
             $t[0] = $args[0]->name;
             $t[1] = $args[1];
             $t[2] = $args[2];
             // Notification settings
             $replace_last_i18n = 3;
             break;
         case __('Membership request for group: %s', 'buddypress'):
             $t[0] = $args[1];
             $t[1] = $args[0]->name;
             $t[2] = $args[3];
             $t[3] = $args[1];
             $t[4] = $args[2];
             $t[5] = $args[4];
             // Notification settings
             $replace_last_i18n = 6;
             break;
         case __('Membership request for group "%s" accepted', 'buddypress'):
             $t[0] = $args[0]->name;
             $t[1] = $args[1];
             $t[2] = $args[2];
             // Notification settings
             $replace_last_i18n = 3;
             break;
         case __('Membership request for group "%s" rejected', 'buddypress'):
             $t[0] = $args[0]->name;
             $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);
 }
示例#16
0
 /**
  * Get group deposit count.
  */
 public function humcore_get_group_deposit_count()
 {
     if (mla_is_group_committee()) {
         humcore_has_deposits(sprintf('facets[author_facet][]=%s', urlencode(bp_get_current_group_name())));
     } else {
         humcore_has_deposits(sprintf('facets[group_facet][]=%s', urlencode(bp_get_current_group_name())));
     }
     return (int) humcore_get_deposit_count();
     /*
     Using solr counts now.
     $group_deposits = bp_activity_get( array(
     	'filter' => array(
     		'primary_id' => bp_get_current_group_id(),
     		'action' => 'new_group_deposit'
     		)
     	) );
     
     return (int) $group_deposits['total'];
     */
 }
示例#17
0
/**
 * Load the activity feed for the current group.
 *
 * @since BuddyPress (1.2.0)
 *
 * @return bool|null False on failure.
 */
function groups_action_group_feed()
{
    // get current group
    $group = groups_get_current_group();
    if (!bp_is_active('activity') || !bp_is_groups_component() || !$group || !bp_is_current_action('feed')) {
        return false;
    }
    // if group isn't public or if logged-in user is not a member of the group, do
    // not output the group activity feed
    if (!bp_group_is_visible($group)) {
        return false;
    }
    // setup the feed
    buddypress()->activity->feed = new BP_Activity_Feed(array('id' => 'group', 'title' => sprintf(__('%1$s | %2$s | Activity', 'buddypress'), bp_get_site_name(), bp_get_current_group_name()), 'link' => bp_get_group_permalink($group), 'description' => sprintf(__("Activity feed for the group, %s.", 'buddypress'), bp_get_current_group_name()), 'activity_args' => array('object' => buddypress()->groups->id, 'primary_id' => bp_get_current_group_id(), 'display_comments' => 'threaded')));
}
/**
 * Add group information to directory breadcrumbs.
 *
 * @since 1.9.0
 *
 * @param array $crumbs
 * @return array
 */
function bp_docs_group_directory_breadcrumb($crumbs)
{
    if (bp_is_group()) {
        $group_crumbs = array(sprintf('<a href="%s">%s</a>', bp_get_group_permalink(groups_get_current_group()) . bp_docs_get_slug() . '/', sprintf(_x('%s&#8217;s Docs', 'group Docs directory breadcrumb', 'bp-docs'), esc_html(bp_get_current_group_name()))));
        $crumbs = array_merge($group_crumbs, $crumbs);
    }
    return $crumbs;
}
示例#19
0
/**
 * Send email and BP notifications when a users update is liked.
 *
 * @since 0.4
 *
 * @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_like_update_liked_notification_to' hook.
 * @uses apply_filters() To call the 'bp_like_update_liked_notification_subject' hook.
 * @uses apply_filters() To call the 'bp_like_update_liked_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 notification.
 */
function bp_like_activity_update_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).
    // TODO change 'notification_activity_new_mention' to bp like notification settings options
    if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) {
        // TODO change this to user who liked activty update
        $users_who_like = array_keys((array) bp_activity_get_meta($bp_like_id, 'liked_count', true));
        if (count($users_who_like) == 1) {
            // If only one person likes the current item.
            if ($receiver_user_id == $users_who_like[0]) {
                // if the user liked their own update we should do nothing.
            } else {
                $liker_name = bp_core_get_user_displayname($users_who_like[0]);
                $subject = bp_get_email_subject(array('text' => sprintf(__('%s liked your update', 'buddypress-like'), $liker_name)));
            }
        } elseif (count($users_who_like) == 2) {
            $liker_one = bp_core_get_user_displayname($users_who_like[0]);
            $liker_two = bp_core_get_user_displayname($users_who_like[1]);
            $subject = bp_get_email_subject(array('text' => sprintf(__('%s and %s liked your update', 'buddypress-like'), $liker_one, $liker_two)));
        } elseif (count($users_who_like) > 2) {
            $others = count($users_who_like);
            $liker_one = bp_core_get_user_displayname($users_who_like[$others - 1]);
            $liker_two = bp_core_get_user_displayname($users_who_like[$others - 2]);
            // TODO comment this better
            // $users_who_like will always be greater than 2 in here
            if ($users_who_like == 3) {
                // if 3 users like an update we remove 1 as we output 2 user names
                // to match the format of - "User1, User2 and 1 other like this"
                $others = $others - 1;
            } else {
                // remove the two named users from the count
                $others = $others - 2;
            }
            //  $string .= '%s, %s and %d ' . _n( 'other', 'others', $others );
            $subject = bp_get_email_subject(array('text' => sprintf(__('%s, %s and %d ' . _n('other', 'others', $others), 'buddypress-like'), $liker_one, $liker_two)));
            //  printf( $string , $one , $two , $others );
        }
        $likers_text = __('%s and %s like this.', 'buddypress-like');
        //  $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 has been declared and assigned its value previously
        //$subject  = bp_get_email_subject( array( 'text' => sprintf( __( '%s liked your update', 'buddypress-like' ), $liker_names ) ) );
        if (bp_is_active('groups') && bp_is_group()) {
            $message = sprintf(__('%1$s liked your update in the group "%2$s":

"%3$s"

To view your liked update, log in and visit: %4$s

---------------------
', 'buddypress-like'), $poster_name, bp_get_current_group_name(), $content, $message_link);
        } else {
            $message = sprintf(__('%1$s liked your update:

"%2$s"

To view your liked update, log in and visit: %3$s

---------------------
', 'buddypress-like'), $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 0.4
         *
         * @param string $to User email the notification is being sent to.
         */
        $to = apply_filters('bp_like_update_liked_notification_to', $to);
        /**
         * Filters the @mention notification subject that will be sent to user.
         *
         * @since 0.4
         *
         * @param string $subject     Email notification subject text.
         * @param string $poster_name Name of the person who made the @mention.
         */
        $subject = apply_filters('bp_like_update_liked_notification_subject', $subject, $poster_name);
        /**
         * Filters the @mention notification message that will be sent to user.
         *
         * @since 0.4
         *
         * @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 liked update.
         * @param string $message_link  URL permalink for the liked activity update.
         * @param string $settings_link URL permalink for the user's notification settings area.
         */
        $message = apply_filters('bp_like_update_liked_notification_message', $message, $poster_name, $content, $message_link, $settings_link);
        wp_mail($to, $subject, $message);
    }
    /**
     * Fires after the sending of an @mention email notification.
     *
     * @since 1.5.0
     *
     * @param BP_Activity_Activity $activity         Activity Item object.
     * @param string               $subject          Email notification subject text.
     * @param string               $message          Email notification message text.
     * @param string               $content          Content of the @mention.
     * @param int                  $receiver_user_id The ID of the user who is receiving the update.
     */
    do_action('bp_like_sent_update_email', $activity, $subject, $message, $content, $receiver_user_id);
}
示例#20
0
/**
 * 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();
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $post_text = apply_filters('group_forum_post_text_before_save', $post_text);
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $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));
    }
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $action = apply_filters_ref_array('groups_activity_new_forum_post_action', array($activity_action, $post_text, &$topic, &$topic));
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $content = apply_filters_ref_array('groups_activity_new_forum_post_content', array($activity_content, $post_text, &$topic, &$topic));
    /** This filter is documented in bp-groups/bp-groups-forums.php */
    $filtered_primary_link = apply_filters('groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id);
    groups_record_activity(array('id' => $id, 'action' => $action, 'content' => $content, 'primary_link' => $filtered_primary_link, '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));
    /**
     * Fires after the update of a group forum post.
     *
     * @since BuddyPress (1.1.0)
     *
     * @param object $post  Object holding current post being updated.
     * @param object $topic Object holding current topic details. Passed by reference.
     */
    do_action_ref_array('groups_update_group_forum_post', array($post, &$topic));
    return $post_id;
}
/**
 * Content block to show group members how to post new forum topics via email.
 * Javascript-degradable.
 *
 * @uses bp_rbe_groups_get_encoded_email_address()
 * @since 1.0-beta
 */
function bp_rbe_new_topic_info()
{
    global $bp;
    $group = groups_get_current_group();
    // if current user is not a member of the group, stop now!
    if (empty($group->is_member)) {
        return;
    }
    ?>
	<div id="rbe-header">
		<h4><?php 
    _e('Post New Topics via Email', 'bp-rbe');
    ?>
</h4>

		<p><?php 
    _e('You can post new topics to this group from the comfort of your email inbox.', 'bp-rbe');
    ?>
 <a href="javascript:;" id="rbe-toggle"><?php 
    _e('Find out how!', 'bp-rbe');
    ?>
</a></p>
	</div>

	<div id="rbe-message">
		<h5><?php 
    printf(__('Send an email to <strong><a href="%s">%s</strong></a> and a new forum topic will be posted in %s.', 'bp-rbe'), "mailto: " . bp_get_current_group_name() . " <" . bp_rbe_groups_get_encoded_email_address() . ">", bp_rbe_groups_get_encoded_email_address(), bp_get_current_group_name());
    ?>
</h5>

		<ul>
			<li><?php 
    printf(__('Compose a new email from the same email address you registered with &ndash; %s', 'bp-rbe'), '<strong>' . $bp->loggedin_user->userdata->user_email . '</strong>');
    ?>
.</li>
			<li><?php 
    _e('Put the address above in the "To:" field of the email.', 'bp-rbe');
    ?>
</li>
			<li><?php 
    _e('The email subject will become the topic title.', 'bp-rbe');
    ?>
</li>
			<?php 
    do_action('bp_rbe_new_topic_info_extra');
    ?>
		</ul>

		<p><?php 
    _e('<strong>Note:</strong> The email address above is unique to you and this group. Do not share this email address with anyone else! (Each group member will have their own unique email address.)', 'bp-rbe');
    ?>
</p>
	</div>

	<script type="text/javascript">
	jQuery(function() {
		jQuery('#rbe-toggle').show();
		jQuery('#rbe-message').hide();
		jQuery('#rbe-toggle').click(function() {
			jQuery('#rbe-message').toggle(300);
		});
	});

	</script>
<?php 
}
 function set_title($default, $sep = "|")
 {
     global $wp_query;
     global $rtmedia_seo_title;
     if (!array_key_exists(RTMEDIA_MEDIA_SLUG, $wp_query->query_vars)) {
         return $default;
     }
     $title = "";
     $oldSep = " " . $sep . " ";
     $sep = "";
     global $bp;
     global $rtmedia_query;
     if (isset($rtmedia_query->query) && isset($rtmedia_query->query["media_type"])) {
         if ($rtmedia_query->query["media_type"] == "album") {
             if (isset($rtmedia_query->media_query) && isset($rtmedia_query->media_query["album_id"])) {
                 //print_r( $rtmedia_query ); die();
                 if (is_array($rtmedia_query->album) && count($rtmedia_query->album) > 0) {
                     foreach ($rtmedia_query->album as $single_album) {
                         if (intval($single_album->id) == intval($rtmedia_query->media_query["album_id"])) {
                             $title .= $sep . stripslashes(esc_html(ucfirst($single_album->media_title)));
                             $sep = $oldSep;
                         }
                     }
                 }
             }
         } else {
             if (isset($rtmedia_query->media) && $rtmedia_query->media && count($rtmedia_query->media) > 0) {
                 $title .= $sep . stripslashes(esc_html(ucfirst($rtmedia_query->media[0]->media_title)));
                 $sep = $oldSep;
             }
             $title .= $sep . ucfirst($rtmedia_query->query["media_type"]);
             $sep = $oldSep;
         }
     } else {
         if (isset($rtmedia_query->action_query) && isset($rtmedia_query->action_query->media_type)) {
             $title .= $sep . ucfirst($rtmedia_query->action_query->media_type);
             $sep = $oldSep;
         }
     }
     if (function_exists("bp_is_group")) {
         if (bp_is_group() or bp_is_group_forum() or bp_is_group_forum_topic()) {
             if (bp_is_group_forum_topic()) {
                 $title .= $sep . bp_get_the_topic_title();
                 $sep = $oldSep;
             }
             $title .= $sep . bp_get_current_group_name();
             $sep = $oldSep;
         }
     }
     if (function_exists("bp_get_displayed_user_fullname") && bp_displayed_user_id() != 0) {
         $title .= $sep . bp_get_displayed_user_fullname();
         $sep = $oldSep;
     } else {
         $user_info = get_userdata(get_current_user_id());
         if (isset($user_info->data->display_name)) {
             $title .= $sep . $user_info->data->display_name;
             $sep = $oldSep;
         }
     }
     $title .= $sep . RTMEDIA_MEDIA_LABEL;
     $sep = $oldSep;
     if (isset($this->context->type)) {
         switch ($this->context->type) {
             case 'group':
                 $title .= $sep . ucfirst($bp->groups->slug);
                 break;
             case 'profile':
                 if (class_exists('BuddyPress')) {
                     $title .= $sep . ucfirst($bp->profile->slug);
                 } else {
                     $title .= $sep . get_query_var('author_name');
                 }
                 break;
             default:
                 $title .= $sep . get_post_field('post_title', $this->context->id);
                 break;
         }
     }
     $title .= $sep . get_bloginfo('name');
     $rtmedia_seo_title = $title;
     return apply_filters("rtmedia_wp_title", $title, $default, $sep);
 }
 /**
  * Update the global $post with single group data
  *
  * @since BuddyPress (1.7)
  */
 public function single_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => '<a href="' . bp_get_group_permalink(groups_get_current_group()) . '">' . bp_get_current_group_name() . '</a>', 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_group', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
示例#24
0
 /**
  * Update the global $post with single group data.
  *
  * @since 1.7.0
  */
 public function single_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_current_group_name(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
示例#25
0
 function remove_wpseo_from_buddypress($title)
 {
     global $bp, $post;
     if (empty($this->bp_pages)) {
         $this->bp_pages = get_option('bp-pages');
     }
     if (function_exists('bp_is_directory') && bp_is_directory() || in_array($post->ID, $this->bp_pages)) {
         $title = sprintf(_x('%s Directory - %s', 'Directory Title format', 'vibe'), ucfirst(bp_current_component()), get_bloginfo('name'));
     }
     if (function_exists('bp_is_user') && bp_is_user()) {
         //$title = sprintf(_x('%1s group - %2s','Member Name',ucfirst(bp_get_displayed_user_fullname()),get_bloginfo('name')));
         $title = ucfirst(bp_get_displayed_user_fullname()) . ' - ' . get_bloginfo('name');
     }
     if (function_exists('bp_is_group') && bp_is_group()) {
         //$title = sprintf(_x('%1s group - %2s','Group Name',ucfirst(bp_get_current_group_name()),get_bloginfo('name')));
         $title = ucfirst(bp_get_current_group_name()) . ' - ' . get_bloginfo('name');
     }
     return $title;
 }
/**
 * Echoes the output of bp_get_current_group_name()
 *
 * @package BuddyPress
 */
function bp_current_group_name()
{
    echo bp_get_current_group_name();
}
 */
?>

<?php 
do_action('bp_before_group_deposits_loop');
?>

<?php 
// Fill this string with the list of activity types
// you want to see when the filter is set to "everything."
// An easy way to get this list is to check out the html source
// and get all the values of the <option>s.
if (mla_is_group_committee()) {
    $my_querystring = sprintf('facets[author_facet][]=%s', urlencode(bp_get_current_group_name()));
} else {
    $my_querystring = sprintf('facets[group_facet][]=%s', urlencode(bp_get_current_group_name()));
}
// If the ajax string is empty, that usually means that
// it's the first page of the "everything" filter.
$querystring = bp_ajax_querystring('deposits');
if (empty($querystring)) {
    $querystring = $my_querystring;
} else {
    $querystring = implode('&', array($my_querystring, $querystring));
}
// Handle subsequent pages of the "Everything" filter
if ('page' == substr($querystring, 0, 4) && strlen($querystring) < 8) {
    $querystring = $my_querystring . '&' . $querystring;
}
?>