Example #1
0
function devb_aawire_translate_whats_new_text($translated_text, $text, $domain)
{
    if ($text == "What's new, %s?" && $domain == 'buddypress' && !bp_is_my_profile() && bp_is_user()) {
        $translated_text = sprintf(__("Write something to %s?", 'buddypress'), bp_get_displayed_user_fullname());
    }
    return $translated_text;
}
/**
 * Adds the User Admin top-level menu to user pages
 *
 * @package BuddyPress
 * @since 1.5
 */
function bp_members_admin_bar_user_admin_menu()
{
    global $bp, $wp_admin_bar;
    // Only show if viewing a user
    if (!bp_is_user()) {
        return false;
    }
    // Don't show this menu to non site admins or if you're viewing your own profile
    if (!current_user_can('edit_users') || bp_is_my_profile()) {
        return false;
    }
    // User avatar
    $avatar = bp_core_fetch_avatar(array('item_id' => $bp->displayed_user->id, 'email' => $bp->displayed_user->userdata->user_email, 'width' => 16, 'height' => 16));
    // Unique ID for the 'My Account' menu
    $bp->user_admin_menu_id = !empty($avatar) ? 'user-admin-with-avatar' : 'user-admin';
    // Add the top-level User Admin button
    $wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => $avatar . bp_get_displayed_user_fullname(), 'href' => bp_displayed_user_domain()));
    // User Admin > Edit this user's profile
    $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'edit-profile', 'title' => __("Edit Profile", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit')));
    // User Admin > Edit this user's avatar
    $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'change-avatar', 'title' => __("Edit Avatar", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar')));
    // User Admin > Spam/unspam
    if (!bp_core_is_user_spammer(bp_displayed_user_id())) {
        $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'spam-user', 'title' => __('Mark as Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as a spammer?', 'buddypress') . '");')));
    } else {
        $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'unspam-user', 'title' => __('Not a Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as not a spammer?', 'buddypress') . '");')));
    }
    // User Admin > Delete Account
    $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'delete-user', 'title' => __('Delete Account', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user'), 'meta' => array('onclick' => 'confirm(" ' . __("Are you sure you want to delete this user's account?", 'buddypress') . '");')));
}
Example #3
0
function bebop_get_feed_description()
{
    global $this_bp_feed;
    if (!empty($this_bp_feed)) {
        return bebop_feed_type() . ' Feed for ' . bp_get_displayed_user_fullname();
    } else {
        return false;
    }
}
function bp_dtheme_js_terms()
{
    ?>
<script type="text/javascript">
<?php 
    if (get_option('priority_loading') == 'enable') {
        ?>
head.ready(function() {
<?php 
    }
    ?>
	var bp_terms_my_favs = '<?php 
    _e("My Favorites", "buddypress");
    ?>
';
	var bp_terms_accepted = '<?php 
    _e("Accepted", "buddypress");
    ?>
';
	var bp_terms_rejected = '<?php 
    _e("Rejected", "buddypress");
    ?>
';
	var bp_terms_show_all_comments = '<?php 
    _e("Show all comments for this thread", "buddypress");
    ?>
';
	var bp_terms_show_all = '<?php 
    _e("Show all", "buddypress");
    ?>
';
	var bp_terms_comments = '<?php 
    _e("comments", "buddypress");
    ?>
';
	var bp_terms_close = '<?php 
    _e("Close", "buddypress");
    ?>
';
	var bp_terms_mention_explain = '<?php 
    printf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", "buddypress"), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()));
    ?>
';
<?php 
    if (get_option('priority_loading') == 'enable') {
        ?>
});
<?php 
    }
    ?>
</script>
<?php 
}
Example #5
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;
 }
function bp_tpack_init()
{
    global $wp_themes;
    /* Check to make sure the active theme is not bp-default */
    if ('bp-default' == get_option('template')) {
        return false;
    }
    /* Load the default BuddyPress AJAX functions */
    if (!(int) get_option('bp_tpack_disable_js')) {
        require_once BP_PLUGIN_DIR . '/bp-themes/bp-default/_inc/ajax.php';
        /* Load the default BuddyPress javascript */
        wp_enqueue_script('bp-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'));
        // Add words that we need to use in JS to the end of the page so they can be
        // translated and still used.
        $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'mention_explain' => sprintf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress'), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname())));
        wp_localize_script('bp-js', 'BP_DTheme', $params);
    }
    /* Add the wireframe BP page styles */
    if (!(int) get_option('bp_tpack_disable_css')) {
        wp_enqueue_style('bp-css', plugins_url($path = basename(dirname(__FILE__))) . '/bp.css');
    }
}
/**
 * Process user deletion requests.
 *
 * Note: No longer called here. See the Settings component.
 */
function bp_core_action_delete_user()
{
    if (!bp_current_user_can('bp_moderate') || bp_is_my_profile() || !bp_displayed_user_id()) {
        return false;
    }
    if (bp_is_current_component('admin') && bp_is_current_action('delete-user')) {
        // Check the nonce
        check_admin_referer('delete-user');
        $errors = false;
        do_action('bp_core_before_action_delete_user', $errors);
        if (bp_core_delete_account(bp_displayed_user_id())) {
            bp_core_add_message(sprintf(__('%s has been deleted from the system.', 'buddypress'), bp_get_displayed_user_fullname()));
        } else {
            bp_core_add_message(sprintf(__('There was an error deleting %s from the system. Please try again.', 'buddypress'), bp_get_displayed_user_fullname()), 'error');
            $errors = true;
        }
        do_action('bp_core_action_delete_user', $errors);
        if ($errors) {
            bp_core_redirect(bp_displayed_user_domain());
        } else {
            bp_core_redirect(bp_loggedin_user_domain());
        }
    }
}
/**
 * Enqueues BuddyPress JS and related AJAX functions
 *
 * @since 1.2
 */
function bp_tpack_enqueue_scripts()
{
    // Do not enqueue JS if it's disabled
    if (get_option('bp_tpack_disable_js')) {
        return;
    }
    // Add words that we need to use in JS to the end of the page so they can be translated and still used.
    $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'));
    // BP 1.5+
    if (version_compare(BP_VERSION, '1.3', '>')) {
        // Bump this when changes are made to bust cache
        $version = '20110818';
        $params['view'] = __('View', 'buddypress');
    } else {
        $version = '20110729';
        if (bp_displayed_user_id()) {
            $params['mention_explain'] = sprintf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress'), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()));
        }
    }
    // Enqueue the global JS - Ajax will not work without it
    nxt_enqueue_script('dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), $version);
    // Localize the JS strings
    nxt_localize_script('dtheme-ajax-js', 'BP_DTheme', $params);
}
bp_displayed_user_fullname();
?>
 | <?php 
_e('Friends Activity', 'buddypress');
?>
</title>
	<atom:link href="<?php 
self_link();
?>
" rel="self" type="application/rss+xml" />
	<link><?php 
echo bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed';
?>
</link>
	<description><?php 
printf(__('%s - Friends Activity Feed', '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;
?>
</generator>
	<language><?php 
echo get_option('rss_language');
?>
</language>
	<?php 
Example #10
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);
     }
 }
    /**
     * Display the widget.
     *
     * @param array $args Widget arguments.
     * @param array $instance The widget settings, as saved by the user.
     */
    function widget($args, $instance)
    {
        extract($args);
        if (!bp_displayed_user_id()) {
            return;
        }
        $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
        wp_enqueue_script('bp_core_widget_friends-js', buddypress()->plugin_url . "bp-friends/js/widget-friends{$min}.js", array('jquery'), bp_get_version());
        $user_id = bp_displayed_user_id();
        $link = trailingslashit(bp_displayed_user_domain() . bp_get_friends_slug());
        $instance['title'] = sprintf(__('%s&#8217;s Friends', 'buddypress'), bp_get_displayed_user_fullname());
        if (empty($instance['friend_default'])) {
            $instance['friend_default'] = 'active';
        }
        $title = apply_filters('widget_title', $instance['title']);
        echo $before_widget;
        $title = $instance['link_title'] ? '<a href="' . esc_url($link) . '">' . esc_html($title) . '</a>' : esc_html($title);
        echo $before_title . $title . $after_title;
        $members_args = array('user_id' => absint($user_id), 'type' => sanitize_text_field($instance['friend_default']), 'max' => absint($instance['max_friends']), 'populate_extras' => 1);
        ?>

		<?php 
        if (bp_has_members($members_args)) {
            ?>
			<div class="item-options" id="friends-list-options">
				<a href="<?php 
            bp_members_directory_permalink();
            ?>
" id="newest-friends" <?php 
            if ($instance['friend_default'] == 'newest') {
                ?>
class="selected"<?php 
            }
            ?>
><?php 
            _e('Newest', 'buddypress');
            ?>
</a>
				| <a href="<?php 
            bp_members_directory_permalink();
            ?>
" id="recently-active-friends" <?php 
            if ($instance['friend_default'] == 'active') {
                ?>
class="selected"<?php 
            }
            ?>
><?php 
            _e('Active', 'buddypress');
            ?>
</a>
				| <a href="<?php 
            bp_members_directory_permalink();
            ?>
" id="popular-friends" <?php 
            if ($instance['friend_default'] == 'popular') {
                ?>
class="selected"<?php 
            }
            ?>
><?php 
            _e('Popular', 'buddypress');
            ?>
</a>
			</div>

			<ul id="friends-list" class="item-list">
				<?php 
            while (bp_members()) {
                bp_the_member();
                ?>
					<li class="vcard">
						<div class="item-avatar">
							<a href="<?php 
                bp_member_permalink();
                ?>
" title="<?php 
                bp_member_name();
                ?>
"><?php 
                bp_member_avatar();
                ?>
</a>
						</div>

						<div class="item">
							<div class="item-title fn"><a href="<?php 
                bp_member_permalink();
                ?>
" title="<?php 
                bp_member_name();
                ?>
"><?php 
                bp_member_name();
                ?>
</a></div>
							<div class="item-meta">
								<span class="activity">
								<?php 
                if ('newest' == $instance['friend_default']) {
                    bp_member_registered();
                }
                if ('active' == $instance['friend_default']) {
                    bp_member_last_active();
                }
                if ('popular' == $instance['friend_default']) {
                    bp_member_total_friend_count();
                }
                ?>
								</span>
							</div>
						</div>
					</li>

				<?php 
            }
            ?>
			</ul>
			<?php 
            wp_nonce_field('bp_core_widget_friends', '_wpnonce-friends');
            ?>
			<input type="hidden" name="friends_widget_max" id="friends_widget_max" value="<?php 
            echo absint($instance['max_friends']);
            ?>
" />

		<?php 
        } else {
            ?>

			<div class="widget-error">
				<?php 
            _e('Sorry, no members were found.', 'buddypress');
            ?>
			</div>

		<?php 
        }
        ?>

		<?php 
        echo $after_widget;
        ?>
	<?php 
    }
Example #12
0
/**
 * Filter the page title for BuddyPress pages.
 *
 * @since BuddyPress (1.5.0)
 *
 * @see wp_title()
 * @global object $bp BuddyPress global settings.
 *
 * @param string $title Original page title.
 * @param string $sep How to separate the various items within the page title.
 * @param string $seplocation Direction to display title.
 * @return string New page title.
 */
function bp_modify_page_title( $title, $sep = '', $seplocation = '' ) {
	global $bp;

	// If this is not a BP page, just return the title produced by WP
	if ( bp_is_blog_page() ) {
		return $title;
	}

	// If this is a 404, let WordPress handle it
	if ( is_404() ) {
		return $title;
	}

	// If this is the front page of the site, return WP's title
	if ( is_front_page() || is_home() ) {
		return $title;
	}

	$title = '';

	// Displayed user
	if ( bp_get_displayed_user_fullname() && ! is_404() ) {
		// Get the component's ID to try and get its name
		$component_id = $component_name = bp_current_component();

		// Use the component nav name
		if ( ! empty( $bp->bp_nav[$component_id] ) ) {
			// Remove counts that are added by the nav item
			$span = strpos( $bp->bp_nav[ $component_id ]['name'], '<span' );
			if ( false !== $span ) {
				$component_name = substr( $bp->bp_nav[ $component_id ]['name'], 0, $span - 1 );

			} else {
				$component_name = $bp->bp_nav[ $component_id ]['name'];
			}

		// Fall back on the component ID
		} elseif ( ! empty( $bp->{$component_id}->id ) ) {
			$component_name = ucwords( $bp->{$component_id}->id );
		}

		// Append action name if we're on a member component sub-page
		if ( ! empty( $bp->bp_options_nav[ $component_id ] ) && ! empty( $bp->canonical_stack['action'] ) ) {
			$component_subnav_name = wp_filter_object_list( $bp->bp_options_nav[ $component_id ], array( 'slug' => bp_current_action() ), 'and', 'name' );

			if ( $component_subnav_name ) {
				$component_subnav_name = array_shift( $component_subnav_name );
			} else {
				$component_subnav_name = '';
			}

		} else {
			$component_subnav_name = '';
		}

		// If on the user profile's landing page, just use the fullname
		if ( bp_is_current_component( $bp->default_component ) && bp_get_requested_url() === bp_displayed_user_domain() ) {
			$title = bp_get_displayed_user_fullname();

		// Use component name on member pages
		} else {
			// If we have a subnav name, add it separately for localization
			if ( ! empty( $component_subnav_name ) ) {
				// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator, 4 = component subnav name
				$title = strip_tags( sprintf( __( '%1$s %3$s %2$s %3$s %4$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep, $component_subnav_name ) );

			} else {
				// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator
				$title = strip_tags( sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep ) );
			}
		}

	// A single group
	} elseif ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) && ! empty( $bp->bp_options_nav[ $bp->groups->current_group->slug ] ) ) {
		$subnav = isset( $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] ) ? $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] : '';
		// translators: 1 = group name, 2 = group nav section name, 3 = separator
		$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $subnav, $sep );

	// A single item from a component other than groups
	} elseif ( bp_is_single_item() ) {
		// translators: 1 = component item name, 2 = component nav section name, 3 = separator
		$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[ bp_current_item() ][ bp_current_action() ]['name'], $sep );

	// An index or directory
	} elseif ( bp_is_directory() ) {
		$current_component = bp_current_component();

		// No current component (when does this happen?)
		if ( empty( $current_component ) ) {
			$title = _x( 'Directory', 'component directory title', 'buddypress' );
		} else {
			$title = bp_get_directory_title( $current_component );
		}

	// Sign up page
	} elseif ( bp_is_register_page() ) {
		$title = __( 'Create an Account', 'buddypress' );

	// Activation page
	} elseif ( bp_is_activation_page() ) {
		$title = __( 'Activate your Account', 'buddypress' );

	// Group creation page
	} elseif ( bp_is_group_create() ) {
		$title = __( 'Create a Group', 'buddypress' );

	// Blog creation page
	} elseif ( bp_is_create_blog() ) {
		$title = __( 'Create a Site', 'buddypress' );
	}

	// Some BP nav items contain item counts. Remove them
	$title = preg_replace( '|<span>[0-9]+</span>|', '', $title );

	return apply_filters( 'bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation );
}
 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);
 }
/**
 * Alias of {@link bp_get_displayed_user_fullname()}.
 */
function bp_user_fullname()
{
    echo bp_get_displayed_user_fullname();
}
/**
 * Load a user's favorites feed.
 *
 * @since 1.2.0
 *
 * @uses bp_is_user_activity()
 * @uses bp_is_current_action()
 * @uses bp_is_action_variable()
 * @uses status_header()
 *
 * @return bool False on failure.
 */
function bp_activity_action_favorites_feed()
{
    if (!bp_is_user_activity() || !bp_is_current_action('favorites') || !bp_is_action_variable('feed', 0)) {
        return false;
    }
    // Get displayed user's favorite activity IDs.
    $favs = bp_activity_get_user_favorites(bp_displayed_user_id());
    $fav_ids = implode(',', (array) $favs);
    // Setup the feed.
    buddypress()->activity->feed = new BP_Activity_Feed(array('id' => 'favorites', 'title' => sprintf(__('%1$s | %2$s | Favorites', 'buddypress'), bp_get_site_name(), bp_get_displayed_user_fullname()), 'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/', 'description' => sprintf(__("Activity feed of %s's favorites.", 'buddypress'), bp_get_displayed_user_fullname()), 'activity_args' => 'include=' . $fav_ids));
}
 /**
  * Update the global $post with the displayed user's data.
  *
  * @since BuddyPress (1.7.0)
  */
 public function single_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_displayed_user_fullname(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
Example #17
0
 /**
  * RSS handler for a user's followed sites.
  *
  * When a user lands on /members/USERNAME/activity/followblogs/feed/, this
  * method generates the RSS feed for their followed sites.
  */
 public static function rss_handler()
 {
     // only available in BP 1.8+
     if (!class_exists('BP_Activity_Feed')) {
         return;
     }
     if (!bp_is_user_activity() || !bp_is_current_action(constant('BP_FOLLOW_BLOGS_USER_ACTIVITY_SLUG')) || !bp_is_action_variable('feed', 0)) {
         return;
     }
     // get blog IDs that the user is following
     $following_ids = bp_get_following_ids(array('follow_type' => 'blogs'));
     // if $following_ids is empty, pass a negative number so no blogs can be found
     $following_ids = empty($following_ids) ? -1 : $following_ids;
     $args = array('user_id' => 0, 'object' => 'blogs', 'primary_id' => $following_ids);
     // setup the feed
     buddypress()->activity->feed = new BP_Activity_Feed(array('id' => 'followedsites', 'title' => sprintf(__('%1$s | %2$s | Followed Site Activity', 'bp-follow'), bp_get_site_name(), bp_get_displayed_user_fullname()), 'link' => trailingslashit(bp_displayed_user_domain() . bp_get_activity_slug() . '/' . constant('BP_FOLLOW_BLOGS_USER_ACTIVITY_SLUG')), 'description' => sprintf(__("Activity feed for sites that %s is following.", 'buddypress'), bp_get_displayed_user_fullname()), 'activity_args' => $args));
 }
 /**
  * Set up the title for pages and <title>.
  *
  * @since 1.9.0
  */
 public function setup_title()
 {
     // Adjust title.
     if (bp_is_notifications_component()) {
         $bp = buddypress();
         if (bp_is_my_profile()) {
             $bp->bp_options_title = __('Notifications', 'buddypress');
         } else {
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), bp_get_displayed_user_fullname())));
             $bp->bp_options_title = bp_get_displayed_user_fullname();
         }
     }
     parent::setup_title();
 }
/**
 * Add RSS feed support for a user's following activity.
 *
 * eg. example.com/members/USERNAME/activity/following/feed/
 *
 * Only available in BuddyPress 1.8+.
 *
 * @since 1.2.1
 * @author r-a-y
 */
function bp_follow_my_following_feed()
{
    // only available in BP 1.8+
    if (!class_exists('BP_Activity_Feed')) {
        return;
    }
    if (!bp_is_user_activity() || !bp_is_current_action(constant('BP_FOLLOWING_SLUG')) || !bp_is_action_variable('feed', 0)) {
        return false;
    }
    global $bp;
    // setup the feed
    $bp->activity->feed = new BP_Activity_Feed(array('id' => 'myfollowing', 'title' => sprintf(__('%1$s | %2$s | Following Activity', 'bp-follow'), bp_get_site_name(), bp_get_displayed_user_fullname()), 'link' => trailingslashit(bp_displayed_user_domain() . bp_get_activity_slug() . '/' . constant('BP_FOLLOWING_SLUG')), 'description' => sprintf(__("Activity feed for people that %s is following.", 'buddypress'), bp_get_displayed_user_fullname()), 'activity_args' => array('user_id' => bp_get_following_ids(), 'display_comments' => 'threaded')));
}
Example #20
0
 /**
  * Set up the title for pages and <title>.
  *
  * @since BuddyPress (1.5.0)
  *
  * @uses bp_is_activity_component()
  * @uses bp_is_my_profile()
  * @uses bp_core_fetch_avatar()
  */
 public function setup_title()
 {
     $bp = buddypress();
     // Adjust title based on view
     if (bp_is_activity_component()) {
         if (bp_is_my_profile()) {
             $bp->bp_options_title = _x('My Activity', 'Page and <title>', 'buddypress');
         } else {
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), bp_get_displayed_user_fullname())));
             $bp->bp_options_title = bp_get_displayed_user_fullname();
         }
     }
     parent::setup_title();
 }
/**
 * Select between two dynamic strings, according to context.
 *
 * This function can be used in cases where a phrase used in a template will
 * differ for a user looking at his own profile and a user looking at another
 * user's profile (eg, "My Friends" and "Joe's Friends"). Pass both versions
 * of the phrase, and bp_word_or_name() will detect which is appropriate, and
 * do the necessary argument swapping for dynamic phrases.
 *
 * @param string $youtext    The "you" version of the phrase (eg "Your Friends").
 * @param string $nametext   The other-user version of the phrase. Should be in
 *                           a format appropriate for sprintf() - use %s in place of the displayed
 *                           user's name (eg "%'s Friends").
 * @param bool   $capitalize Optional. Force into title case. Default: true.
 * @param bool   $echo       Optional. True to echo the results, false to return them.
 *                           Default: true.
 * @return string|null $nametext If ! $echo, returns the appropriate string.
 */
function bp_word_or_name($youtext, $nametext, $capitalize = true, $echo = true)
{
    if (!empty($capitalize)) {
        $youtext = bp_core_ucfirst($youtext);
    }
    if (bp_displayed_user_id() == bp_loggedin_user_id()) {
        if (true == $echo) {
            /**
             * Filters the text used based on context of own profile or someone else's profile.
             *
             * @since 1.0.0
             *
             * @param string $youtext Context-determined string to display.
             */
            echo apply_filters('bp_word_or_name', $youtext);
        } else {
            /** This filter is documented in bp-core/bp-core-template.php */
            return apply_filters('bp_word_or_name', $youtext);
        }
    } else {
        $fullname = bp_get_displayed_user_fullname();
        $fullname = (array) explode(' ', $fullname);
        $nametext = sprintf($nametext, $fullname[0]);
        if (true == $echo) {
            /** This filter is documented in bp-core/bp-core-template.php */
            echo apply_filters('bp_word_or_name', $nametext);
        } else {
            /** This filter is documented in bp-core/bp-core-template.php */
            return apply_filters('bp_word_or_name', $nametext);
        }
    }
}
Example #22
0
 /**
  * Sets up the title for pages and <title>
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 public function setup_title()
 {
     $bp = buddypress();
     if (bp_is_buddyblog_component()) {
         if (bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_title = __('Posts', 'buddyblog');
         } elseif (!bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(__('Profile picture of %s', 'buddyblog'), bp_get_displayed_user_fullname())));
             $bp->bp_options_title = bp_get_displayed_user_fullname();
             // We are viewing a single group, so set up the
             // group navigation menu using the $this->current_group global.
         }
     }
     parent::setup_title();
 }
 /**
  * Constructor method.
  *
  * The arguments passed to this class constructor are of the same
  * format as {@link BP_Activity_Activity::get()}.
  *
  * @since 1.5.0
  *
  * @see BP_Activity_Activity::get() for a description of the argument
  *      structure, as well as default values.
  *
  * @param array $args {
  *     Array of arguments. Supports all arguments from
  *     BP_Activity_Activity::get(), as well as 'page_arg' and
  *     'include'. Default values for 'per_page' and 'display_comments'
  *     differ from the originating function, and are described below.
  *     @type string      $page_arg         The string used as a query parameter in
  *                                         pagination links. Default: 'acpage'.
  *     @type array|bool  $include          Pass an array of activity IDs to
  *                                         retrieve only those items, or false to noop the 'include'
  *                                         parameter. 'include' differs from 'in' in that 'in' forms
  *                                         an IN clause that works in conjunction with other filters
  *                                         passed to the function, while 'include' is interpreted as
  *                                         an exact list of items to retrieve, which skips all other
  *                                         filter-related parameters. Default: false.
  *     @type int|bool    $per_page         Default: 20.
  *     @type string|bool $display_comments Default: 'threaded'.
  * }
  */
 public function __construct($args)
 {
     $bp = buddypress();
     // Backward compatibility with old method of passing arguments.
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '1.6', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'page', 1 => 'per_page', 2 => 'max', 3 => 'include', 4 => 'sort', 5 => 'filter', 6 => 'search_terms', 7 => 'display_comments', 8 => 'show_hidden', 9 => 'exclude', 10 => 'in', 11 => 'spam', 12 => 'page_arg');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $defaults = array('page' => 1, 'per_page' => 20, 'page_arg' => 'acpage', 'max' => false, 'fields' => 'all', 'count_total' => false, 'sort' => false, 'include' => false, 'exclude' => false, 'in' => false, 'filter' => false, 'scope' => false, 'search_terms' => false, 'meta_query' => false, 'date_query' => false, 'filter_query' => false, 'display_comments' => 'threaded', 'show_hidden' => false, 'spam' => 'ham_only', 'update_meta_cache' => true);
     $r = wp_parse_args($args, $defaults);
     extract($r);
     $this->pag_arg = sanitize_key($r['page_arg']);
     $this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $r['page']);
     $this->pag_num = bp_sanitize_pagination_arg('num', $r['per_page']);
     // Check if blog/forum replies are disabled.
     $this->disable_blogforum_replies = (bool) bp_core_get_root_option('bp-disable-blogforum-comments');
     // Get an array of the logged in user's favorite activities.
     $this->my_favs = maybe_unserialize(bp_get_user_meta(bp_loggedin_user_id(), 'bp_favorite_activities', true));
     // Fetch specific activity items based on ID's.
     if (!empty($include)) {
         $this->activities = bp_activity_get_specific(array('activity_ids' => explode(',', $include), 'max' => $max, 'count_total' => $count_total, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments, 'show_hidden' => $show_hidden, 'spam' => $spam, 'update_meta_cache' => $update_meta_cache));
         // Fetch all activity items.
     } else {
         $this->activities = bp_activity_get(array('display_comments' => $display_comments, 'max' => $max, 'count_total' => $count_total, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'meta_query' => $meta_query, 'date_query' => $date_query, 'filter_query' => $filter_query, 'filter' => $filter, 'scope' => $scope, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, 'spam' => $spam, 'update_meta_cache' => $update_meta_cache));
     }
     // The total_activity_count property will be set only if a
     // 'count_total' query has taken place.
     if (!is_null($this->activities['total'])) {
         if (!$max || $max >= (int) $this->activities['total']) {
             $this->total_activity_count = (int) $this->activities['total'];
         } else {
             $this->total_activity_count = (int) $max;
         }
     }
     $this->has_more_items = $this->activities['has_more_items'];
     $this->activities = $this->activities['activities'];
     if ($max) {
         if ($max >= count($this->activities)) {
             $this->activity_count = count($this->activities);
         } else {
             $this->activity_count = (int) $max;
         }
     } else {
         $this->activity_count = count($this->activities);
     }
     $this->full_name = bp_get_displayed_user_fullname();
     // Fetch parent content for activity comments so we do not have to query in the loop.
     foreach ((array) $this->activities as $activity) {
         if ('activity_comment' != $activity->type) {
             continue;
         }
         $parent_ids[] = $activity->item_id;
     }
     if (!empty($parent_ids)) {
         $activity_parents = bp_activity_get_specific(array('activity_ids' => $parent_ids));
     }
     if (!empty($activity_parents['activities'])) {
         foreach ($activity_parents['activities'] as $parent) {
             $this->activity_parents[$parent->id] = $parent;
         }
         unset($activity_parents);
     }
     if ((int) $this->total_activity_count && (int) $this->pag_num) {
         $this->pag_links = paginate_links(array('base' => add_query_arg($this->pag_arg, '%#%'), 'format' => '', 'total' => ceil((int) $this->total_activity_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => _x('&larr;', 'Activity pagination previous text', 'buddypress'), 'next_text' => _x('&rarr;', 'Activity pagination next text', 'buddypress'), 'mid_size' => 1, 'add_args' => array()));
     }
 }
<?php

do_action('bp_before_profile_loop_content');
?>

<?php 
$ud = get_userdata(bp_displayed_user_id());
?>

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

	<div class="bp-widget wp-profile">
		<h4><?php 
bp_is_my_profile() ? _e('My Profile', 'vibe') : printf(__("%s's Profile", 'vibe'), bp_get_displayed_user_fullname());
?>
</h4>

		<table class="wp-profile-fields">

			<?php 
if ($ud->display_name) {
    ?>

				<tr id="wp_displayname">
					<td class="label"><?php 
    _e('Name', 'vibe');
    ?>
</td>
					<td class="data"><?php 
 /**
  * Set up the title for pages and <title>.
  */
 public function setup_title()
 {
     $bp = buddypress();
     if (bp_is_my_profile()) {
         $bp->bp_options_title = __('You', 'buddypress');
     } elseif (bp_is_user()) {
         $bp->bp_options_title = bp_get_displayed_user_fullname();
         $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), $bp->bp_options_title)));
     }
     parent::setup_title();
 }
Example #26
0
/**
 * Output navigation tabs for a user Blogs page.
 *
 * Currently unused by BuddyPress.
 */
function bp_blogs_blog_tabs()
{
    // Don't show these tabs on a user's own profile
    if (bp_is_my_profile()) {
        return false;
    }
    ?>

	<ul class="content-header-nav">
		<li<?php 
    if (bp_is_current_action('my-blogs') || !bp_current_action()) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/my-blogs');
    ?>
"><?php 
    printf(__("%s's Sites", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
		<li<?php 
    if (bp_is_current_action('recent-posts')) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/recent-posts');
    ?>
"><?php 
    printf(__("%s's Recent Posts", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
		<li<?php 
    if (bp_is_current_action('recent-comments')) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/recent-comments');
    ?>
"><?php 
    printf(__("%s's Recent Comments", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
	</ul>

<?php 
    /**
     * Fires after the markup for the navigation tabs for a user Blogs page.
     *
     * @since BuddyPress (1.0.0)
     */
    do_action('bp_blogs_blog_tabs');
}
 function wds_metadesc()
 {
     if (is_admin()) {
         return false;
     }
     global $post, $wp_query;
     //global $wds_options;
     $wds_options = get_wds_options();
     if (is_singular()) {
         if (function_exists('groups_get_current_group') && 'groups' == bp_current_component() && ($group = groups_get_current_group())) {
             // BP group?
             $optvar = !empty($wds_options['metadesc-bp_groups']) ? $wds_options['metadesc-bp_groups'] : '';
             $metadesc = wds_replace_vars($optvar, array('name' => $group->name, 'description' => $group->description));
         } else {
             if (function_exists('bp_current_component') && 'profile' == bp_current_component()) {
                 $optvar = !empty($wds_options['metadesc-bp_profile']) ? $wds_options['metadesc-bp_profile'] : '';
                 $metadesc = wds_replace_vars($optvar, array('full_name' => bp_get_displayed_user_fullname(), 'username' => bp_get_displayed_user_username()));
             } else {
                 $metadesc = wds_get_value('metadesc');
                 if (empty($metadesc)) {
                     $optvar = !empty($wds_options['metadesc-' . $post->post_type]) ? $wds_options['metadesc-' . $post->post_type] : '';
                     $metadesc = wds_replace_vars($optvar, (array) $post);
                 }
             }
         }
     } else {
         if (function_exists('is_shop') && is_shop() && function_exists('woocommerce_get_page_id')) {
             // WooCommerce shop page
             $post_id = woocommerce_get_page_id('shop');
             $metadesc = wds_get_value('metadesc', $post_id);
             if (empty($metadesc)) {
                 $optvar = !empty($wds_options['metadesc-' . $post->post_type]) ? $wds_options['metadesc-' . $post->post_type] : '';
                 $metadesc = wds_replace_vars($optvar, (array) $post);
             }
         } else {
             if (is_home() && 'posts' == get_option('show_on_front') && isset($wds_options['metadesc-home'])) {
                 $metadesc = wds_replace_vars($wds_options['metadesc-home'], array());
             } else {
                 if (is_home() && 'posts' != get_option('show_on_front')) {
                     $post = get_post(get_option('page_for_posts'));
                     $metadesc = wds_get_value('metadesc');
                     if (($metadesc == '' || !$metadesc) && isset($wds_options['metadesc-' . $post->post_type])) {
                         $metadesc = wds_replace_vars($wds_options['metadesc-' . $post->post_type], (array) $post);
                     }
                 } else {
                     if (is_category() || is_tag() || is_tax()) {
                         $term = $wp_query->get_queried_object();
                         $metadesc = wds_get_term_meta($term, $term->taxonomy, 'wds_desc');
                         if (!$metadesc && isset($wds_options['metadesc-' . $term->taxonomy])) {
                             $metadesc = wds_replace_vars($wds_options['metadesc-' . $term->taxonomy], (array) $term);
                         }
                     } else {
                         if (is_author()) {
                             $author_id = get_query_var('author');
                             $metadesc = get_the_author_meta('wds_metadesc', $author_id);
                         } else {
                             if (function_exists('groups_get_current_group') && 'groups' == bp_current_component() && ($group = groups_get_current_group())) {
                                 // BP group?
                                 $optvar = !empty($wds_options['metadesc-bp_groups']) ? $wds_options['metadesc-bp_groups'] : '';
                                 $metadesc = wds_replace_vars($optvar, array('name' => $group->name, 'description' => $group->description));
                             } else {
                                 if (function_exists('bp_current_component') && 'profile' == bp_current_component()) {
                                     $optvar = !empty($wds_options['metadesc-bp_profile']) ? $wds_options['metadesc-bp_profile'] : '';
                                     $metadesc = wds_replace_vars($optvar, array('full_name' => bp_get_displayed_user_fullname(), 'username' => bp_get_displayed_user_username()));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!empty($metadesc)) {
         echo "\t" . '<meta name="description" content="' . esc_attr(strip_tags(stripslashes(apply_filters('wds_metadesc', $metadesc)))) . '" />' . "\n";
     }
 }
/**
 * Get the title parts of the BuddyPress displayed page
 *
 * @since 2.4.3
 *
 * @param string $seplocation Location for the separator.
 * @return array the title parts
 */
function bp_get_title_parts($seplocation = 'right')
{
    $bp = buddypress();
    // Defaults to an empty array.
    $bp_title_parts = array();
    // If this is not a BP page, return the empty array.
    if (bp_is_blog_page()) {
        return $bp_title_parts;
    }
    // If this is a 404, return the empty array.
    if (is_404()) {
        return $bp_title_parts;
    }
    // If this is the front page of the site, return the empty array.
    if (is_front_page() || is_home()) {
        return $bp_title_parts;
    }
    // Return the empty array if not a BuddyPress page.
    if (!is_buddypress()) {
        return $bp_title_parts;
    }
    // Now we can build the BP Title Parts
    // Is there a displayed user, and do they have a name?
    $displayed_user_name = bp_get_displayed_user_fullname();
    // Displayed user.
    if (!empty($displayed_user_name) && !is_404()) {
        // Get the component's ID to try and get its name.
        $component_id = $component_name = bp_current_component();
        // Set empty subnav name.
        $component_subnav_name = '';
        if (!empty($bp->members->nav)) {
            $primary_nav_item = $bp->members->nav->get_primary(array('slug' => $component_id), false);
            $primary_nav_item = reset($primary_nav_item);
        }
        // Use the component nav name.
        if (!empty($primary_nav_item->name)) {
            $component_name = _bp_strip_spans_from_title($primary_nav_item->name);
            // Fall back on the component ID.
        } elseif (!empty($bp->{$component_id}->id)) {
            $component_name = ucwords($bp->{$component_id}->id);
        }
        if (!empty($bp->members->nav)) {
            $secondary_nav_item = $bp->members->nav->get_secondary(array('parent_slug' => $component_id, 'slug' => bp_current_action()), false);
            if ($secondary_nav_item) {
                $secondary_nav_item = reset($secondary_nav_item);
            }
        }
        // Append action name if we're on a member component sub-page.
        if (!empty($secondary_nav_item->name) && !empty($bp->canonical_stack['action'])) {
            $component_subnav_name = $secondary_nav_item->name;
        }
        // If on the user profile's landing page, just use the fullname.
        if (bp_is_current_component($bp->default_component) && bp_get_requested_url() === bp_displayed_user_domain()) {
            $bp_title_parts[] = $displayed_user_name;
            // Use component name on member pages.
        } else {
            $bp_title_parts = array_merge($bp_title_parts, array_map('strip_tags', array($displayed_user_name, $component_name)));
            // If we have a subnav name, add it separately for localization.
            if (!empty($component_subnav_name)) {
                $bp_title_parts[] = strip_tags($component_subnav_name);
            }
        }
        // A single item from a component other than Members.
    } elseif (bp_is_single_item()) {
        $component_id = bp_current_component();
        if (!empty($bp->{$component_id}->nav)) {
            $secondary_nav_item = $bp->{$component_id}->nav->get_secondary(array('parent_slug' => bp_current_item(), 'slug' => bp_current_action()), false);
            if ($secondary_nav_item) {
                $secondary_nav_item = reset($secondary_nav_item);
            }
        }
        $single_item_subnav = '';
        if (!empty($secondary_nav_item->name)) {
            $single_item_subnav = $secondary_nav_item->name;
        }
        $bp_title_parts = array($bp->bp_options_title, $single_item_subnav);
        // An index or directory.
    } elseif (bp_is_directory()) {
        $current_component = bp_current_component();
        // No current component (when does this happen?).
        $bp_title_parts = array(_x('Directory', 'component directory title', 'buddypress'));
        if (!empty($current_component)) {
            $bp_title_parts = array(bp_get_directory_title($current_component));
        }
        // Sign up page.
    } elseif (bp_is_register_page()) {
        $bp_title_parts = array(__('Create an Account', 'buddypress'));
        // Activation page.
    } elseif (bp_is_activation_page()) {
        $bp_title_parts = array(__('Activate Your Account', 'buddypress'));
        // Group creation page.
    } elseif (bp_is_group_create()) {
        $bp_title_parts = array(__('Create a Group', 'buddypress'));
        // Blog creation page.
    } elseif (bp_is_create_blog()) {
        $bp_title_parts = array(__('Create a Site', 'buddypress'));
    }
    // Strip spans.
    $bp_title_parts = array_map('_bp_strip_spans_from_title', $bp_title_parts);
    // Sep on right, so reverse the order.
    if ('right' === $seplocation) {
        $bp_title_parts = array_reverse($bp_title_parts);
    }
    /**
     * Filter BuddyPress title parts before joining.
     *
     * @since 2.4.3
     *
     * @param array $bp_title_parts Current BuddyPress title parts.
     * @return array
     */
    return (array) apply_filters('bp_get_title_parts', $bp_title_parts);
}
/**
 * Handles the deleting of a user
 */
function bp_settings_action_delete_account()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Bail if no submit action
    if (!isset($_POST['delete-account-understand'])) {
        return;
    }
    // Bail if not in settings
    if (!bp_is_settings_component() || !bp_is_current_action('delete-account')) {
        return false;
    }
    // 404 if there are any additional action variables attached
    if (bp_action_variables()) {
        bp_do_404();
        return;
    }
    // Bail if account deletion is disabled
    if (bp_disable_account_deletion() && !bp_current_user_can('delete_users')) {
        return false;
    }
    // Nonce check
    check_admin_referer('delete-account');
    // Get username now because it might be gone soon!
    $username = bp_get_displayed_user_fullname();
    // delete the users account
    if (bp_core_delete_account(bp_displayed_user_id())) {
        // Add feedback ater deleting a user
        bp_core_add_message(sprintf(__('%s was successfully deleted.', 'buddypress'), $username), 'success');
        // Redirect to the root domain
        bp_core_redirect(bp_get_root_domain());
    }
}
 /**
  * Set up the title for pages and <title>.
  */
 public function setup_title()
 {
     if (bp_is_groups_component()) {
         $bp = buddypress();
         if (bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_title = _x('Memberships', 'My Groups page <title>', 'buddypress');
         } elseif (!bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), bp_get_displayed_user_fullname())));
             $bp->bp_options_title = bp_get_displayed_user_fullname();
             // We are viewing a single group, so set up the
             // group navigation menu using the $this->current_group global.
         } elseif (bp_is_single_item()) {
             $bp->bp_options_title = $this->current_group->name;
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => $this->current_group->id, 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => __('Group Profile Photo', 'buddypress')));
             if (empty($bp->bp_options_avatar)) {
                 $bp->bp_options_avatar = '<img src="' . esc_url(bp_core_avatar_default_thumb()) . '" alt="' . esc_attr__('No Group Profile Photo', 'buddypress') . '" class="avatar" />';
             }
         }
     }
     parent::setup_title();
 }