/** * Sets pagination base * * @package WP Idea Stream * @subpackage buddypress/screens * * @since 2.0.0 * * @param array $pagination_args * @uses wp_idea_stream_buddypress_get_user_rates_url() to get BuddyPressified user's profiles rates part url * @uses wp_idea_stream_buddypress_get_user_comments_url() to get BuddyPressified user's profiles comments part url * @uses wp_idea_stream_buddypress_get_user_profile_url() to get BuddyPressified user's profiles url * @return array the new pagination args if needed */ public function set_pagination_base($pagination_args = '') { // Initialize base $base = ''; if ('rates' == $this->screen) { $base = wp_idea_stream_buddypress_get_user_rates_url($this->user_id, $this->username); } else { if ('comments' == $this->screen) { $base = wp_idea_stream_buddypress_get_user_comments_url($this->user_id, $this->username); } else { $base = wp_idea_stream_buddypress_get_user_profile_url($this->user_id, $this->username); // BuddyPress needs an extra action var to make sure pagination works in root profile page $base = trailingslashit($base . buddypress()->ideastream->idea_nav['ideas']['slug']); } } $pagination_args['base'] = $base . '%_%'; return $pagination_args; }
/** * Redirect IdeaStream profile to BuddyPress one * * @package WP Idea Stream * @subpackage buddypress/functions * * @since 2.0.0 * * @param string $context the context of the template * @uses wp_idea_stream_users_displayed_user_id() to get displayed user ID * @uses wp_idea_stream_users_get_displayed_user_username() to get displayed user nicename * @uses bp_core_redirect() to redirect the user to BuddyPress profile * @uses wp_idea_stream_buddypress_get_user_profile_url() to get the BuddyPressified user's profile */ function wp_idea_stream_buddypress_profile_redirect($context = '') { if (empty($context) || 'user-profile' != $context || wp_idea_stream_get_idea_var('is_user_embed')) { return; } // Be sure it's a user's profile $user_id = wp_idea_stream_users_displayed_user_id(); // Bail if not on WP Idea Stream built in profile if (empty($user_id)) { return; } // Get user nicename $user_nicename = wp_idea_stream_users_get_displayed_user_username(); // Safely redirect the user to his BuddyPress profile. bp_core_redirect(wp_idea_stream_buddypress_get_user_profile_url($user_id, $user_nicename)); }