function bphelp_pbpp_redirect() { global $bp; //IMPORTANT: Do not alter the following line. $bphelp_my_redirect_slug = get_option('bphelp-my-redirect-slug', 'register'); if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bbp_is_single_forum() || bbp_is_single_topic() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_members_component() || bp_is_profile_component()) { if (!is_user_logged_in()) { bp_core_redirect(get_option('home') . '/' . $bphelp_my_redirect_slug); } } }
/** * Are we looking at something that needs Blogs theme compatibility? * * @since 1.7.0 */ public function is_blogs() { // Bail if not looking at a group. if (!bp_is_blogs_component()) { return; } // Bail if looking at a users sites. if (bp_is_user()) { return; } // Blog Directory. if (is_multisite() && !bp_current_action()) { bp_update_is_directory(true, 'blogs'); /** * Fires if in the blog directory and BuddyPress needs Blog theme compatibility, * before the actions and filters are added. * * @since 1.5.0 */ do_action('bp_blogs_screen_index'); add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy')); add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post')); add_filter('bp_replace_the_content', array($this, 'directory_content')); // Create blog. } elseif (is_user_logged_in() && bp_blog_signup_enabled()) { add_filter('bp_get_buddypress_template', array($this, 'create_template_hierarchy')); add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post')); add_filter('bp_replace_the_content', array($this, 'create_content')); } }
function bp_blogs_screen_index() { if (is_multisite() && bp_is_blogs_component() && !bp_current_action()) { bp_update_is_directory(true, 'blogs'); do_action('bp_blogs_screen_index'); bp_core_load_template(apply_filters('bp_blogs_screen_index', 'blogs/index')); } }
function bp_blogs_redirect_to_random_blog() { global $bp, $nxtdb; if (bp_is_blogs_component() && isset($_GET['random-blog'])) { $blog = bp_blogs_get_random_blogs(1, 1); bp_core_redirect(get_site_url($blog['blogs'][0]->blog_id)); } }
function wff_blog_creation_button() { if (bp_is_blogs_component() && bp_is_directory() && is_user_logged_in()) { ?> <div class="btn btn-primary create-group-button hidden-xs"> <i class="fa fa-desktop"></i> <?php bp_blog_create_button(); ?> </div> <?php } }
/** * Redirect to a random blog in the multisite network * * @since BuddyPress (1.0) * @package BuddyPress * @subpackage BlogsActions */ function bp_blogs_redirect_to_random_blog() { // Bail if not looking for a random blog if (!bp_is_blogs_component() || !isset($_GET['random-blog'])) { return; } // Multisite is active so find a random blog if (is_multisite()) { $blog = bp_blogs_get_random_blogs(1, 1); bp_core_redirect(get_site_url($blog['blogs'][0]->blog_id)); // No multisite and still called, always redirect to root } else { bp_core_redirect(bp_core_get_root_domain()); } }
/** * Load the "Create a Blog" screen. */ function bp_blogs_screen_create_a_blog() { if (!is_multisite() || !bp_is_blogs_component() || !bp_is_current_action('create')) { return false; } if (!is_user_logged_in() || !bp_blog_signup_enabled()) { return false; } /** * Fires right before the loading of the Create A Blog screen template file. * * @since 1.0.0 */ do_action('bp_blogs_screen_create_a_blog'); bp_core_load_template(apply_filters('bp_blogs_template_create_a_blog', 'blogs/create')); }
function logged_out_redirect() { global $bp; // BuddyPress components to lock if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_page(BP_MEMBERS_SLUG) || bp_is_profile_component()) { // Check if user is logged out if (!is_user_logged_in()) { // Check if a page was selected for redirection if (of_get_option('redirect')) { $redirect_page = get_permalink(of_get_option('redirect')); // If not redirect to login page } else { $redirect_page = site_url('/wp-login.php'); } wp_redirect($redirect_page); exit; } } }
/** * Are we looking at something that needs Blogs theme compatability? * * @since BuddyPress (1.7.0) */ public function is_blogs() { // Bail if not looking at a group if (!bp_is_blogs_component()) { return; } // Bail if looking at a users sites if (bp_is_user()) { return; } // Blog Directory if (is_multisite() && !bp_current_action()) { bp_update_is_directory(true, 'blogs'); do_action('bp_blogs_screen_index'); add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy')); add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post')); add_filter('bp_replace_the_content', array($this, 'directory_content')); // Create blog } elseif (is_user_logged_in() && bp_blog_signup_enabled()) { add_filter('bp_get_buddypress_template', array($this, 'create_template_hierarchy')); add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post')); add_filter('bp_replace_the_content', array($this, 'create_content')); } }
/** * widget for the community navigation * * @package Custom Community * @since 1.8.3 */ function widget_community_nav($sidebar_id = false) { ?> <?php global $cap; if ($sidebar_id == 'leftsidebar' && $cap->bg_leftsidebar_default_nav && $cap->bg_leftsidebar_default_nav == 'no') { return; } ?> <div id="community-nav" class="widget widget-title" > <h3 class="widgettitle"><?php _e('Community', 'cc'); ?> </h3> <ul class="item-list"> <?php if ('activity' != bp_dtheme_page_on_front() && bp_is_active('activity')) { ?> <li<?php if (bp_is_activity_component()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_ACTIVITY_SLUG; ?> /" title="<?php _e('Activity', 'cc'); ?> "><?php _e('Activity', 'cc'); ?> </a> </li> <?php } ?> <li<?php if (bp_is_members_component() || bp_is_user()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_MEMBERS_SLUG; ?> /" title="<?php _e('Members', 'cc'); ?> "><?php _e('Members', 'cc'); ?> </a> </li> <?php if (bp_is_active('groups')) { ?> <li<?php if (bp_is_groups_component() || bp_is_group()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_GROUPS_SLUG; ?> /" title="<?php _e('Groups', 'cc'); ?> "><?php _e('Groups', 'cc'); ?> </a> </li> <?php if (bp_is_active('forums') && (function_exists('bp_forums_is_installed_correctly') && !(int) bp_get_option('bp-disable-forum-directory')) && bp_forums_is_installed_correctly()) { ?> <li<?php if (bp_is_forums_component()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_FORUMS_SLUG; ?> /" title="<?php _e('Forums', 'cc'); ?> "><?php _e('Forums', 'cc'); ?> </a> </li> <?php } ?> <?php } ?> <?php if (bp_is_active('blogs') && is_multisite()) { ?> <li<?php if (bp_is_blogs_component()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_BLOGS_SLUG; ?> /" title="<?php _e('Blogs', 'cc'); ?> "><?php _e('Blogs', 'cc'); ?> </a> </li> <?php } ?> </ul> <?php if (bp_is_single_item() || bp_is_user()) { ?> <?php if (bp_is_group()) { ?> <div id="community-single-nav" class="widget-title" > <ul class="item-list"> <h3 class="widgettitle"><?php _e('@ Group', 'cc'); ?> </h3> <?php bp_get_options_nav(); ?> <?php do_action('bp_group_options_nav'); ?> </ul> </div> <?php } ?> <?php if (bp_is_user()) { ?> <div id="community-single-nav" class="widget-title" > <ul class="item-list"> <h3 class="widgettitle"><?php _e('@ Member', 'cc'); ?> </h3> <?php bp_get_displayed_user_nav(); ?> <?php do_action('bp_group_options_nav'); ?> </ul> </div> <?php } ?> <?php } ?> </div> <?php }
/** * Similar to the post_class() function, but for BP. This is NOT used by core Suffusion, but is useful for child themes using BP. * This might be defined by the Suffusion BuddyPress Pack for BP users of Suffusion, but is included conditionally here so * that the theme and the plugin can be used independently of each other and so that one version of Suffusion can work with an older * version of the BP pack. * * @since 3.6.7 * @param bool $custom * @param bool $echo * @return bool|string */ function suffusion_bp_content_class($custom = false, $echo = true) { if (!function_exists('bp_is_group')) { return false; } $css = array(); $css[] = 'post'; if (function_exists('bp_is_profile_component') && bp_is_profile_component()) { $css[] = 'profile-component'; } if (function_exists('bp_is_activity_component') && bp_is_activity_component()) { $css[] = 'activity-component'; } if (function_exists('bp_is_blogs_component') && bp_is_blogs_component()) { $css[] = 'blogs-component'; } if (function_exists('bp_is_messages_component') && bp_is_messages_component()) { $css[] = 'messages-component'; } if (function_exists('bp_is_friends_component') && bp_is_friends_component()) { $css[] = 'friends-component'; } if (function_exists('bp_is_groups_component') && bp_is_groups_component()) { $css[] = 'groups-component'; } if (function_exists('bp_is_settings_component') && bp_is_settings_component()) { $css[] = 'settings-component'; } if (function_exists('bp_is_member') && bp_is_member()) { $css[] = 'member'; } if (function_exists('bp_is_user_activity') && bp_is_user_activity()) { $css[] = 'user-activity'; } if (function_exists('bp_is_user_friends_activity') && bp_is_user_friends_activity()) { $css[] = 'user-friends-activity'; } if (function_exists('bp_is_activity_permalink') && bp_is_activity_permalink()) { $css[] = 'activity-permalink'; } if (function_exists('bp_is_user_profile') && bp_is_user_profile()) { $css[] = 'user-profile'; } if (function_exists('bp_is_profile_edit') && bp_is_profile_edit()) { $css[] = 'profile-edit'; } if (function_exists('bp_is_change_avatar') && bp_is_change_avatar()) { $css[] = 'change-avatar'; } if (function_exists('bp_is_user_groups') && bp_is_user_groups()) { $css[] = 'user-groups'; } if (function_exists('bp_is_group') && bp_is_group()) { $css[] = 'group'; } if (function_exists('bp_is_group_home') && bp_is_group_home()) { $css[] = 'group-home'; } if (function_exists('bp_is_group_create') && bp_is_group_create()) { $css[] = 'group-create'; } if (function_exists('bp_is_group_admin_page') && bp_is_group_admin_page()) { $css[] = 'group-admin-page'; } if (function_exists('bp_is_group_forum') && bp_is_group_forum()) { $css[] = 'group-forum'; } if (function_exists('bp_is_group_activity') && bp_is_group_activity()) { $css[] = 'group-activity'; } if (function_exists('bp_is_group_forum_topic') && bp_is_group_forum_topic()) { $css[] = 'group-forum-topic'; } if (function_exists('bp_is_group_forum_topic_edit') && bp_is_group_forum_topic_edit()) { $css[] = 'group-forum-topic-edit'; } if (function_exists('bp_is_group_members') && bp_is_group_members()) { $css[] = 'group-members'; } if (function_exists('bp_is_group_invites') && bp_is_group_invites()) { $css[] = 'group-invites'; } if (function_exists('bp_is_group_membership_request') && bp_is_group_membership_request()) { $css[] = 'group-membership-request'; } if (function_exists('bp_is_group_leave') && bp_is_group_leave()) { $css[] = 'group-leave'; } if (function_exists('bp_is_group_single') && bp_is_group_single()) { $css[] = 'group-single'; } if (function_exists('bp_is_user_blogs') && bp_is_user_blogs()) { $css[] = 'user-blogs'; } if (function_exists('bp_is_user_recent_posts') && bp_is_user_recent_posts()) { $css[] = 'user-recent-posts'; } if (function_exists('bp_is_user_recent_commments') && bp_is_user_recent_commments()) { $css[] = 'user-recent-commments'; } if (function_exists('bp_is_create_blog') && bp_is_create_blog()) { $css[] = 'create-blog'; } if (function_exists('bp_is_user_friends') && bp_is_user_friends()) { $css[] = 'user-friends'; } if (function_exists('bp_is_friend_requests') && bp_is_friend_requests()) { $css[] = 'friend-requests'; } if (function_exists('bp_is_user_messages') && bp_is_user_messages()) { $css[] = 'user-messages'; } if (function_exists('bp_is_messages_inbox') && bp_is_messages_inbox()) { $css[] = 'messages-inbox'; } if (function_exists('bp_is_messages_sentbox') && bp_is_messages_sentbox()) { $css[] = 'messages-sentbox'; } if (function_exists('bp_is_notices') && bp_is_notices()) { $css[] = 'notices'; } if (function_exists('bp_is_messages_compose_screen') && bp_is_messages_compose_screen()) { $css[] = 'messages-compose-screen'; } if (function_exists('bp_is_single_item') && bp_is_single_item()) { $css[] = 'single-item'; } if (function_exists('bp_is_activation_page') && bp_is_activation_page()) { $css[] = 'activation-page'; } if (function_exists('bp_is_register_page') && bp_is_register_page()) { $css[] = 'register-page'; } $css[] = 'fix'; if (is_array($custom)) { foreach ($custom as $class) { if (!in_array($class, $css)) { $css[] = esc_attr($class); } } } else { if ($custom != false) { $css[] = $custom; } } $css_class = implode(' ', $css); if ($echo) { echo ' class="' . $css_class . '" '; } return ' class="' . $css_class . '" '; }
bbp_forums_url(); ?> "><?php _e('Forums', 'framemarket'); ?> </a> </li> <?php } ?> <?php if (bp_is_active('blogs') && is_multisite()) { ?> <li<?php if (bp_is_blogs_component() && !bp_is_user_blogs()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo bp_blogs_root_slug(); ?> /" title="<?php _e('Blogs', 'framemarket'); ?> "><?php
/** * Customizes the post CSS class according to BuddyPress content. * * Hooked to the 'post_class' filter. * * @since 2.1.0 * * @param array $wp_classes The post classes coming from WordPress. * @return array */ function bp_get_the_post_class($wp_classes = array()) { // Don't do anything if we're not on a BP page. if (!is_buddypress()) { return $wp_classes; } $bp_classes = array(); if (bp_is_user() || bp_is_single_activity()) { $bp_classes[] = 'bp_members'; } elseif (bp_is_group()) { $bp_classes[] = 'bp_group'; } elseif (bp_is_activity_component()) { $bp_classes[] = 'bp_activity'; } elseif (bp_is_blogs_component()) { $bp_classes[] = 'bp_blogs'; } elseif (bp_is_register_page()) { $bp_classes[] = 'bp_register'; } elseif (bp_is_activation_page()) { $bp_classes[] = 'bp_activate'; } elseif (bp_is_forums_component() && bp_is_directory()) { $bp_classes[] = 'bp_forum'; } if (empty($bp_classes)) { return $wp_classes; } // Emulate post type css class. foreach ($bp_classes as $bp_class) { $bp_classes[] = "type-{$bp_class}"; } // Okay let's merge! return array_unique(array_merge($bp_classes, $wp_classes)); }
/** * Set up the title for pages and <title> */ public function setup_title() { $bp = buddypress(); // Set up the component options navigation for Site if ( bp_is_blogs_component() ) { if ( bp_is_my_profile() ) { if ( bp_is_active( 'xprofile' ) ) { $bp->bp_options_title = __( 'My Sites', 'buddypress' ); } // If we are not viewing the logged in user, set up the current // users avatar and name } 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(); }
function bp_get_the_body_class($nxt_classes, $custom_classes = false) { $bp_classes = array(); /** Pages *************************************************************/ if (is_front_page()) { $bp_classes[] = 'home-page'; } if (bp_is_directory()) { $bp_classes[] = 'directory'; } if (bp_is_single_item()) { $bp_classes[] = 'single-item'; } /** Components ********************************************************/ if (!bp_is_blog_page()) { if (bp_is_user_profile()) { $bp_classes[] = 'xprofile'; } if (bp_is_activity_component()) { $bp_classes[] = 'activity'; } if (bp_is_blogs_component()) { $bp_classes[] = 'blogs'; } if (bp_is_messages_component()) { $bp_classes[] = 'messages'; } if (bp_is_friends_component()) { $bp_classes[] = 'friends'; } if (bp_is_groups_component()) { $bp_classes[] = 'groups'; } if (bp_is_settings_component()) { $bp_classes[] = 'settings'; } } /** User **************************************************************/ if (!bp_is_directory()) { if (bp_is_user_blogs()) { $bp_classes[] = 'my-blogs'; } if (bp_is_user_groups()) { $bp_classes[] = 'my-groups'; } if (bp_is_user_activity()) { $bp_classes[] = 'my-activity'; } } if (bp_is_my_profile()) { $bp_classes[] = 'my-account'; } if (bp_is_user_profile()) { $bp_classes[] = 'my-profile'; } if (bp_is_user_friends()) { $bp_classes[] = 'my-friends'; } if (bp_is_user_messages()) { $bp_classes[] = 'my-messages'; } if (bp_is_user_recent_commments()) { $bp_classes[] = 'recent-comments'; } if (bp_is_user_recent_posts()) { $bp_classes[] = 'recent-posts'; } if (bp_is_user_change_avatar()) { $bp_classes[] = 'change-avatar'; } if (bp_is_user_profile_edit()) { $bp_classes[] = 'profile-edit'; } if (bp_is_user_friends_activity()) { $bp_classes[] = 'friends-activity'; } if (bp_is_user_groups_activity()) { $bp_classes[] = 'groups-activity'; } if (is_user_logged_in()) { $bp_classes[] = 'logged-in'; } /** Messages **********************************************************/ if (bp_is_messages_inbox()) { $bp_classes[] = 'inbox'; } if (bp_is_messages_sentbox()) { $bp_classes[] = 'sentbox'; } if (bp_is_messages_compose_screen()) { $bp_classes[] = 'compose'; } if (bp_is_notices()) { $bp_classes[] = 'notices'; } if (bp_is_user_friend_requests()) { $bp_classes[] = 'friend-requests'; } if (bp_is_create_blog()) { $bp_classes[] = 'create-blog'; } /** Groups ************************************************************/ if (bp_is_group_leave()) { $bp_classes[] = 'leave-group'; } if (bp_is_group_invites()) { $bp_classes[] = 'group-invites'; } if (bp_is_group_members()) { $bp_classes[] = 'group-members'; } if (bp_is_group_forum_topic()) { $bp_classes[] = 'group-forum-topic'; } if (bp_is_group_forum_topic_edit()) { $bp_classes[] = 'group-forum-topic-edit'; } if (bp_is_group_forum()) { $bp_classes[] = 'group-forum'; } if (bp_is_group_admin_page()) { $bp_classes[] = 'group-admin'; } if (bp_is_group_create()) { $bp_classes[] = 'group-create'; } if (bp_is_group_home()) { $bp_classes[] = 'group-home'; } if (bp_is_single_activity()) { $bp_classes[] = 'activity-permalink'; } /** Registration ******************************************************/ if (bp_is_register_page()) { $bp_classes[] = 'registration'; } if (bp_is_activation_page()) { $bp_classes[] = 'activation'; } /** Current Component & Action ****************************************/ if (!bp_is_blog_page()) { $bp_classes[] = bp_current_component(); $bp_classes[] = bp_current_action(); } /** Clean up***********************************************************/ // We don't want NXTClass blog classes to appear on non-blog pages. if (!bp_is_blog_page()) { // Preserve any custom classes already set if (!empty($custom_classes)) { $nxt_classes = (array) $custom_classes; } else { $nxt_classes = array(); } } // Merge nxt classes with BP classes $classes = array_merge((array) $bp_classes, (array) $nxt_classes); // Remove any duplicates $classes = array_unique($classes); return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $nxt_classes, $custom_classes); }
/** * Customizes the post CSS class according to BuddyPress content. * * Hooked to the 'post_class' filter. * * @since BuddyPress (2.1.0) * * @param array $wp_classes The post classes coming from WordPress. * @return array */ function bp_get_the_post_class($wp_classes = array()) { // don't do anything if we're not on a BP page if (!is_buddypress()) { return $wp_classes; } $bp_classes = array(); if (bp_is_user() || bp_is_single_activity()) { $bp_classes[] = 'bp_members'; } elseif (bp_is_group()) { $bp_classes[] = 'bp_group'; } elseif (bp_is_activity_component()) { $bp_classes[] = 'bp_activity'; } elseif (bp_is_blogs_component()) { $bp_classes[] = 'bp_blogs'; } elseif (bp_is_register_page()) { $bp_classes[] = 'bp_register'; } elseif (bp_is_activation_page()) { $bp_classes[] = 'bp_activate'; } elseif (bp_is_forums_component() && bp_is_directory()) { $bp_classes[] = 'bp_forum'; } if (empty($bp_classes)) { return $wp_classes; } // emulate post type css class foreach ($bp_classes as $bp_class) { $bp_classes[] = "type-{$bp_class}"; } // removes the 'page' and 'type-page' post classes // we need to remove these classes since they did not exist before we switched // theme compat to use the 'page' post type $page_key = array_search('page', $wp_classes); $page_type_key = array_search('type-page', $wp_classes); unset($wp_classes[$page_key], $wp_classes[$page_type_key]); // okay let's merge! return array_unique(array_merge($bp_classes, $wp_classes)); }
/** * */ function miss_is_bp() { if (function_exists('bp_is_group') && (bp_is_blog_page() || bp_is_my_profile() || bp_is_my_profile() || is_front_page() || bp_is_component_front_page('activity') || bp_is_directory() || bp_is_profile_component() || bp_is_activity_component() || bp_is_blogs_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_groups_component() || bp_is_settings_component() || bp_is_user_activity() || bp_is_user_friends_activity() || bp_is_activity_permalink() || bp_is_user_profile() || bp_is_profile_edit() || bp_is_change_avatar() || bp_is_user_groups() || bp_is_group() || bp_is_group_home() || bp_is_group_create() || bp_is_group_admin_page() || bp_is_group_forum() || bp_is_group_activity() || bp_is_group_forum_topic() || bp_is_group_forum_topic_edit() || bp_is_group_members() || bp_is_group_invites() || bp_is_group_membership_request() || bp_is_group_leave() || bp_is_group_single() || bp_is_user_blogs() || bp_is_user_recent_posts() || bp_is_user_recent_commments() || bp_is_create_blog() || bp_is_user_friends() || bp_is_friend_requests() || bp_is_user_messages() || bp_is_messages_inbox() || bp_is_messages_sentbox() || bp_is_notices() || bp_is_messages_compose_screen() || bp_is_activation_page() || bp_is_register_page())) { return true; } return false; }
/** * Sets up the title for pages and <title> * * @global obj $bp */ function setup_title() { global $bp; // Set up the component options navigation for Blog if (bp_is_blogs_component()) { if (bp_is_my_profile()) { if (bp_is_active('xprofile')) { $bp->bp_options_title = __('My Sites', 'buddypress'); } // If we are not viewing the logged in user, set up the current // users avatar and name } else { $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => $bp->displayed_user->id, 'type' => 'thumb')); $bp->bp_options_title = $bp->displayed_user->fullname; } } parent::setup_title(); }
/** * header: add the buddypress dropdown navigation to the menu * * located: header.php do_action( 'bp_menu' ) * * @package Custom Community * @since 1.8.3 */ function bp_menu() { global $cap; if (!defined('BP_VERSION')) { if ($cap->menue_disable_home == true) { ?> <ul> <li id="nav-home"<?php if (is_home()) { ?> class="span2 current-menu-item"<?php } ?> > <a href="<?php echo home_url(); ?> " title="<?php _e('Home', 'cc'); ?> "><?php _e('Home', 'cc'); ?> </a> </li> </ul> <?php } ?> <?php } else { ?> <ul> <?php if ($cap->menue_disable_home == true) { ?> <li id="nav-home"<?php if (is_front_page()) { ?> class="span2 current-menu-item"<?php } ?> > <a href="<?php echo home_url(); ?> " title="<?php _e('Home', 'cc'); ?> "><?php _e('Home', 'cc'); ?> </a> </li> <?php } ?> <?php if ($cap->menue_enable_community == true) { ?> <li id="nav-community"<?php if (bp_is_activity_component() || (bp_is_members_component() || bp_is_user()) || (bp_is_groups_component() || bp_is_group()) || bp_is_forums_component() || bp_is_blogs_component()) { ?> class="span2 page_item current-menu-item"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_ACTIVITY_SLUG; ?> /" title="<?php _e('Community', 'cc'); ?> "><?php _e('Community', 'cc'); ?> </a> <ul class="children"> <?php if ('activity' != bp_dtheme_page_on_front() && bp_is_active('activity')) { ?> <li<?php if (bp_is_activity_component()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_ACTIVITY_SLUG; ?> /" title="<?php _e('Activity', 'cc'); ?> "><?php _e('Activity', 'cc'); ?> </a> </li> <?php } ?> <li<?php if (bp_is_members_component() || bp_is_user()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_MEMBERS_SLUG; ?> /" title="<?php _e('Members', 'cc'); ?> "><?php _e('Members', 'cc'); ?> </a> </li> <?php if (bp_is_active('groups')) { ?> <li<?php if (bp_is_groups_component() || bp_is_group()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_GROUPS_SLUG; ?> /" title="<?php _e('Groups', 'cc'); ?> "><?php _e('Groups', 'cc'); ?> </a> </li> <?php if (bp_is_active('forums') && (function_exists('bp_forums_is_installed_correctly') && !(int) bp_get_option('bp-disable-forum-directory')) && bp_forums_is_installed_correctly()) { ?> <li<?php if (bp_is_forums_component()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_FORUMS_SLUG; ?> /" title="<?php _e('Forums', 'cc'); ?> "><?php _e('Forums', 'cc'); ?> </a> </li> <?php } ?> <?php } ?> <?php if (bp_is_active('blogs') && is_multisite()) { ?> <li<?php if (bp_is_blogs_component()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo BP_BLOGS_SLUG; ?> /" title="<?php _e('Blogs', 'cc'); ?> "><?php _e('Blogs', 'cc'); ?> </a> </li> <?php } ?> </ul> </li> <?php do_action('bp_nav_items'); ?> <?php } ?> </ul> <?php } }
function bp_get_the_body_class( $wp_classes, $custom_classes = false ) { global $bp; if ( bp_is_front_page() ) $bp_classes[] = 'home-page'; if ( bp_is_directory() ) $bp_classes[] = 'directory'; if ( bp_is_user_profile() && !bp_is_blog_page() ) $bp_classes[] = 'profile'; if ( bp_is_activity_component() && !bp_is_blog_page() || ( bp_is_activity_front_page() && bp_is_front_page() ) ) $bp_classes[] = 'activity'; if ( bp_is_blogs_component() && !bp_is_blog_page() ) $bp_classes[] = 'blogs'; if ( bp_is_messages_component() && !bp_is_blog_page() ) $bp_classes[] = 'messages'; if ( bp_is_friends_component() && !bp_is_blog_page() ) $bp_classes[] = 'friends'; if ( bp_is_groups_component() && !bp_is_blog_page() ) $bp_classes[] = 'groups'; if ( bp_is_settings_component() && !bp_is_blog_page() ) $bp_classes[] = 'settings'; if ( bp_is_single_item() ) $bp_classes[] = 'single-item'; if ( bp_is_messages_inbox() ) $bp_classes[] = 'inbox'; if ( bp_is_messages_sentbox() ) $bp_classes[] = 'sentbox'; if ( bp_is_messages_compose_screen() ) $bp_classes[] = 'compose'; if ( bp_is_notices() ) $bp_classes[] = 'notices'; if ( bp_is_friend_requests() ) $bp_classes[] = 'friend-requests'; if ( bp_is_user_friends() ) $bp_classes[] = 'my-friends'; if ( bp_is_create_blog() ) $bp_classes[] = 'create-blog'; if ( bp_is_user_recent_commments() ) $bp_classes[] = 'recent-comments'; if ( bp_is_user_recent_posts() ) $bp_classes[] = 'recent-posts'; if ( bp_is_user_blogs() && !bp_is_directory() ) $bp_classes[] = 'my-blogs'; if ( bp_is_user_groups() && !bp_is_directory() ) $bp_classes[] = 'my-groups'; if ( bp_is_group_leave() ) $bp_classes[] = 'leave-group'; if ( bp_is_group_invites() ) $bp_classes[] = 'group-invites'; if ( bp_is_group_members() ) $bp_classes[] = 'group-members'; if ( bp_is_group_forum_topic() ) $bp_classes[] = 'group-forum-topic'; if ( bp_is_group_forum_topic_edit() ) $bp_classes[] = 'group-forum-topic-edit'; if ( bp_is_group_forum() ) $bp_classes[] = 'group-forum'; if ( bp_is_group_admin_page() ) $bp_classes[] = 'group-admin'; if ( bp_is_group_create() ) $bp_classes[] = 'group-create'; if ( bp_is_group_home() ) $bp_classes[] = 'group-home'; if ( bp_is_change_avatar() ) $bp_classes[] = 'change-avatar'; if ( bp_is_profile_edit() ) $bp_classes[] = 'profile-edit'; if ( bp_is_user_friends_activity() ) $bp_classes[] = 'friends-activity'; if ( bp_is_user_activity() && !bp_is_directory() ) $bp_classes[] = 'my-activity'; if ( bp_is_activity_permalink() ) $bp_classes[] = 'activity-permalink'; if ( bp_is_register_page() ) $bp_classes[] = 'registration'; if ( bp_is_activation_page() ) $bp_classes[] = 'activation'; if ( is_user_logged_in() ) $bp_classes[] = 'logged-in'; /* Add the current_component, current_action into the bp classes */ if ( !bp_is_blog_page() ) { if ( !empty( $bp->current_component ) ) $bp_classes[] = $bp->current_component; if ( !empty( $bp->current_action ) ) $bp_classes[] = $bp->current_action; } /* We don't want WordPress blog classes to appear on non-blog pages. */ if ( !bp_is_blog_page() || is_home() ) { /* Preserve any custom classes already set */ if ( !empty( $custom_classes ) ) $wp_classes = (array) $custom_classes; else $wp_classes = array(); } /* Merge WP classes with BP classes */ $classes = array_merge( (array) $bp_classes, (array) $wp_classes ); /* Remove any duplicates */ $classes = array_unique( $classes ); return apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes ); }
function body_class($wp_classes, $custom_classes = false) { global $bp; $bp_classes = array(); if (bp_is_directory()) { $bp_classes[] = 'directory'; } elseif (bp_is_single_item()) { $bp_classes[] = 'single-item'; } elseif (bp_is_activity_component() || $this->show_activity_page) { $bp_classes[] = 'activity'; } if ($this->adminbar && $this->theme->have_adminbar()) { $bp_classes[] = 'adminbar'; } if (!is_page() && is_front_page() && is_file(CHILD_DIR . '/home.php')) { $bp_classes[] = 'home'; } if ($this->show_activity_page) { $bp_classes[] = 'internal-page'; } elseif (!bp_is_blog_page()) { $wp_classes = array(); if (!bp_is_directory()) { $bp_classes[] = 'internal-page'; } if (bp_is_user_profile()) { $bp_classes[] = 'profile'; } elseif (bp_is_blogs_component()) { $bp_classes[] = 'blogs'; } elseif (bp_is_messages_component()) { $bp_classes[] = 'messages'; } elseif (bp_is_friends_component()) { $bp_classes[] = 'friends'; } elseif (bp_is_groups_component()) { $bp_classes[] = 'groups'; } elseif (bp_is_settings_component()) { $bp_classes[] = 'settings'; } } if (is_user_logged_in()) { $bp_classes[] = 'logged-in'; if (!bp_is_directory()) { if (bp_is_user_friends()) { $bp_classes[] = 'my-friends'; } elseif (bp_is_user_activity()) { $bp_classes[] = 'my-activity'; } elseif (bp_is_user_blogs()) { $bp_classes[] = 'my-blogs'; } elseif (bp_is_user_groups()) { $bp_classes[] = 'my-groups'; } elseif (bp_is_messages_inbox()) { $bp_classes[] = 'inbox'; } elseif (bp_is_messages_sentbox()) { $bp_classes[] = 'sentbox'; } elseif (bp_is_messages_compose_screen()) { $bp_classes[] = 'compose'; } elseif (bp_is_notices()) { $bp_classes[] = 'notices'; } elseif (bp_is_user_friend_requests()) { $bp_classes[] = 'friend-requests'; } elseif (bp_is_create_blog()) { $bp_classes[] = 'create-blog'; } elseif (bp_is_group_leave()) { $bp_classes[] = 'leave-group'; } elseif (bp_is_group_invites()) { $bp_classes[] = 'group-invites'; } elseif (bp_is_group_forum_topic_edit()) { $bp_classes[] = 'group-forum-topic-edit'; } elseif (bp_is_group_admin_page()) { $bp_classes[] = 'group-admin'; } elseif (bp_is_group_create()) { $bp_classes[] = 'group-create'; } elseif (bp_is_user_change_avatar()) { $bp_classes[] = 'change-avatar'; } elseif (bp_is_user_profile_edit()) { $bp_classes[] = 'profile-edit'; } } } else { $bp_classes[] = 'visitor'; } if (bp_is_group_members()) { $bp_classes[] = 'group-members'; } elseif (bp_is_group_home()) { $bp_classes[] = 'group-home'; } elseif (bp_is_group_forum()) { $bp_classes[] = 'group-forum'; if (bp_is_group_forum_topic()) { $bp_classes[] = 'group-forum-topic'; } } else { if (bp_is_user_recent_commments()) { $bp_classes[] = 'recent-comments'; } if (bp_is_user_recent_posts()) { $bp_classes[] = 'recent-posts'; } if (bp_is_user_friends_activity()) { $bp_classes[] = 'friends-activity'; } elseif (bp_is_single_activity()) { $bp_classes[] = 'activity-permalink'; } elseif (bp_is_register_page()) { $bp_classes[] = 'registration'; } elseif (bp_is_activation_page()) { $bp_classes[] = 'activation'; } } /* Add the current_component, current_action into the bp classes */ if (!bp_is_blog_page()) { if (!empty($bp->current_component)) { $bp_classes[] = $bp->current_component; } if (!empty($bp->current_action)) { $bp_classes[] = $bp->current_action; } } if ((!bp_is_blog_page() || is_home()) && !empty($custom_classes)) { $wp_classes = (array) $custom_classes; } /* Merge WP classes with BP classes */ $classes = array_merge((array) $bp_classes, (array) $wp_classes); /* Remove any duplicates */ $classes = array_unique($classes); return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes); }
/** * Show sidebars based on page type (including BP components) * * @package Infinity * @subpackage base */ function infinity_base_sidebars() { if (!current_theme_supports('infinity-sidebar-setup')) { return; } if (is_page()) { if (function_exists('bp_is_user') && bp_is_user() || function_exists('bp_is_members_component') && bp_is_members_component()) { if (is_active_sidebar('member-sidebar')) { dynamic_sidebar('member-sidebar'); } elseif (current_user_can('edit_theme_options')) { ?> <div class="widget"> <h4>BP Member Sidebar.</h4> <a href="<?php echo home_url('/'); ?> nxt-admin/widgets.php" title="Add Widgets">Add Widgets</a> </div><?php } } elseif (function_exists('bp_is_user') && !bp_is_user() && function_exists('bp_is_groups_component') && bp_is_groups_component()) { if (is_active_sidebar('groups-sidebar')) { dynamic_sidebar('groups-sidebar'); } elseif (current_user_can('edit_theme_options')) { ?> <div class="widget"> <h4>BP Group Sidebar.</h4> <a href="<?php echo home_url('/'); ?> nxt-admin/widgets.php" title="Add Widgets">Add Widgets</a> </div><?php } } elseif (function_exists('bp_is_user') && !bp_is_user() && function_exists('bp_is_forums_component') && bp_is_forums_component()) { if (is_active_sidebar('forums-sidebar')) { dynamic_sidebar('forums-sidebar'); } elseif (current_user_can('edit_theme_options')) { ?> <div class="widget"> <h4>BP Forums Sidebar.</h4> <a href="<?php echo home_url('/'); ?> nxt-admin/widgets.php" title="Add Widgets">Add Widgets</a> </div><?php } } elseif (function_exists('bp_is_user') && !bp_is_user() && function_exists('bp_is_blogs_component') && bp_is_blogs_component()) { if (is_active_sidebar('blogs-sidebar')) { dynamic_sidebar('blogs-sidebar'); } elseif (current_user_can('edit_theme_options')) { ?> <div class="widget"> <h4>BP Blogs Sidebar.</h4> <a href="<?php echo home_url('/'); ?> nxt-admin/widgets.php" title="Add Widgets">Add Widgets</a> </div><?php } } elseif (function_exists('bp_is_user') && !bp_is_user() && function_exists('bp_is_activity_component') && bp_is_activity_component()) { if (is_active_sidebar('activity-sidebar')) { dynamic_sidebar('activity-sidebar'); } elseif (current_user_can('edit_theme_options')) { ?> <div class="widget"> <h4>Activity Sidebar</h4> <a href="<?php echo home_url('/'); ?> nxt-admin/widgets.php" title="Add Widgets">Add Widgets</a> </div><?php } } elseif (is_front_page()) { if (is_active_sidebar('home-sidebar')) { dynamic_sidebar('home-sidebar'); } elseif (current_user_can('edit_theme_options')) { ?> <div class="widget"> <h4>Home Sidebar.</h4> <a href="<?php echo home_url('/'); ?> nxt-admin/widgets.php" title="Add Widgets">Add Widgets</a> </div><?php } } else { if (is_active_sidebar('page-sidebar')) { dynamic_sidebar('page-sidebar'); } elseif (current_user_can('edit_theme_options')) { ?> <div class="widget"> <h4>Page Sidebar.</h4> <a href="<?php echo home_url('/'); ?> nxt-admin/widgets.php" title="Add Widgets">Add Widgets</a> </div><?php } } } else { if (is_active_sidebar('blog-sidebar')) { dynamic_sidebar('blog-sidebar'); } elseif (current_user_can('edit_theme_options')) { ?> <div class="widget"> <h4>Blog Sidebar.</h4> <a href="<?php echo home_url('/'); ?> nxt-admin/widgets.php" title="Add Widgets">Add Widgets</a> </div><?php } } }
function bp_get_the_body_class($wp_classes = array(), $custom_classes = false) { $bp_classes = array(); /** Pages *************************************************************/ if (is_front_page()) { $bp_classes[] = 'home-page'; } if (bp_is_directory()) { $bp_classes[] = 'directory'; } if (bp_is_single_item()) { $bp_classes[] = 'single-item'; } /** Components ********************************************************/ if (!bp_is_blog_page()) { if (bp_is_user_profile()) { $bp_classes[] = 'xprofile'; } if (bp_is_activity_component()) { $bp_classes[] = 'activity'; } if (bp_is_blogs_component()) { $bp_classes[] = 'blogs'; } if (bp_is_messages_component()) { $bp_classes[] = 'messages'; } if (bp_is_friends_component()) { $bp_classes[] = 'friends'; } if (bp_is_groups_component()) { $bp_classes[] = 'groups'; } if (bp_is_settings_component()) { $bp_classes[] = 'settings'; } } /** User **************************************************************/ if (bp_is_user()) { $bp_classes[] = 'bp-user'; } if (!bp_is_directory()) { if (bp_is_user_blogs()) { $bp_classes[] = 'my-blogs'; } if (bp_is_user_groups()) { $bp_classes[] = 'my-groups'; } if (bp_is_user_activity()) { $bp_classes[] = 'my-activity'; } } if (bp_is_my_profile()) { $bp_classes[] = 'my-account'; } if (bp_is_user_profile()) { $bp_classes[] = 'my-profile'; } if (bp_is_user_friends()) { $bp_classes[] = 'my-friends'; } if (bp_is_user_messages()) { $bp_classes[] = 'my-messages'; } if (bp_is_user_recent_commments()) { $bp_classes[] = 'recent-comments'; } if (bp_is_user_recent_posts()) { $bp_classes[] = 'recent-posts'; } if (bp_is_user_change_avatar()) { $bp_classes[] = 'change-avatar'; } if (bp_is_user_profile_edit()) { $bp_classes[] = 'profile-edit'; } if (bp_is_user_friends_activity()) { $bp_classes[] = 'friends-activity'; } if (bp_is_user_groups_activity()) { $bp_classes[] = 'groups-activity'; } /** Messages **********************************************************/ if (bp_is_messages_inbox()) { $bp_classes[] = 'inbox'; } if (bp_is_messages_sentbox()) { $bp_classes[] = 'sentbox'; } if (bp_is_messages_compose_screen()) { $bp_classes[] = 'compose'; } if (bp_is_notices()) { $bp_classes[] = 'notices'; } if (bp_is_user_friend_requests()) { $bp_classes[] = 'friend-requests'; } if (bp_is_create_blog()) { $bp_classes[] = 'create-blog'; } /** Groups ************************************************************/ if (bp_is_group_leave()) { $bp_classes[] = 'leave-group'; } if (bp_is_group_invites()) { $bp_classes[] = 'group-invites'; } if (bp_is_group_members()) { $bp_classes[] = 'group-members'; } if (bp_is_group_forum_topic()) { $bp_classes[] = 'group-forum-topic'; } if (bp_is_group_forum_topic_edit()) { $bp_classes[] = 'group-forum-topic-edit'; } if (bp_is_group_forum()) { $bp_classes[] = 'group-forum'; } if (bp_is_group_admin_page()) { $bp_classes[] = 'group-admin'; $bp_classes[] = bp_get_group_current_admin_tab(); } if (bp_is_group_create()) { $bp_classes[] = 'group-create'; $bp_classes[] = bp_get_groups_current_create_step(); } if (bp_is_group_home()) { $bp_classes[] = 'group-home'; } if (bp_is_single_activity()) { $bp_classes[] = 'activity-permalink'; } /** Registration ******************************************************/ if (bp_is_register_page()) { $bp_classes[] = 'registration'; } if (bp_is_activation_page()) { $bp_classes[] = 'activation'; } /** Current Component & Action ****************************************/ if (!bp_is_blog_page()) { $bp_classes[] = bp_current_component(); $bp_classes[] = bp_current_action(); } /** Clean up ***********************************************************/ // Add BuddyPress class if we are within a BuddyPress page if (!bp_is_blog_page()) { $bp_classes[] = 'buddypress'; } // Merge WP classes with BuddyPress classes and remove any duplicates $classes = array_unique(array_merge((array) $bp_classes, (array) $wp_classes)); return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes); }
/** * Check if this is a BuddyPress page or not. * Returns true or false (boolean) */ function shoestrap_is_bp() { $bp = false; /** Pages *************************************************************/ if (!$bp && bp_is_directory()) { $bp = true; } elseif (!$bp && bp_is_single_item()) { $bp = true; } elseif (!$bp && bp_is_user_profile()) { $bp = true; } elseif (!$bp && bp_is_activity_component()) { $bp = true; } elseif (!$bp && bp_is_blogs_component()) { $bp = true; } elseif (!$bp && bp_is_messages_component()) { $bp = true; } elseif (!$bp && bp_is_friends_component()) { $bp = true; } elseif (!$bp && bp_is_groups_component()) { $bp = true; } elseif (!$bp && bp_is_settings_component()) { $bp = true; } elseif (!$bp && bp_is_user()) { $bp = true; } elseif (!$bp && bp_is_user_blogs()) { $bp = true; } elseif (!$bp && bp_is_user_groups()) { $bp = true; } elseif (!$bp && bp_is_user_activity()) { $bp = true; } elseif (!$bp && bp_is_my_profile()) { $bp = true; } elseif (!$bp && bp_is_user_profile()) { $bp = true; } elseif (!$bp && bp_is_user_friends()) { $bp = true; } elseif (!$bp && bp_is_user_messages()) { $bp = true; } elseif (!$bp && bp_is_user_recent_commments()) { $bp = true; } elseif (!$bp && bp_is_user_recent_posts()) { $bp = true; } elseif (!$bp && bp_is_user_change_avatar()) { $bp = true; } elseif (!$bp && bp_is_user_profile_edit()) { $bp = true; } elseif (!$bp && bp_is_user_friends_activity()) { $bp = true; } elseif (!$bp && bp_is_user_groups_activity()) { $bp = true; } elseif (!$bp && is_user_logged_in()) { $bp = true; } elseif (!$bp && bp_is_messages_inbox()) { $bp = true; } elseif (!$bp && bp_is_messages_sentbox()) { $bp = true; } elseif (!$bp && bp_is_messages_compose_screen()) { $bp = true; } elseif (!$bp && bp_is_notices()) { $bp = true; } elseif (!$bp && bp_is_user_friend_requests()) { $bp = true; } elseif (!$bp && bp_is_create_blog()) { $bp = true; } elseif (!$bp && bp_is_group_leave()) { $bp = true; } elseif (!$bp && bp_is_group_invites()) { $bp = true; } elseif (!$bp && bp_is_group_members()) { $bp = true; } elseif (!$bp && bp_is_group_forum_topic()) { $bp = true; } elseif (!$bp && bp_is_group_forum_topic_edit()) { $bp = true; } elseif (!$bp && bp_is_group_forum()) { $bp = true; } elseif (!$bp && bp_is_group_admin_page()) { $bp = true; } elseif (!$bp && bp_is_group_create()) { $bp = true; } elseif (!$bp && bp_is_group_home()) { $bp = true; } elseif (!$bp && bp_is_single_activity()) { $bp = true; } elseif (!$bp && bp_is_register_page()) { $bp = true; } elseif (!$bp && bp_is_activation_page()) { $bp = true; } elseif (!$bp && !bp_is_blog_page()) { $bp = true; } return $bp; }