function bp_reshare_add_reshare_button()
{
    global $bp;
    if (!is_user_logged_in()) {
        return false;
    }
    $activity_types_resharable = bp_reshare_activity_types();
    if (!in_array(bp_get_activity_type(), $activity_types_resharable)) {
        return false;
    }
    if (bp_reshare_activity_is_hidden()) {
        return false;
    }
    if (bp_reshare_is_user_profile_reshares() && $bp->displayed_user->id != $bp->loggedin_user->id) {
        return false;
    }
    $activity_first_id = bp_get_activity_id();
    if ('reshare_update' == bp_get_activity_type()) {
        $activity_first_id = bp_get_activity_secondary_item_id();
    }
    $rs_count = bp_activity_get_meta($activity_first_id, 'reshared_count');
    $rs_count = !empty($rs_count) ? $rs_count : 0;
    if ($bp->loggedin_user->id == bp_get_activity_user_id() || bp_reshare_user_did_reshared($activity_first_id)) {
        $reshared_class = 'reshared';
    }
    $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?to_reshare=' . $activity_first_id, '_reshare_update');
    if ($_POST['scope'] == 'reshares' || bp_reshare_is_user_profile_reshares() || bp_is_activity_component() && !bp_displayed_user_id() && $_COOKIE['bp-activity-scope'] == 'reshares') {
        $extra_class = 'unshare';
        $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?delete_reshare=' . bp_get_activity_id(), '_reshare_delete');
    }
    ?>
	
	<a href="<?php 
    echo $action_url;
    ?>
" class="button bp-primary-action bp-agu-reshare" id="bp-agu-reshare-<?php 
    bp_activity_id();
    ?>
" rel="<?php 
    echo $activity_first_id;
    ?>
"><span class="bp-agu-reshare-img <?php 
    echo $reshared_class . ' ' . $extra_class;
    ?>
"></span><span class="rs-count"><?php 
    echo $rs_count;
    ?>
</span></a>
	<?php 
}
function bp_reshare_replace_activity_delete_link($link)
{
    // if activity type is a reshare, then we replace the delete link behavior
    if (bp_get_activity_type() == 'reshare_update') {
        $class = 'delete-reshare';
        $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?delete_reshare=' . bp_get_activity_id(), '_reshare_delete');
        $link = '<a href="' . $action_url . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __('Delete', 'bp-reshare') . '</a>';
    }
    return apply_filters('bp_reshare_replace_activity_delete_link', $link);
}
/**
 * Returns the sitewide activity feed link
 *
 * @since 1.0.0
 *
 * @uses home_url()
 * @uses bp_get_activity_root_slug()
 * @uses apply_filters() To call the 'bp_get_sitewide_activity_feed_link' hook
 *
 * @return string The sitewide activity feed link
 */
function bp_get_sitewide_activity_feed_link()
{
    return apply_filters('bp_get_sitewide_activity_feed_link', home_url(bp_get_activity_root_slug() . '/feed/'));
}
 /**
  * Content column, and "quick admin" rollover actions.
  *
  * Called "comment" in the CSS so we can re-use some WP core CSS.
  *
  * @param array $item A singular item (one full row)
  * @see WP_List_Table::single_row_columns()
  * @since 1.6
  */
 function column_comment($item)
 {
     // Determine what type of item (row) we're dealing with
     if ($item['is_spam']) {
         $item_status = 'spam';
     } else {
         $item_status = 'all';
     }
     // Preorder items: Reply | Edit | Spam | Delete Permanently
     $actions = array('reply' => '', 'edit' => '', 'spam' => '', 'unspam' => '', 'delete' => '');
     // Build actions URLs
     $base_url = network_admin_url('admin.php?page=bp-activity&amp;aid=' . $item['id']);
     $spam_nonce = esc_html('_wpnonce=' . wp_create_nonce('spam-activity_' . $item['id']));
     $delete_url = $base_url . "&amp;action=delete&amp;{$spam_nonce}";
     $edit_url = $base_url . '&amp;action=edit';
     $ham_url = $base_url . "&amp;action=ham&amp;{$spam_nonce}";
     $spam_url = $base_url . "&amp;action=spam&amp;{$spam_nonce}";
     // Rollover actions
     // Reply - javascript only; implemented by AJAX.
     if ('spam' != $item_status) {
         $actions['reply'] = sprintf('<a href="#" class="reply hide-if-no-js">%s</a>', __('Reply', 'buddypress'));
         // Edit
         $actions['edit'] = sprintf('<a href="%s">%s</a>', $edit_url, __('Edit', 'buddypress'));
     }
     // Spam/unspam
     if ('spam' == $item_status) {
         $actions['unspam'] = sprintf('<a href="%s">%s</a>', $ham_url, __('Not Spam', 'buddypress'));
     } else {
         $actions['spam'] = sprintf('<a href="%s">%s</a>', $spam_url, __('Spam', 'buddypress'));
     }
     // Delete
     $actions['delete'] = sprintf('<a href="%s" onclick="%s">%s</a>', $delete_url, "javascript:return confirm('" . esc_js(__('Are you sure?', 'buddypress')) . "'); ", __('Delete Permanently', 'buddypress'));
     // Start timestamp
     echo '<div class="submitted-on">';
     // Other plugins can filter which actions are shown
     $actions = apply_filters('bp_activity_admin_comment_row_actions', array_filter($actions), $item);
     /* translators: 2: activity admin ui date/time */
     printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>', 'buddypress'), bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $item['id'] . '/', date_i18n(get_option('date_format'), strtotime($item['date_recorded'])), date_i18n(get_option('time_format'), strtotime($item['date_recorded'])));
     // End timestamp
     echo '</div>';
     // Get activity content - if not set, use the action
     if (!empty($item['content'])) {
         $content = apply_filters_ref_array('bp_get_activity_content_body', array($item['content']));
     } else {
         $content = apply_filters_ref_array('bp_get_activity_action', array($item['action']));
     }
     echo $content . ' ' . $this->row_actions($actions);
 }
Example #5
0
/**
 * Load the activity loop template when activity is requested via AJAX,
 *
 * @return string JSON object containing 'contents' (output of the template loop for the Activity component) and 'feed_url' (URL to the relevant RSS feed).
 * @since BuddyPress (1.2)
 */
function bp_dtheme_activity_template_loader()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    $scope = '';
    if (!empty($_POST['scope'])) {
        $scope = $_POST['scope'];
    }
    // We need to calculate and return the feed URL for each scope
    switch ($scope) {
        case 'friends':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/friends/feed/';
            break;
        case 'groups':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/groups/feed/';
            break;
        case 'favorites':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
            break;
        case 'mentions':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
            bp_activity_clear_new_mentions(bp_loggedin_user_id());
            break;
        default:
            $feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
            break;
    }
    // Buffer the loop in the template to a var for JS to spit out.
    ob_start();
    locate_template(array('activity/activity-loop.php'), true);
    $result['contents'] = ob_get_contents();
    $result['feed_url'] = apply_filters('bp_dtheme_activity_feed_url', $feed_url, $scope);
    ob_end_clean();
    exit(json_encode($result));
}
Example #6
0
/**
 * Get the permalink for a single activity item.
 *
 * When only the $activity_id param is passed, BP has to instantiate a new
 * BP_Activity_Activity object. To save yourself some processing overhead,
 * be sure to pass the full $activity_obj parameter as well, if you already
 * have it available.
 *
 * @since BuddyPress (1.2.0)
 *
 * @uses bp_get_root_domain()
 * @uses bp_get_activity_root_slug()
 * @uses apply_filters_ref_array() To call the 'bp_activity_get_permalink' hook.
 *
 * @param int $activity_id The unique id of the activity object.
 * @param object $activity_obj Optional. The activity object.
 * @return string $link Permalink for the activity item.
 */
function bp_activity_get_permalink($activity_id, $activity_obj = false)
{
    if (empty($activity_obj)) {
        $activity_obj = new BP_Activity_Activity($activity_id);
    }
    if (isset($activity_obj->current_comment)) {
        $activity_obj = $activity_obj->current_comment;
    }
    if ('new_blog_post' == $activity_obj->type || 'new_blog_comment' == $activity_obj->type || 'new_forum_topic' == $activity_obj->type || 'new_forum_post' == $activity_obj->type) {
        $link = $activity_obj->primary_link;
    } else {
        if ('activity_comment' == $activity_obj->type) {
            $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->item_id . '/';
        } else {
            $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->id . '/';
        }
    }
    return apply_filters_ref_array('bp_activity_get_permalink', array($link, &$activity_obj));
}
Example #7
0
									<ul class="submenu">
									<?php 
    if ('activity' != bp_dtheme_page_on_front() && bp_is_active('activity')) {
        ?>
										<li<?php 
        if (bp_is_activity_component() && !bp_is_user_activity()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
											<a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo bp_get_activity_root_slug();
        ?>
/" title="<?php 
        _e('Activity', 'framemarket');
        ?>
"><?php 
        _e('Activity', 'framemarket');
        ?>
</a>
										</li>
									<?php 
    }
    ?>

									<li<?php 
    if (bp_is_members_component() || bp_is_user()) {
/**
 * Get the permalink for a single activity item.
 *
 * When only the $activity_id param is passed, BP has to instantiate a new
 * BP_Activity_Activity object. To save yourself some processing overhead,
 * be sure to pass the full $activity_obj parameter as well, if you already
 * have it available.
 *
 * @since 1.2.0
 *
 * @uses bp_get_root_domain()
 * @uses bp_get_activity_root_slug()
 * @uses apply_filters_ref_array() To call the 'bp_activity_get_permalink' hook.
 *
 * @param int         $activity_id  The unique id of the activity object.
 * @param object|bool $activity_obj Optional. The activity object.
 * @return string $link Permalink for the activity item.
 */
function bp_activity_get_permalink($activity_id, $activity_obj = false)
{
    $bp = buddypress();
    if (empty($activity_obj)) {
        $activity_obj = new BP_Activity_Activity($activity_id);
    }
    if (isset($activity_obj->current_comment)) {
        $activity_obj = $activity_obj->current_comment;
    }
    $use_primary_links = array('new_blog_post', 'new_blog_comment', 'new_forum_topic', 'new_forum_post');
    if (!empty($bp->activity->track)) {
        $use_primary_links = array_merge($use_primary_links, array_keys($bp->activity->track));
    }
    if (false !== array_search($activity_obj->type, $use_primary_links)) {
        $link = $activity_obj->primary_link;
    } else {
        if ('activity_comment' == $activity_obj->type) {
            $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->item_id . '/';
        } else {
            $link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_obj->id . '/';
        }
    }
    /**
     * Filters the activity permalink for the specified activity item.
     *
     * @since 1.2.0
     *
     * @param array $array Array holding activity permalink and activity item object.
     */
    return apply_filters_ref_array('bp_activity_get_permalink', array($link, &$activity_obj));
}
/**
 * Reset the logged-in user's new mentions data when he visits his mentions screen
 *
 * @since BuddyPress (1.2)
 *
 * @global object $bp BuddyPress global settings
 * @uses bp_is_activity_component()
 * @uses bp_activity_get_specific()
 * @uses bp_current_action()
 * @uses bp_action_variables()
 * @uses bp_do_404()
 * @uses bp_is_active()
 * @uses groups_get_group()
 * @uses groups_is_user_member()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_access' hook
 * @uses do_action() To call the 'bp_activity_screen_single_activity_permalink' hook
 * @uses bp_core_add_message()
 * @uses is_user_logged_in()
 * @uses bp_core_redirect()
 * @uses site_url()
 * @uses esc_url()
 * @uses bp_get_root_domain()
 * @uses bp_get_activity_root_slug()
 * @uses bp_core_load_template()
 * @uses apply_filters() To call the 'bp_activity_template_profile_activity_permalink' hook
 */
function bp_activity_screen_single_activity_permalink()
{
    global $bp;
    // No displayed user or not viewing activity component
    if (!bp_is_activity_component()) {
        return false;
    }
    if (!bp_current_action() || !is_numeric(bp_current_action())) {
        return false;
    }
    // Get the activity details
    $activity = bp_activity_get_specific(array('activity_ids' => bp_current_action(), 'show_hidden' => true, 'spam' => 'ham_only'));
    // 404 if activity does not exist
    if (empty($activity['activities'][0]) || bp_action_variables()) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Default access is true
    $has_access = true;
    // If activity is from a group, do an extra cap check
    if (isset($bp->groups->id) && $activity->component == $bp->groups->id) {
        // Activity is from a group, but groups is currently disabled
        if (!bp_is_active('groups')) {
            bp_do_404();
            return;
        }
        // Check to see if the group is not public, if so, check the
        // user has access to see this activity
        if ($group = groups_get_group(array('group_id' => $activity->item_id))) {
            // Group is not public
            if ('public' != $group->status) {
                // User is not a member of group
                if (!groups_is_user_member(bp_loggedin_user_id(), $group->id)) {
                    $has_access = false;
                }
            }
        }
    }
    // Allow access to be filtered
    $has_access = apply_filters_ref_array('bp_activity_permalink_access', array($has_access, &$activity));
    // Allow additional code execution
    do_action('bp_activity_screen_single_activity_permalink', $activity, $has_access);
    // Access is specifically disallowed
    if (false === $has_access) {
        // User feedback
        bp_core_add_message(__('You do not have access to this activity.', 'buddypress'), 'error');
        // Redirect based on logged in status
        is_user_logged_in() ? bp_core_redirect(bp_loggedin_user_domain()) : bp_core_redirect(site_url('wp-login.php?redirect_to=' . esc_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . bp_current_action() . '/')));
    }
    bp_core_load_template(apply_filters('bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink'));
}
        /**
         * Output the about screen
         *
         * @since BuddyPress (1.7)
         */
        public function about_screen()
        {
            global $wp_rewrite;
            $is_new_install = !empty($_GET['is_new_install']);
            $pretty_permalinks_enabled = !empty($wp_rewrite->permalink_structure);
            list($display_version) = explode('-', bp_get_version());
            ?>

		<div class="wrap about-wrap">
			<h1><?php 
            printf(__('Welcome to BuddyPress %s', 'buddypress'), $display_version);
            ?>
</h1>
			<div class="about-text">
				<?php 
            if ($is_new_install) {
                ?>
					<?php 
                printf(__('BuddyPress %s is our safest, fastest, most flexible version ever.', 'buddypress'), $display_version);
                ?>
				<?php 
            } else {
                ?>
					<?php 
                printf(__('Thank you for updating! BuddyPress %s is our safest, fastest, most flexible version ever.', 'buddypress'), $display_version);
                ?>
				<?php 
            }
            ?>
			</div>
			<div class="bp-badge"><?php 
            printf(__('Version %s', 'buddypress'), $display_version);
            ?>
</div>

			<h2 class="nav-tab-wrapper">
				<a class="nav-tab nav-tab-active" href="<?php 
            echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-about'), 'index.php')));
            ?>
">
					<?php 
            _e('What&#8217;s New', 'buddypress');
            ?>
				</a><a class="nav-tab" href="<?php 
            echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-credits'), 'index.php')));
            ?>
">
					<?php 
            _e('Credits', 'buddypress');
            ?>
				</a>
			</h2>

			<?php 
            if ($is_new_install) {
                ?>
			<h3><?php 
                _e('Getting Started', 'buddypress');
                ?>
</h3>

				<div class="feature-section">
					<h4><?php 
                _e('Your Default Setup', 'buddypress');
                ?>
</h4>
					<p><?php 
                printf(__('BuddyPress&#8217;s powerful features help your users connect and collaborate. To help get your community started, we&#8217;ve activated two of the most commonly used tools in BP: <strong>Extended Profiles</strong> and <strong>Activity Streams</strong>. See these components in action at the %1$s and %2$s directories, and be sure to spend a few minutes <a href="%3$s">configuring user profiles</a>. Want to explore more of BP&#8217;s features? Visit the <a href="%4$s">Components panel</a>.', 'buddypress'), $pretty_permalinks_enabled ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '">' . __('Members', 'buddypress') . '</a>' : __('Members', 'buddypress'), $pretty_permalinks_enabled ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_activity_root_slug()) . '">' . __('Activity', 'buddypress') . '</a>' : __('Activity', 'buddypress'), bp_get_admin_url(add_query_arg(array('page' => 'bp-profile-setup'), 'users.php')), bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page)));
                ?>
</p>

					<h4><?php 
                _e('Community and Support', 'buddypress');
                ?>
</h4>
					<p><?php 
                _e('Looking for help? The <a href="http://codex.buddypress.org/">BuddyPress Codex</a> has you covered, with dozens of user-contributed guides on how to configure and use your BP site. Can&#8217;t find what you need? Stop by <a href="http://buddypress.org/support/">our support forums</a>, where a vibrant community of BuddyPress users and developers is waiting to share tips, show off their sites, talk about the future of BuddyPress, and much more.', 'buddypress');
                ?>
</p>
				</div>

			<?php 
            }
            ?>

			<div class="changelog">
				<h3><?php 
            _e('Improved Theme Integration', 'buddypress');
            ?>
</h3>

				<div class="feature-section">
					<h4><?php 
            _e('Hey, Good Lookin&#8217;', 'buddypress');
            ?>
</h4>
					<p><?php 
            _e('We&#8217;ve streamlined our stylesheets, so that BuddyPress content looks more at home in your theme. And theme developers will love BP&#8217;s new hierarchies that make it easy to override specific top-level templates, stylesheets, and JavaScript files.', 'buddypress');
            ?>
</p>
				</div>
			</div>

			<div class="changelog">
				<h3><?php 
            _e('Better Group Member Management', 'buddypress');
            ?>
</h3>

				<div class="feature-section">
					<h4><?php 
            _e('<em>Add</em>, <em>Remove</em>, and More, in a Snap', 'buddypress');
            ?>
</h4>

					<?php 
            $group_admin_text = __('Groups administration panel', 'buddypress');
            if (bp_is_active('groups')) {
                $group_admin_text = '<a href="' . bp_get_admin_url(add_query_arg(array('page' => 'bp-groups'), 'admin.php')) . '">' . $group_admin_text . '</a>';
            }
            ?>

					<p><?php 
            printf(__('The Manage Members section of the %s has been rewritten, to make it easier to handle groups with many members. We&#8217;ve also made the interface nicer to use, to ensure that you don&#8217;t make changes and then forget to save them.', 'buddypress'), $group_admin_text);
            ?>
</p>
				</div>
			</div>

			<div class="changelog">
				<h3><?php 
            _e('Under the Hood', 'buddypress');
            ?>
</h3>

				<div class="feature-section three-col">
					<div>
						<h4><?php 
            _e('Superpowered Group Extensions', 'buddypress');
            ?>
</h4>
						<p><?php 
            _e('<code>BP_Group_Extension</code> has been overhauled, making it easier than ever before to add custom functionality to groups.', 'buddypress');
            ?>
</p>

						<h4><?php 
            _e('Filter Groups or Activity by Metadata', 'buddypress');
            ?>
</h4>
						<p><?php 
            _e('<code>bp_has_groups()</code> and <code>bp_has_activities()</code> now accept a <code>meta_query</code> paramater, for more powerful directory queries.', 'buddypress');
            ?>
</p>
					</div>

					<div>
						<h4><?php 
            _e('Feed Me, Seymour', 'buddypress');
            ?>
</h4>
						<p><?php 
            _e('The new <code>BP_Activity_Feed</code> class centralizes BP&#8217;s RSS logic, making our feeds more standards-compliant, and giving developers more tools for building custom feeds.', 'buddypress');
            ?>
</p>

						<h4><?php 
            _e('Disable @-Mentions', 'buddypress');
            ?>
</h4>
						<p><?php 
            _e("Not using @-mentions? Disable them with <code>add_filter( 'bp_activity_do_mentions', '__return_false' );</code>", 'buddypress');
            ?>
</p>
					</div>
			</div>

			<div class="return-to-dashboard">
				<a href="<?php 
            echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page)));
            ?>
"><?php 
            _e('Go to the BuddyPress Settings page', 'buddypress');
            ?>
</a>
			</div>

		</div>

		<?php 
        }
Example #11
0
 private function _expand_macro($macro)
 {
     $value = false;
     $user = wp_get_current_user();
     switch ($macro) {
         case 'BP_ACTIVITY_SLUG':
             if (function_exists('bp_get_activity_root_slug')) {
                 $value = bp_get_activity_root_slug();
             }
             break;
         case 'BP_GROUPS_SLUG':
             if (function_exists('bp_get_groups_slug')) {
                 $value = bp_get_groups_slug();
             }
             break;
         case 'BP_MEMBERS_SLUG':
             if (function_exists('bp_get_members_slug')) {
                 $value = bp_get_members_slug();
             }
             break;
     }
     return apply_filters('logout_redirect-macro_value', $value, $macro);
 }
/**
 * Expands some basic supported BuddyPress macros.
 */
function wdfb_expand_buddypress_macros($str)
{
    if (!defined('BP_VERSION')) {
        return $str;
    }
    if (function_exists('bp_get_activity_root_slug')) {
        $str = preg_replace('/\\bBP_ACTIVITY_SLUG\\b/', bp_get_activity_root_slug(), $str);
    }
    if (function_exists('bp_get_groups_slug')) {
        $str = preg_replace('/\\bBP_GROUPS_SLUG\\b/', bp_get_groups_slug(), $str);
    }
    if (function_exists('bp_get_members_slug')) {
        $str = preg_replace('/\\bBP_MEMBERS_SLUG\\b/', bp_get_members_slug(), $str);
    }
    return $str;
}
Example #13
0
/**
 * Filters the reshare action url if the delete action is possible
 *
 * @package BP Reshare
 * @since    1.0
 * 
 * @param  string $action_url
 * @uses   buddyreshare_can_unshare() to check if the context is good to allow delete action
 * @uses   wp_nonce_url() for security reason
 * @uses   bp_get_root_domain() to get the blog's url
 * @uses   bp_get_activity_root_slug() to get the activity slug
 * @uses   buddyreshare_get_component_slug() to get the component's slug
 * @uses   bp_get_activity_id() to get the activity id [description]
 * @return string $action_url
 */
function buddyreshare_activity_filter_action_url($action_url = '')
{
    if (buddyreshare_can_unshare()) {
        $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/' . buddyreshare_get_component_slug() . '/delete/' . bp_get_activity_id() . '/', 'buddyreshare_delete');
    }
    return $action_url;
}
function bpcustom_activity_template_loader()
{
    global $bp;
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    bpcustom_setup_components();
    $action = bpcustom_get_current_action();
    $scope = $action;
    // We need to calculate and return the feed URL for each scope
    switch ($scope) {
        case 'friends':
            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/friends/feed/';
            break;
        case 'groups':
            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/groups/feed/';
            break;
        case 'favorites':
            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/favorites/feed/';
            break;
        case 'mentions':
            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/mentions/feed/';
            bp_activity_clear_new_mentions($bp->loggedin_user->id);
            break;
        default:
            $feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
            break;
    }
    /* Buffer the loop in the template to a var for JS to spit out. */
    ob_start();
    locate_template(array('members/single/activity.php'), true);
    $result = array();
    $result['contents'] = ob_get_contents();
    $result['feed_url'] = apply_filters('bp_dtheme_activity_feed_url', $feed_url, $scope);
    ob_end_clean();
    echo json_encode($result);
}
Example #15
0
        /**
         * Output the about screen.
         *
         * @since BuddyPress (1.7.0)
         */
        public function about_screen()
        {
            global $wp_rewrite;
            $is_new_install = !empty($_GET['is_new_install']);
            $pretty_permalinks_enabled = !empty($wp_rewrite->permalink_structure);
            $image_base = buddypress()->plugin_url . 'bp-core/images/bp20/';
            list($display_version) = explode('-', bp_get_version());
            ?>

		<div class="wrap about-wrap">
			<h1><?php 
            printf(__('Welcome to BuddyPress %s', 'buddypress'), $display_version);
            ?>
</h1>
			<div class="about-text">
				<?php 
            if ($is_new_install) {
                ?>
					<?php 
                printf(__('It&#8217;s a great time to use BuddyPress! With a focus on speed, admin tools, and developer enhancements, %s is our leanest and most powerful version yet.', 'buddypress'), $display_version);
                ?>
				<?php 
            } else {
                ?>
					<?php 
                printf(__('Thanks for updating! With a focus on speed, admin tools, and developer enhancements, BuddyPress %s is our leanest and most powerful version yet.', 'buddypress'), $display_version);
                ?>
				<?php 
            }
            ?>
			</div>

			<div class="bp-badge"></div>

			<h2 class="nav-tab-wrapper">
				<a class="nav-tab nav-tab-active" href="<?php 
            echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-about'), 'index.php')));
            ?>
">
					<?php 
            _e('What&#8217;s New', 'buddypress');
            ?>
				</a><a class="nav-tab" href="<?php 
            echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-credits'), 'index.php')));
            ?>
">
					<?php 
            _e('Credits', 'buddypress');
            ?>
				</a>
			</h2>

			<?php 
            if ($is_new_install) {
                ?>
			<h3><?php 
                _e('Getting Started', 'buddypress');
                ?>
</h3>

				<div class="feature-section">
					<h4><?php 
                _e('Your Default Setup', 'buddypress');
                ?>
</h4>

					<?php 
                if (bp_is_active('members') && bp_is_active('activity') && current_user_can($this->capability)) {
                    ?>
						<p><?php 
                    printf(__('BuddyPress&#8217;s powerful features help your users connect and collaborate. To help get your community started, we&#8217;ve activated two of the most commonly used tools in BP: <strong>Extended Profiles</strong> and <strong>Activity Streams</strong>. See these components in action at the %1$s and %2$s directories, and be sure to spend a few minutes <a href="%3$s">configuring user profiles</a>. Want to explore more of BP&#8217;s features? Visit the <a href="%4$s">Components panel</a>.', 'buddypress'), $pretty_permalinks_enabled ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '">' . __('Members', 'buddypress') . '</a>' : __('Members', 'buddypress'), $pretty_permalinks_enabled ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_activity_root_slug()) . '">' . __('Activity', 'buddypress') . '</a>' : __('Activity', 'buddypress'), bp_get_admin_url(add_query_arg(array('page' => 'bp-profile-setup'), 'users.php')), bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page)));
                    ?>
</p>

					<?php 
                } else {
                    ?>
						<p><?php 
                    printf(__('BuddyPress&#8217;s powerful features help your users connect and collaborate. Want to explore BP&#8217;s features? Visit the <a href="%s">Components panel</a>.', 'buddypress'), bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page)));
                    ?>
</p>

					<?php 
                }
                ?>

					<h4><?php 
                _e('Community and Support', 'buddypress');
                ?>
</h4>
					<p><?php 
                _e('Looking for help? The <a href="http://codex.buddypress.org/">BuddyPress Codex</a> has you covered, with dozens of user-contributed guides on how to configure and use your BP site. Can&#8217;t find what you need? Stop by <a href="http://buddypress.org/support/">our support forums</a>, where a vibrant community of BuddyPress users and developers is waiting to share tips, show off their sites, talk about the future of BuddyPress, and much more.', 'buddypress');
                ?>
</p>
				</div>
				<hr />

			<?php 
            }
            ?>

			<div class="changelog">
				<h2 class="about-headline-callout"><?php 
            _e('Performance Improvements', 'buddypress');
            ?>
</h2>
				<img class="about-overview-img" src="<?php 
            echo $image_base;
            ?>
performance.png" alt="Performance improvements in BP 2.0" />
				<p><?php 
            esc_html_e('Whether your community has tens of members or tens of thousands, we think the performance improvements in BuddyPress 2.0 will knock your socks off. We&#8217;ve slashed our memory footprint and query overhead across the board, with a special focus on the Activity and Members components.', 'buddypress');
            ?>
</p>
			</div>

			<hr />

			<div class="changelog">
				<h2 class="about-headline-callout"><?php 
            _e('New Administrative Tools', 'buddypress');
            ?>
</h2>

				<div class="feature-section col two-col">
					<div>
						<h4><?php 
            esc_html_e('Extended Profiles in Admin', 'buddypress');
            ?>
</h4>
						<p><?php 
            esc_html_e('Site administrators can edit members&#8217; xProfile data at Dashboard > Users > Extended Profiles.', 'buddypress');
            ?>
</p>
						<img src="<?php 
            echo $image_base;
            ?>
admin-xprofile.jpg" style="width:90%" />
					</div>

					<div class="last-feature">
						<h4><?php 
            esc_html_e('Registration Management', 'buddypress');
            ?>
</h4>
						<p><?php 
            esc_html_e('Perform common tasks with pending signups - including resending activation emails and manually activating accounts - on the new Pending tab of Dashboard > Users.', 'buddypress');
            ?>
</p>
						<img src="<?php 
            echo $image_base;
            ?>
users-pending.jpg" style="width:90%" />
					</div>
				</div>

				<div class="feature-section col two-col">
					<div>
						<h4><?php 
            esc_html_e('BuddyPress Repair Tools', 'buddypress');
            ?>
</h4>
						<p><?php 
            esc_html_e('Dashboard > Tools > BuddyPress contains a number of tools for correcting data that occasionally gets out of sync on BP installs.', 'buddypress');
            ?>
</p>
						<img src="<?php 
            echo $image_base;
            ?>
tools-buddypress.jpg" style="width:90%" />
					</div>

					<div class="feature-section col two-col">
						<h4><?php 
            esc_html_e('Mark Spammers in Admin', 'buddypress');
            ?>
</h4>
						<p><?php 
            esc_html_e('Admins on non-Multisite installations can now perform spam actions from Dashboard > Users > All Users.', 'buddypress');
            ?>
</p>
						<img src="<?php 
            echo $image_base;
            ?>
user-mark-spam.jpg" style="width:90%" />
					</div>
				</div>

			</div>

			<hr />

			<div class="changelog">
				<h2 class="about-headline-callout"><?php 
            esc_html_e('A More Dynamic Activity Stream', 'buddypress');
            ?>
</h2>
				<div class="feature-section col two-col">
					<div>
						<p><?php 
            esc_html_e('Spend a lot of time viewing the activity stream? BuddyPress 2.0 automatically lets you know when new items are waiting to be loaded.', 'buddypress');
            ?>
</p>

						<p><?php 
            esc_html_e('The activity stream is better integrated with blog posts, too. Comment on a blog post, and an activity item is posted. Comment on a blog-related activity item, and a blog comment is posted. No more worrying about fractured conversations.', 'buddypress');
            ?>
</p>

						<p><?php 
            esc_html_e('We&#8217;ve also reworked the way that phrases like "Boone posted an update" are handled, so that they&#8217;re always up-to-date and always translatable.', 'buddypress');
            ?>
</p>
					</div>

					<div class="feature-section col two-col">
						<img src="<?php 
            echo $image_base;
            ?>
load-newest.jpg" style="width:90%" />
					</div>
				</div>
			</div>

			<hr />

			<div class="changelog">
				<h2 class="about-headline-callout"><?php 
            esc_html_e('Developer Tools', 'buddypress');
            ?>
</h2>

				<p><?php 
            esc_html_e('BuddyPress 2.0 is full of new and improved tools for the theme and plugin developer. A few highlights:', 'buddypress');
            ?>
</p>
					<ul>
						<li><?php 
            _e('The <code>BP_XProfile_Field_Type</code> class makes it a breeze to create new xProfile field types with custom display callbacks, validation, and more.', 'buddypress');
            ?>
</li>
						 <li><?php 
            _e('Major improvements have taken place with respect to object caching throughout BuddyPress. If you use Memcached, APC, or some other persistent object caching backend on your BuddyPress site, you should notice huge performance boosts.', 'buddypress');
            ?>
</li>
						 <li><?php 
            _e('Our internal metadata libraries have been rewritten to use WP&#8217;s <code>add_metadata()</code>, <code>update_metadata()</code>, and so on. This means greater consistency and parity between the components when storing and retrieving BuddyPress metadata.', 'buddypress');
            ?>
</li>
						 <li><?php 
            printf(__('<a href="%s">&hellip;and lots more!</a>', 'buddypress'), 'http://codex.buddypress.org/releases/version-2-0');
            ?>
</li>
					</ul>
				</div>

				<hr />

				<?php 
            if (current_user_can($this->capability)) {
                ?>
					<div class="return-to-dashboard">
						<a href="<?php 
                echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page)));
                ?>
"><?php 
                _e('Go to the BuddyPress Settings page', 'buddypress');
                ?>
</a>
					</div>
				<?php 
            }
            ?>

			</div>

		<?php 
        }
Example #16
0
/**
 * Return the deposit activity unfavorite link.
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses wp_nonce_url()
 * @uses home_url()
 * @uses bp_get_activity_root_slug()
 * @uses apply_filters() To call the 'humcore_get_deposit_activity_unfavorite_link' hook.
 *
 * @return string The activity unfavorite link.
 */
function humcore_get_deposit_activity_unfavorite_link($activity_id)
{
    global $activities_template;
    return apply_filters('humcore_get_deposit_activity_unfavorite_link', wp_nonce_url(home_url(bp_get_activity_root_slug() . '/unfavorite/' . $activity_id . '/'), 'unmark_favorite'));
}
>

<channel>
	<title><?php 
bp_site_name();
?>
 | <?php 
_e('Site Wide Activity', 'buddypress');
?>
</title>
	<atom:link href="<?php 
self_link();
?>
" rel="self" type="application/rss+xml" />
	<link><?php 
echo bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed';
?>
</link>
	<description><?php 
_e('Site Wide Activity Feed', 'buddypress');
?>
</description>
	<pubDate><?php 
echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
?>
</pubDate>
	<generator>http://buddypress.org/?v=<?php 
echo BP_VERSION;
?>
</generator>
	<language><?php 
>

<channel>
	<?php 
/* translators: Mentions RSS title - "[Site Name] | [Displayed User Name] | Mentions" */
?>
	<title><?php 
printf('%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __('Mentions', 'buddypress'));
?>
</title>
	<atom:link href="<?php 
self_link();
?>
" rel="self" type="application/rss+xml" />
	<link><?php 
echo home_url(bp_get_activity_root_slug() . '/#mentions/');
?>
</link>
	<?php 
/* translators: Mentions RSS title - "[Site Name] | [Displayed User Name] | Mentions" */
?>
	<description><?php 
printf(__('%s - Mentions', 'buddypress'), bp_get_displayed_user_fullname());
?>
</description>
	<pubDate><?php 
echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
?>
</pubDate>
	<generator>http://buddypress.org/?v=<?php 
echo BP_VERSION;
/**
 * Returns the sitewide activity feed link
 *
 * @since 1.0.0
 *
 * @uses home_url()
 * @uses bp_get_activity_root_slug()
 * @uses apply_filters() To call the 'bp_get_sitewide_activity_feed_link' hook
 *
 * @return string The sitewide activity feed link
 */
function bp_get_sitewide_activity_feed_link()
{
    return apply_filters('bp_get_sitewide_activity_feed_link', bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed/');
}
Example #20
0
File: config.php Project: 6226/wp
 /**
  * Applies restrictions based on the Theme options -> Memberships
  * @return void
  * @since 2.0
  */
 function kleo_pmpro_restrict_rules()
 {
     //if PMPRO is not activated
     if (!function_exists('pmpro_url')) {
         return;
     }
     //if buddypress is not activated
     if (!function_exists('bp_is_active')) {
         return;
     }
     //full current url
     $actual_link = kleo_full_url();
     //our request uri
     $home_url = home_url();
     //WPML support
     if (defined('ICL_SITEPRESS_VERSION')) {
         global $sitepress;
         $home_url = $sitepress->language_url(ICL_LANGUAGE_CODE);
     }
     $home_url = str_replace("www.", "", $home_url);
     $uri = str_replace(untrailingslashit($home_url), "", $actual_link);
     //restriction match array
     $final = array();
     $allowed_chars = apply_filters('kleo_pmpro_allowed_chars', "a-z 0-9~%.:_\\-");
     $restrict_options = kleo_memberships();
     $members_slug = str_replace('/', '\\/', bp_get_members_root_slug());
     /*-----------------------------------------------------------------------------------*/
     /* Preg match rules
     	/*-----------------------------------------------------------------------------------*/
     //members directory restriction rule
     $final["/^\\/" . $members_slug . "\\/?\$/"] = array('name' => 'members_dir', 'type' => $restrict_options['members_dir']['type'], 'levels' => isset($restrict_options['members_dir']['levels']) ? $restrict_options['members_dir']['levels'] : array());
     //members single profile restriction rule
     $final["/^\\/" . $members_slug . "\\/[" . $allowed_chars . "\\/]+\\/?\$/"] = array('name' => 'view_profiles', 'type' => $restrict_options['view_profiles']['type'], 'levels' => isset($restrict_options['view_profiles']['levels']) ? $restrict_options['view_profiles']['levels'] : array());
     if (function_exists('bp_get_groups_root_slug')) {
         $groups_slug = str_replace('/', '\\/', bp_get_groups_root_slug());
         //groups directory restriction rule
         $final["/^\\/" . $groups_slug . "\\/?\$/"] = array('name' => 'groups_dir', 'type' => $restrict_options['groups_dir']['type'], 'levels' => isset($restrict_options['groups_dir']['levels']) ? $restrict_options['groups_dir']['levels'] : array());
         //groups single page restriction rule
         $final["/^\\/" . $groups_slug . "\\/[" . $allowed_chars . "\\/]+\\/?\$/"] = array('name' => 'view_groups', 'type' => $restrict_options['view_groups']['type'], 'levels' => isset($restrict_options['view_groups']['levels']) ? $restrict_options['view_groups']['levels'] : array());
     }
     if (function_exists('bp_get_activity_root_slug')) {
         $activity_slug = str_replace('/', '\\/', bp_get_activity_root_slug());
         //activity page restriction rule
         $final["/^\\/" . $activity_slug . "\\/?\$/"] = array('name' => 'show_activity', 'type' => $restrict_options['show_activity']['type'], 'levels' => isset($restrict_options['show_activity']['levels']) ? $restrict_options['show_activity']['levels'] : array());
     }
     /* You can add extra restrictions using this filter */
     $final = apply_filters('kleo_pmpro_match_rules', $final);
     //no redirection for super-admin
     if (is_super_admin()) {
         return false;
     } elseif (is_user_logged_in()) {
         //restrict media
         if (preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/media\\/?/", $uri) || preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/album\\/?/", $uri)) {
             kleo_check_access('add_media', $restrict_options);
         } elseif (preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/messages\\/compose\\/?/", $uri) || preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/messages\\/view\\/[" . $allowed_chars . "\\/]?\\/?/", $uri)) {
             kleo_check_access('pm', $restrict_options);
         }
         /* Add other restrictions for own profile */
         do_action('kleo_pmro_extra_restriction_before_my_profile', $restrict_options);
         //allow me to view other parts of my profile
         if (bp_is_my_profile()) {
             return false;
         }
     }
     //loop trought remaining restrictions
     foreach ($final as $rk => $rv) {
         if (preg_match($rk, $uri)) {
             kleo_check_access($rv['name'], $restrict_options);
         }
     }
     do_action('kleo_pmro_extra_restriction_rules', $restrict_options);
 }
Example #21
0
 function test_activity_directory()
 {
     $this->go_to(bp_get_activity_directory_permalink());
     $this->assertEquals(bp_get_activity_root_slug(), bp_current_component());
 }
Example #22
0
 /**
  * Creates a favorite button
  */
 public function get_favorite_button($args = array())
 {
     $r = wp_parse_args($args, array('user_id' => bp_loggedin_user_id(), 'post_id' => get_the_ID(), 'blog_id' => get_current_blog_id()));
     $activity_id = $this->get_activity_id_for_post($r['post_id'], $r['blog_id']);
     // If there's no activity for this blog post, don't create a
     // button. should only happen for Private blogs
     if (!$activity_id) {
         return '';
     }
     if (0 == $r['user_id']) {
         $style_logged = 'style="background:rgba(125, 138, 88, 0.71);"';
     } else {
         $style_logged = '';
     }
     $afav_count = intval(bp_activity_get_meta($activity_id, 'thatcamp_favoriters_count'));
     if (0 === $afav_count) {
         $afav_gloss = 'No users have favorited this post yet.';
     } else {
         if (1 === $afav_count) {
             $afav_gloss = 'One user has favorited this post.';
         } else {
             $afav_gloss = sprintf('%s users have favorited this post.', number_format_i18n($afav_count));
         }
     }
     // Can't use the regular functions for building URL because it
     // breaks parse_url() for some reason
     if (!$this->user_has_favorited_activity($r['user_id'], $activity_id)) {
         $url_base = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/favorite/' . $activity_id . '/';
         $url_base = add_query_arg('redirect_to', urlencode(wp_guess_url()), $url_base);
         $nonce = wp_create_nonce('mark_favorite');
         $url = add_query_arg('_wpnonce', $nonce, $url_base);
         $class = 'button fav bp-secondary-action';
         $title = 'Mark as Favorite';
         $text = sprintf('Favorite <span class="fav-count">%s</span>', number_format_i18n($afav_count));
     } else {
         $url_base = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/unfavorite/' . $activity_id . '/';
         $url_base = add_query_arg('redirect_to', urlencode(wp_guess_url()), $url_base);
         $nonce = wp_create_nonce('unmark_favorite');
         $url = add_query_arg('_wpnonce', $nonce, $url_base);
         $class = 'button unfav bp-secondary-action';
         $title = 'Remove Favorite';
         $text = sprintf('Remove Favorite <span class="fav-count">%s</span>', number_format_i18n($afav_count));
     }
     return sprintf('<div class="thatcamp-favorite"><a href="%s" class="%s" title="%s" ' . $style_logged . '>%s</a> %s</div>', $url, $class, $title, $text, $afav_gloss);
 }
function mako_bp_login_redirect($redirect_url, $request_url, $user)
{
    global $bp;
    $selected_option = 'one';
    if ($selected_option == 'one') {
        return bp_core_get_user_domain($user->ID);
    } elseif ($selected_option == 'two') {
        $activity_slug = bp_get_activity_root_slug();
        $redirect_url = $bp->root_domain . "/" . $activity_slug;
        return $redirect_url;
    } else {
        $activity_slug = bp_get_activity_root_slug();
        $friends_activity = bp_core_get_user_domain($user->ID) . $activity_slug . "/friends/";
        return $friends_activity;
    }
}
Example #24
0
/**
 * Builds the reshare action url
 *
 * @package BP Reshare
 * @since    1.0
 * 
 * @global  BP_Activity_Template $activities_template
 * @uses    buddyreshare_activity_get_id_to_reshare() to get the activity id to reshare
 * @uses    wp_nonce_url() for security reason
 * @uses    bp_get_root_domain() to get the blog's url
 * @uses    bp_get_activity_root_slug() to get the activity slug
 * @uses    buddyreshare_get_component_slug() to get the component's slug
 * @return  string the action url
 */
function buddyreshare_activity_get_action_url()
{
    global $activities_template;
    $to_reshare = buddyreshare_activity_get_id_to_reshare();
    if (empty($to_reshare)) {
        return false;
    }
    $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/' . buddyreshare_get_component_slug() . '/add/' . $to_reshare . '/', 'buddyreshare_update');
    return apply_filters('buddyreshare_activity_get_action_url', $action_url);
}
	<title><?php 
bp_site_name();
?>
 | <?php 
echo $bp->displayed_user->fullname;
?>
 | <?php 
_e('Favorite Activity', 'buddypress');
?>
</title>
	<atom:link href="<?php 
self_link();
?>
" rel="self" type="application/rss+xml" />
	<link><?php 
echo home_url(bp_get_activity_root_slug() . '/#my-favorites/');
?>
</link>
	<description><?php 
echo $bp->displayed_user->fullname;
?>
 - <?php 
_e('Favorite Activity', 'buddypress');
?>
</description>
	<pubDate><?php 
echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
?>
</pubDate>
	<generator>http://buddypress.org/?v=<?php 
echo BP_VERSION;
/**
 * Returns the sitewide activity feed link.
 *
 * @since BuddyPress (1.0.0)
 *
 * @uses home_url()
 * @uses bp_get_activity_root_slug()
 * @uses apply_filters() To call the 'bp_get_sitewide_activity_feed_link' hook.
 *
 * @return string The sitewide activity feed link.
 */
function bp_get_sitewide_activity_feed_link()
{
    /**
     * Filters the sidewide activity feed link.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param string $value The feed link for sitewide activity.
     */
    return apply_filters('bp_get_sitewide_activity_feed_link', bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed/');
}
/**
 * Load the activity loop template when activity is requested via AJAX,
 *
 * @return string JSON object containing 'contents' (output of the template loop
 * for the Activity component) and 'feed_url' (URL to the relevant RSS feed).
 *
 * @since BuddyPress (1.2)
 */
function bp_legacy_theme_activity_template_loader()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    $scope = '';
    if (!empty($_POST['scope'])) {
        $scope = $_POST['scope'];
    }
    // We need to calculate and return the feed URL for each scope
    switch ($scope) {
        case 'friends':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/friends/feed/';
            break;
        case 'groups':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/groups/feed/';
            break;
        case 'favorites':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
            break;
        case 'mentions':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
            bp_activity_clear_new_mentions(bp_loggedin_user_id());
            break;
        default:
            $feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
            break;
    }
    // Buffer the loop in the template to a var for JS to spit out.
    ob_start();
    bp_get_template_part('activity/activity-loop');
    $result['contents'] = ob_get_contents();
    /**
     * Filters the feed URL for when activity is requested via AJAX.
     *
     * @since BuddyPress (1.7.0)
     *
     * @param string $feed_url URL for the feed to be used.
     * @param string $scope    Scope for the activity request.
     */
    $result['feed_url'] = apply_filters('bp_legacy_theme_activity_feed_url', $feed_url, $scope);
    ob_end_clean();
    exit(json_encode($result));
}
	<title><?php 
bp_site_name();
?>
 | <?php 
echo $bp->displayed_user->fullname;
?>
 | <?php 
_e('My Groups - Public Activity', 'buddypress');
?>
</title>
	<atom:link href="<?php 
self_link();
?>
" rel="self" type="application/rss+xml" />
	<link><?php 
echo home_url(bp_get_activity_root_slug() . '/#my-groups/');
?>
</link>
	<description><?php 
echo $bp->displayed_user->fullname;
?>
 - <?php 
_e('My Groups - Public Activity', 'buddypress');
?>
</description>
	<pubDate><?php 
echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
?>
</pubDate>
	<generator>http://buddypress.org/?v=<?php 
echo BP_VERSION;
Example #29
0
function bp_dtheme_activity_template_loader()
{
    global $bp;
    $scope = '';
    if (!empty($_POST['scope'])) {
        $scope = $_POST['scope'];
    }
    // We need to calculate and return the feed URL for each scope
    switch ($scope) {
        case 'friends':
            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/friends/feed/';
            break;
        case 'groups':
            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/groups/feed/';
            break;
        case 'favorites':
            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/favorites/feed/';
            break;
        case 'mentions':
            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/mentions/feed/';
            bp_activity_clear_new_mentions($bp->loggedin_user->id);
            break;
        default:
            $feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
            break;
    }
    /* Buffer the loop in the template to a var for JS to spit out. */
    ob_start();
    gconnect_locate_template(array('activity/activity-loop.php'), true);
    $result['contents'] = ob_get_contents();
    $result['feed_url'] = apply_filters('bp_dtheme_activity_feed_url', $feed_url, $scope);
    ob_end_clean();
    echo json_encode($result);
}
function bp_login_redirection($redirect_url, $request_url, $user)
{
    global $bp;
    $options = get_option('blr_settings');
    $selected_option = $options['blr_radio_field_0'];
    if ($selected_option == '1') {
        return bp_core_get_user_domain($user->ID);
    } elseif ($selected_option == '2') {
        $activity_slug = bp_get_activity_root_slug();
        $redirect_url = $bp->root_domain . "/" . $activity_slug;
        return $redirect_url;
    } elseif ($selected_option == '4') {
        //$activity_slug = bp_get_activity_root_slug();
        //$redirect_url = $bp->root_domain."/".$activity_slug;
        $redirect_url = $options['blr_text_field_1'];
        return $redirect_url;
    } else {
        $activity_slug = bp_get_activity_root_slug();
        $friends_activity = $user->ID . $activity_slug . "/friends/";
        return $friends_activity;
    }
}