/** * Are we looking at something that needs group theme compatibility? * * @since 1.7.0 */ public function is_group() { // Bail if not looking at a group. if (!bp_is_groups_component()) { return; } // Group Directory. if (!bp_current_action() && !bp_current_item()) { bp_update_is_directory(true, 'groups'); /** * Fires at the start of the group theme compatibility setup. * * @since 1.1.0 */ do_action('groups_directory_groups_setup'); 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')); // Creating a group. } elseif (bp_is_groups_component() && bp_is_current_action('create')) { 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')); // Group page. } elseif (bp_is_single_item()) { add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy')); add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post')); add_filter('bp_replace_the_content', array($this, 'single_content')); } }
function bp_checkins_is_group_places_area() { if (bp_is_groups_component() && bp_is_single_item() && bp_is_current_action('checkins') && bp_action_variable(0) == 'places') { return true; } else { return false; } }
function bp_checkins_is_group_checkins_area() { if (!(int) bp_get_option('bp-checkins-activate-component') || '' == bp_get_option('bp-checkins-activate-component')) { return false; } if (bp_is_groups_component() && bp_is_single_item() && bp_is_current_action('checkins')) { return true; } else { return false; } }
/** * Temporarily fix the "New Topic" button when using bbPress with BP. * * @todo Remove this when bbPress addresses this. */ function cbox_fix_bbp_new_topic_button() { // if groups isn't active, stop now! if (!bp_is_active('groups')) { return; } // if bbPress 2 isn't enabled, stop now! if (!function_exists('bbpress')) { return; } // remove the 'New Topic' button // this is done because the 'bp_get_group_new_topic_button' filter doesn't // work properly remove_action('bp_group_header_actions', 'bp_group_new_topic_button'); // version of bp_is_group_forum() that works with bbPress 2 $is_group_forum = bp_is_single_item() && bp_is_groups_component() && bp_is_current_action('forum'); // If these conditions are met, this button should not be displayed if (!is_user_logged_in() || !$is_group_forum || bp_is_group_forum_topic() || bp_group_is_user_banned()) { return false; } // create function to output new topic button $new_button = create_function('', "\n\t\t// do not show in sidebar\n\t\tif ( did_action( 'open_sidebar' ) )\n\t\t\treturn;\n\n\t\t// render the button\n\t\tbp_button( array(\n\t\t\t'id' => 'new_topic',\n\t\t\t'component' => 'groups',\n\t\t\t'must_be_logged_in' => true,\n\t\t\t'block_self' => true,\n\t\t\t'wrapper_class' => 'group-button',\n\t\t\t'link_href' => '#new-post', // anchor modified\n\t\t\t'link_class' => 'group-button', // removed a link_class here\n\t\t\t'link_id' => 'new-topic-button',\n\t\t\t'link_text' => __( 'New Topic', 'buddypress' ),\n\t\t\t'link_title' => __( 'New Topic', 'buddypress' ),\n\t\t) );\n\t"); // add our customized 'New Topic' button add_action('bp_group_header_actions', $new_button); }
/** * 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 }
<div id="item-header" role="complementary"> <?php bp_get_template_part('members/single/member-header'); ?> </div> <!-- #item-header --> </section> <?php } ?> <?php if (sq_option('bp_full_group', 0) == 1 && bp_is_single_item() && bp_is_groups_component()) { ?> <?php if (bp_has_groups()) { while (bp_groups()) { bp_the_group(); ?> <section class="alternate-color bp-full-width-profile"> <div id="item-header" role="complementary"> <?php bp_get_template_part('groups/single/group-header'); ?>
/** * This function looks scarier than it actually is. :) * Each object loop (activity/members/groups/blogs/forums) contains default parameters to * show specific information based on the page we are currently looking at. * The following function will take into account any cookies set in the JS and allow us * to override the parameters sent. That way we can change the results returned without reloading the page. * By using cookies we can also make sure that user settings are retained across page loads. * * @return string Query string for the activity/members/groups/blogs/forums loops * @since BuddyPress (1.2) */ function bp_dtheme_ajax_querystring($query_string, $object) { if (empty($object)) { return ''; } // Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts if (!empty($_POST['cookie'])) { $_BP_COOKIE = wp_parse_args(str_replace('; ', '&', urldecode($_POST['cookie']))); } else { $_BP_COOKIE =& $_COOKIE; } $qs = array(); /** * Check if any cookie values are set. If there are then override the default params passed to the * template loop */ // Activity stream filtering on action if (!empty($_BP_COOKIE['bp-' . $object . '-filter']) && '-1' != $_BP_COOKIE['bp-' . $object . '-filter']) { $qs[] = 'type=' . $_BP_COOKIE['bp-' . $object . '-filter']; $qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter']; } if (!empty($_BP_COOKIE['bp-' . $object . '-scope'])) { if ('personal' == $_BP_COOKIE['bp-' . $object . '-scope']) { $user_id = bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id(); $qs[] = 'user_id=' . $user_id; } // Activity stream scope only on activity directory. if ('all' != $_BP_COOKIE['bp-' . $object . '-scope'] && !bp_displayed_user_id() && !bp_is_single_item()) { $qs[] = 'scope=' . $_BP_COOKIE['bp-' . $object . '-scope']; } } // If page and search_terms have been passed via the AJAX post request, use those. if (!empty($_POST['page']) && '-1' != $_POST['page']) { $qs[] = 'page=' . $_POST['page']; } $object_search_text = bp_get_search_default_text($object); if (!empty($_POST['search_terms']) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms']) { $qs[] = 'search_terms=' . $_POST['search_terms']; } // Now pass the querystring to override default values. $query_string = empty($qs) ? '' : join('&', (array) $qs); $object_filter = ''; if (isset($_BP_COOKIE['bp-' . $object . '-filter'])) { $object_filter = $_BP_COOKIE['bp-' . $object . '-filter']; } $object_scope = ''; if (isset($_BP_COOKIE['bp-' . $object . '-scope'])) { $object_scope = $_BP_COOKIE['bp-' . $object . '-scope']; } $object_page = ''; if (isset($_BP_COOKIE['bp-' . $object . '-page'])) { $object_page = $_BP_COOKIE['bp-' . $object . '-page']; } $object_search_terms = ''; if (isset($_BP_COOKIE['bp-' . $object . '-search-terms'])) { $object_search_terms = $_BP_COOKIE['bp-' . $object . '-search-terms']; } $object_extras = ''; if (isset($_BP_COOKIE['bp-' . $object . '-extras'])) { $object_extras = $_BP_COOKIE['bp-' . $object . '-extras']; } return apply_filters('bp_dtheme_ajax_querystring', $query_string, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras); }
/** * 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 ); }
/** * 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(); }
/** * Add WHERE clauses to bbPress query for group-specific data and access protection. * * @param string $sql * @return string */ function groups_add_forum_where_sql($sql = '') { global $bp; // Define locale variable $parts = array(); // Set this for groups $parts['groups'] = "(gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id)"; // Restrict to public... $parts['private'] = "g.status = 'public'"; /** * ...but do some checks to possibly remove public restriction. * * Decide if private are visible */ // Are we in our own profile? if (bp_is_my_profile()) { unset($parts['private']); } elseif (bp_current_user_can('bp_moderate')) { unset($parts['private']); } elseif (bp_is_single_item()) { unset($parts['private']); } // Check the SQL filter that was passed if (!empty($sql)) { $parts['passed'] = $sql; } // Assemble Voltron $parts_string = implode(' AND ', $parts); // Set it to the global filter $bp->groups->filter_sql = $parts_string; // Return the global filter return $bp->groups->filter_sql; }
/** * Filter the page title for BuddyPress pages. * * @since 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 = 'right') { global $bp, $paged, $page, $_wp_theme_features; // 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; } // Return WP's title if not a BuddyPress page. if (!is_buddypress()) { return $title; } // Setup an empty title parts array. $title_parts = array(); // 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 = ''; // Use the component nav name. if (!empty($bp->bp_nav[$component_id])) { $component_name = _bp_strip_spans_from_title($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 (!empty($component_subnav_name)) { $component_subnav_name = array_shift($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_parts[] = $displayed_user_name; // Use component name on member pages. } else { $title_parts = array_merge($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)) { $title_parts[] = strip_tags($component_subnav_name); } } // 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'] : ''; $title_parts = array($bp->bp_options_title, $subnav); // A single item from a component other than groups. } elseif (bp_is_single_item()) { $title_parts = array($bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name']); // An index or directory. } elseif (bp_is_directory()) { $current_component = bp_current_component(); // No current component (when does this happen?). $title_parts = array(_x('Directory', 'component directory title', 'buddypress')); if (!empty($current_component)) { $title_parts = array(bp_get_directory_title($current_component)); } // Sign up page. } elseif (bp_is_register_page()) { $title_parts = array(__('Create an Account', 'buddypress')); // Activation page. } elseif (bp_is_activation_page()) { $title_parts = array(__('Activate Your Account', 'buddypress')); // Group creation page. } elseif (bp_is_group_create()) { $title_parts = array(__('Create a Group', 'buddypress')); // Blog creation page. } elseif (bp_is_create_blog()) { $title_parts = array(__('Create a Site', 'buddypress')); } // Strip spans. $title_parts = array_map('_bp_strip_spans_from_title', $title_parts); // Sep on right, so reverse the order. if ('right' == $seplocation) { $title_parts = array_reverse($title_parts); } // Get the blog name, so we can check if the original $title included it. $blogname = get_bloginfo('name', 'display'); /** * Are we going to fake 'title-tag' theme functionality? * * @link https://buddypress.trac.wordpress.org/ticket/6107 * @see wp_title() */ $title_tag_compatibility = (bool) (!empty($_wp_theme_features['title-tag']) || strstr($title, $blogname)); // Append the site title to title parts if theme supports title tag. if (true === $title_tag_compatibility) { $title_parts[] = $blogname; if (($paged >= 2 || $page >= 2) && !is_404()) { $title_parts[] = sprintf(__('Page %s', 'buddypress'), max($paged, $page)); } } // Pad the separator with 1 space on each side. $prefix = str_pad($sep, strlen($sep) + 2, ' ', STR_PAD_BOTH); // Join the parts together. $new_title = join($prefix, array_filter($title_parts)); // Append the prefix for pre `title-tag` compatibility. if (false === $title_tag_compatibility) { $new_title = $new_title . $prefix; } /** * Filters the page title for BuddyPress pages. * * @since 1.5.0 * * @param string $new_title The BuddyPress page title. * @param string $title The original WordPress page title. * @param string $sep The title parts separator. * @param string $seplocation Location of the separator (left or right). */ return apply_filters('bp_modify_page_title', $new_title, $title, $sep, $seplocation); }
/** * Determine if the current user can delete an activity item. * * @since BuddyPress (1.2.0) * * @global object $activities_template {@link BP_Activity_Template} * @uses apply_filters() To call the 'bp_activity_user_can_delete' hook * * @param object $activity Optional. Falls back on the current item in the loop. * @return bool True if can delete, false otherwise. */ function bp_activity_user_can_delete($activity = false) { global $activities_template; // Try to use current activity if none was passed if (empty($activity) && !empty($activities_template->activity)) { $activity = $activities_template->activity; } // If current_comment is set, we'll use that in place of the main activity if (isset($activity->current_comment)) { $activity = $activity->current_comment; } // Assume the user cannot delete the activity item $can_delete = false; // Only logged in users can delete activity if (is_user_logged_in()) { // Community moderators can always delete activity (at least for now) if (bp_current_user_can('bp_moderate')) { $can_delete = true; } // Users are allowed to delete their own activity. This is actually // quite powerful, because doing so also deletes all comments to that // activity item. We should revisit this eventually. if (isset($activity->user_id) && (int) $activity->user_id === bp_loggedin_user_id()) { $can_delete = true; } // Viewing a single item, and this user is an admin of that item if (bp_is_single_item() && bp_is_item_admin()) { $can_delete = true; } } /** * Filters whether the current user can delete an activity item. * * @since BuddyPress (1.5.0) * * @param bool $can_delete Whether the user can delete the item. * @param object $activity Current activity item object. */ return (bool) apply_filters('bp_activity_user_can_delete', $can_delete, $activity); }
/** * Set up your component's navigation. * * The navigation elements created here are responsible for the main site navigation (eg * Profile > Activity > Mentions), as well as the navigation in the BuddyBar. WP Admin Bar * navigation is broken out into a separate method; see * BP_course_Component::setup_admin_bar(). * * @global obj $bp */ function setup_nav($main_nav = array(), $sub_nav = array()) { $show_for_displayed_user = apply_filters('wplms_user_profile_courses', false); $main_nav = array('name' => sprintf(__('Courses <span>%s</span>', 'vibe'), bp_course_get_total_course_count_for_user()), 'slug' => BP_COURSE_SLUG, 'position' => 5, 'screen_function' => 'bp_course_my_courses', 'show_for_displayed_user' => $show_for_displayed_user, 'default_subnav_slug' => BP_COURSE_SLUG); // Add 'course' to the main navigation if (function_exists('vibe_get_option')) { $course_view = vibe_get_option('course_view'); if (isset($course_view) && $course_view) { $main_nav['show_for_displayed_user'] = $show_for_displayed_user; //Change for admin } } $course_link = trailingslashit(bp_loggedin_user_domain() . BP_COURSE_SLUG); // Determine user to use if (bp_displayed_user_domain()) { $user_domain = bp_displayed_user_domain(); } elseif (bp_loggedin_user_domain()) { $user_domain = bp_loggedin_user_domain(); } else { $user_domain = false; } if (!empty($user_domain)) { $user_access = bp_is_my_profile(); $user_access = apply_filters('wplms_user_profile_courses', $user_access); $sub_nav[] = array('name' => __('My Courses', 'vibe'), 'slug' => BP_COURSE_SLUG, 'parent_url' => $course_link, 'parent_slug' => BP_COURSE_SLUG, 'screen_function' => 'bp_course_my_courses', 'user_has_access' => $user_access, 'position' => 10); bp_core_new_subnav_item(array('name' => __('Results', 'vibe'), 'slug' => BP_COURSE_RESULTS_SLUG, 'parent_slug' => BP_COURSE_SLUG, 'parent_url' => $course_link, 'screen_function' => 'bp_course_my_results', 'position' => 30, 'user_has_access' => $user_access)); bp_core_new_subnav_item(array('name' => __('Stats', 'vibe'), 'slug' => BP_COURSE_STATS_SLUG, 'parent_slug' => BP_COURSE_SLUG, 'parent_url' => $course_link, 'screen_function' => 'bp_course_stats', 'position' => 40, 'user_has_access' => $user_access)); $sub_nav[] = array('name' => __('Instructing Courses', 'vibe'), 'slug' => BP_COURSE_INSTRUCTOR_SLUG, 'parent_url' => $course_link, 'parent_slug' => BP_COURSE_SLUG, 'screen_function' => 'bp_course_instructor_courses', 'user_has_access' => bp_is_my_profile_intructor(), 'position' => 50); parent::setup_nav($main_nav, $sub_nav); } // If your component needs additional navigation menus that are not handled by // BP_Component::setup_nav(), you can register them manually here. For course, // if your component needs a subsection under a user's Settings menu, add // it like this. See bp_course_screen_settings_menu() for more info /*global $bp; $bp->is_single_item=true; // Extra comments : BuddyPress never detects a single course page $bp->current_component=BP_COURSE_SLUG; // Extra comments : BuddyPress successfully detects Course $bp->current_item=$bp->current_action='fikka-dynamics'; // Extra comments : Only Works if we force the current item variable. Never really works. */ if (bp_is_course_component() && bp_is_single_item()) { // Reset sub nav $sub_nav = array(); // Add 'courses' to the main navigation $main_nav = array('name' => __('Home', 'vibe'), 'slug' => get_current_course_slug(), 'position' => -1, 'screen_function' => 'bp_screen_course_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id); /* BELOW Part has to hacked to build a custom Menu system. BuddyPress never really detects MENUS properly // Add the "Home" subnav item, as this will always be present $sub_nav[] = array( 'name' => _e( 'CURRICULUM', 'vibe' ), 'slug' => 'structure', 'parent_url' => $course_link, 'parent_slug' => get_current_course_slug(), 'screen_function' => 'bp_screen_course_structure', 'position' => 10, 'item_css_id' => 'structure' ); $sub_nav[] = array( 'name' => _x( 'Home', 'Course home', 'vibe' ), 'slug' => 'home', 'parent_url' => $course_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'bp_screen_course_home', 'position' => 10, 'item_css_id' => 'home' ); /* // If this is a private course, and the user is not a // member and does not have an outstanding invitation, // show a "Request Membership" nav item. if ( is_user_logged_in() && !user_check_course_subscribe()){ $sub_nav[] = array( 'name' => __( 'Subscribe Course', 'vibe' ), 'slug' => 'subscribe-course', 'parent_url' => bp_get_course_permalink(), 'parent_slug' => get_current_course_slug(), 'screen_function' => 'bp_screen_course_subscribe', 'position' => 30 ); } if ( is_user_logged_in() && user_check_course_subscribe()){ $sub_nav[] = array( 'name' => __( 'Course Status', 'vibe' ), 'slug' => 'course-continue', 'parent_url' => bp_get_course_permalink(), 'parent_slug' => get_current_course_slug(), 'screen_function' => 'bp_screen_course_subscribe', 'position' => 30 ); } $sub_nav[] = array( 'name' => sprintf( __( 'Members <span>%s</span>', 'vibe' ), number_format( $this->current_course->total_member_count ) ), 'slug' => 'members', 'parent_url' => bp_get_course_permalink(), 'parent_slug' => get_current_course_slug(), 'screen_function' => 'bp_screen_course_members', 'position' => 60, 'user_has_access' => user_check_course_subscribe(), 'item_css_id' => 'members' ); // If the user is a course admin, then show the course admin nav item if ( bp_is_item_admin() ) { $sub_nav[] = array( 'name' => __( 'Admin', 'vibe' ), 'slug' => 'admin', 'parent_url' => bp_get_course_permalink(), 'parent_slug' => get_current_course_slug(), 'screen_function' => 'bp_screen_course_admin', 'position' => 1000, 'user_has_access' => true, 'item_css_id' => 'admin' ); } */ parent::setup_nav($main_nav, $sub_nav); } if (isset($this->current_course->user_has_access)) { do_action('courses_setup_nav', $this->current_course->user_has_access); } else { do_action('courses_setup_nav'); } }
/** * Determine if the current user can delete an activity item. * * @since BuddyPress (1.2) * * @global object $activities_template {@link BP_Activity_Template} * @uses apply_filters() To call the 'bp_activity_user_can_delete' hook * * @param object $activity Optional. Falls back on the current item in the loop. * @return bool True if can delete, false otherwise. */ function bp_activity_user_can_delete($activity = false) { global $activities_template; if (!$activity) { $activity = $activities_template->activity; } if (isset($activity->current_comment)) { $activity = $activity->current_comment; } $can_delete = false; if (bp_current_user_can('bp_moderate')) { $can_delete = true; } if (is_user_logged_in() && $activity->user_id == bp_loggedin_user_id()) { $can_delete = true; } if (bp_is_item_admin() && bp_is_single_item()) { $can_delete = true; } return apply_filters('bp_activity_user_can_delete', $can_delete, $activity); }
*/ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Set 'BP_SHOW_DISPLAYNAME_ON_PROFILE' constant if not already defined if (!defined('BP_SHOW_DISPLAYNAME_ON_PROFILE')) { define('BP_SHOW_DISPLAYNAME_ON_PROFILE', true); } if ((bool) BP_SHOW_DISPLAYNAME_ON_PROFILE === true) { // only show the display name for the <h1> tag on a member profile add_action('bp_before_member_header', create_function('', 'remove_filter( "bp_displayed_user_fullname", "ray_bp_displayed_user_fullname" );'), 99); // add back the username filter add_action('bp_before_member_header_meta', create_function('', 'add_filter( "bp_displayed_user_fullname", "ray_bp_displayed_user_fullname" );'), 0); // support for BP Lists if (function_exists('bp_is_lists_component') && bp_is_lists_component() && bp_is_single_item()) { add_filter('bp_displayed_user_fullname', 'ray_bp_displayed_user_fullname'); } } else { add_filter('bp_displayed_user_fullname', 'ray_bp_displayed_user_fullname'); } /* UTILITY *********************************************************/ /** * Returns either the username or user nicename depending on the BuddyPress * username compatibility mode. * * @since 0.6 * * @param obj $userdata Object The userdata that includes the user_login and user_nicename. * @mixed String on success; boolean false on failure */
/** * Gets the items for the breadcrumb item if bbPress is installed. * * @since 0.4 * * @param array $args Mixed arguments for the menu. * @return array List of items to be shown in the item. */ function breadcrumbs_plus_get_bbpress_items($args = array()) { $item = array(); $post_type_object = get_post_type_object(bbp_get_forum_post_type()); if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) { if (function_exists('bp_is_active')) { global $bp; // we're outside the loop! // Assign some variables here $page1 = isset($bp->members->root_slug) ? $bp->members->root_slug : ''; // slug for the Members page. The BuddyPress default is 'members'. $page2 = isset($bp->groups->root_slug) ? $bp->groups->root_slug : ''; // slug for the Groups page. The BuddyPress default is 'groups'. $page3 = isset($bp->activity->root_slug) ? $bp->activity->root_slug : ''; // slug for the Activity page. The BuddyPress default is 'activity'. $page4 = isset($bp->forums->root_slug) ? $bp->forums->root_slug : ''; // slug for the Forums page. The BuddyPress default is 'forums'. $page5 = isset($bp->achievements->root_slug) ? $bp->achievements->root_slug : ''; // slug for the Achievements page. The BuddyPress default is 'achievements'. if (!bp_is_blog_page() && (is_page() || is_page($page1) || is_page($page2) || is_page($page3) || is_page($page4) || is_page($page5)) && !bp_is_user() && !bp_is_single_item() && !bp_is_register_page()) { $item[] = ''; } if (bp_is_user() && !bp_is_register_page()) { $item[] = ''; } } else { //$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link( bbp_get_forum_post_type() ) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>'; } } if (bbp_is_forum_archive()) { $item[] = bbp_get_forum_archive_title(); } else { $item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>'; } if (bbp_is_topic_archive()) { $item[] = bbp_get_topic_archive_title(); } elseif (bbp_is_single_view()) { $item[] = bbp_get_view_title(); } elseif (bbp_is_single_topic()) { $topic_id = get_queried_object_id(); $item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_topic_forum_id($topic_id))); if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) { $item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '" rel="v:url" property="v:title">' . bbp_get_topic_title($topic_id) . '</a></div>'; } else { $item[] = ''; } if (bbp_is_topic_split()) { $item[] = __('Split', 'framework'); } elseif (bbp_is_topic_merge()) { $item[] = __('Merge', 'framework'); } elseif (bbp_is_topic_edit()) { $item[] = __('Edit', 'framework'); } } elseif (bbp_is_single_reply()) { $reply_id = get_queried_object_id(); $item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_reply_topic_id($reply_id))); if (!bbp_is_reply_edit()) { $item[] = bbp_get_reply_title($reply_id); } else { $item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '" rel="v:url" property="v:title">' . bbp_get_reply_title($reply_id) . '</a></div>'; $item[] = __('Edit', 'framework'); } } elseif (bbp_is_single_forum()) { $forum_id = get_queried_object_id(); $forum_parent_id = bbp_get_forum_parent_id($forum_id); if (0 !== $forum_parent_id) { $item = array_merge($item, breadcrumbs_plus_get_parents($forum_parent_id)); } $item[] = bbp_get_forum_title($forum_id); } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) { if (bbp_is_single_user_edit()) { $item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '" rel="v:url" property="v:title">' . bbp_get_displayed_user_field('display_name') . '</a></div>'; $item[] = __('Edit', 'framework'); } else { $item[] = bbp_get_displayed_user_field('display_name'); } } return apply_filters('breadcrumbs_plus_get_bbpress_items', $item, $args); }
function bp_screen_course_home() { if (!bp_is_single_item()) { return false; } do_action('bp_screen_course_home'); bp_core_load_template(apply_filters('bp_template_course_home', 'courses/single/home')); }
/** * Return the permalink for the current topic in the loop. * * @since 1.0.0 * * @return string Permalink for the current topic. */ function bp_get_the_topic_permalink() { global $forum_template; // The topic is in a loop where its parent object is loaded. if (bp_get_the_topic_object_slug()) { $permalink = trailingslashit(bp_get_groups_directory_permalink() . bp_get_the_topic_object_slug() . '/forum'); // We are viewing a single group topic, so use the current item. } elseif (bp_is_group_forum_topic()) { $permalink = trailingslashit(bp_get_groups_directory_permalink() . bp_current_item() . '/forum'); // We are unsure what the context is, so fallback to forum root slug. } elseif (bp_is_single_item()) { $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item()); // This is some kind of error situation, so use forum root. } else { $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug()); } /** * Filters the permalink for the current topic in the loop. * * @since 1.0.0 * * @param string $value Permalink for the current topic in the loop. */ return apply_filters('bp_get_the_topic_permalink', trailingslashit($permalink . 'topic/' . $forum_template->topic->topic_slug)); }
/** * Customize the body class, according to the currently displayed BP content. * * Uses the above is_() functions to output a body class for each scenario. * * @since 1.1.0 * * @param array $wp_classes The body classes coming from WP. * @param array|bool $custom_classes Classes that were passed to get_body_class(). * @return array $classes The BP-adjusted body classes. */ 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'; // Add current user member types. if ($member_types = bp_get_member_type(bp_displayed_user_id(), false)) { foreach ($member_types as $member_type) { $bp_classes[] = sprintf('member-type-%s', esc_attr($member_type)); } } } 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'; } } else { if (bp_get_current_member_type()) { $bp_classes[] = 'type'; } } 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()) { $bp_classes[] = 'group-' . groups_get_current_group()->slug; // Add current group types. if ($group_types = bp_groups_get_group_type(bp_get_current_group_id(), false)) { foreach ($group_types as $group_type) { $bp_classes[] = sprintf('group-type-%s', esc_attr($group_type)); } } } 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)); /** * Filters the BuddyPress classes to be added to body_class() * * @since 1.1.0 * * @param array $classes Array of body classes to add. * @param array $bp_classes Array of BuddyPress-based classes. * @param array $wp_classes Array of WordPress-based classes. * @param array $custom_classes Array of classes that were passed to get_body_class(). */ return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes); }
/** * Setup the group forums class filters * * @since bbPress (r4552) */ private function setup_filters() { // Group forum pagination add_filter('bbp_topic_pagination', array($this, 'topic_pagination')); add_filter('bbp_replies_pagination', array($this, 'replies_pagination')); // Tweak the redirect field add_filter('bbp_new_topic_redirect_to', array($this, 'new_topic_redirect_to'), 10, 3); add_filter('bbp_new_reply_redirect_to', array($this, 'new_reply_redirect_to'), 10, 3); // Map forum/topic/replys permalinks to their groups add_filter('bbp_get_forum_permalink', array($this, 'map_forum_permalink_to_group'), 10, 2); add_filter('bbp_get_topic_permalink', array($this, 'map_topic_permalink_to_group'), 10, 2); add_filter('bbp_get_reply_permalink', array($this, 'map_reply_permalink_to_group'), 10, 2); // Map reply edit links to their groups add_filter('bbp_get_reply_edit_url', array($this, 'map_reply_edit_url_to_group'), 10, 2); // Map assorted template function permalinks add_filter('post_link', array($this, 'post_link'), 10, 2); add_filter('page_link', array($this, 'page_link'), 10, 2); add_filter('post_type_link', array($this, 'post_type_link'), 10, 2); // Map group forum activity items to groups add_filter('bbp_before_record_activity_parse_args', array($this, 'map_activity_to_group')); /** Caps **************************************************************/ // Only add these filters if inside a group forum if (bp_is_single_item() && bp_is_groups_component() && bp_is_current_action('forum')) { // Allow group member to view private/hidden forums add_filter('bbp_map_meta_caps', array($this, 'map_group_forum_meta_caps'), 10, 4); // Group member permissions to view the topic and reply forms add_filter('bbp_current_user_can_access_create_topic_form', array($this, 'form_permissions')); add_filter('bbp_current_user_can_access_create_reply_form', array($this, 'form_permissions')); } }
* * Override this template by copying it to yourtheme/course/index.php * * @author VibeThemes * @package vibe-course-module/templates * @version 1.8.1 */ get_header('buddypress'); global $bp; $id = 0; $page_array = get_option('bp-pages'); if (isset($page_array['course'])) { $id = $page_array['course']; } if (bp_is_course_component()) { if (bp_is_single_item()) { bp_core_load_template('course/single/home'); } } ?> <section id="coursestitle"> <div class="container"> <div class="row"> <div class="col-md-9 col-sm-8"> <div class="pagetitle"> <h1><?php the_title(); ?> </h1> <?php the_sub_title($id);
/** * Filter the page title for BuddyPress pages * * @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 * @see wp_title() * @since BuddyPress (1.5) */ 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 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 it's name $component_id = $component_name = bp_current_component(); // Use the actual component name if (!empty($bp->{$component_id}->name)) { $component_name = $bp->{$component_id}->name; // Fall back on the component ID (probably same as current_component) } elseif (!empty($bp->{$component_id}->id)) { $component_name = $bp->{$component_id}->id; } // translators: "displayed user's name | canonicalised component name" $title = strip_tags(sprintf(__('%1$s | %2$s', 'buddypress'), bp_get_displayed_user_fullname(), ucwords($component_name))); // 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: "group name | group nav section name" $title = sprintf(__('%1$s | %2$s', 'buddypress'), $bp->bp_options_title, $subnav); // A single item from a component other than groups } elseif (bp_is_single_item()) { // translators: "component item name | component nav section name | root component name" $title = sprintf(__('%1$s | %2$s | %3$s', 'buddypress'), $bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name'], bp_get_name_from_root_slug(bp_get_root_slug())); // An index or directory } elseif (bp_is_directory()) { if (!bp_current_component()) { $title = sprintf(__('%s Directory', 'buddypress'), bp_get_name_from_root_slug()); } else { $title = sprintf(__('%s Directory', 'buddypress'), bp_get_name_from_root_slug()); } // 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 widget($args, $instance) { global $bp; extract($args); if (bp_checkins_is_group_places_area() || bp_checkins_is_user_area() && bp_is_current_action('places-area') || bp_checkins_if_single_place()) { return false; } if (!$instance['max_places']) { $instance['max_places'] = 5; } if (!$instance['places_type']) { $instance['places_type'] = -1; } if ($instance['dynamic'] === false) { $instance['dynamic'] = 1; } echo $before_widget; echo $before_title . $instance['title'] . $after_title; ?> <?php $widget_args = array('per_page' => $instance['max_places'], 'type' => $instance['places_type']); if ((int) $instance['dynamic'] == 1 && bp_displayed_user_id()) { $widget_args['user_id'] = bp_displayed_user_id(); } if ((int) $instance['dynamic'] == 1 && bp_is_groups_component() && bp_is_single_item() && $bp->groups->current_group->status == 'public') { $widget_args['group_id'] = $bp->groups->current_group->id; } ?> <?php if (!empty($widget_args['group_id']) || !empty($widget_args['user_id'])) { ?> <div class="item-options"> <?php if (bp_displayed_user_id()) { printf(__('%s's places', 'bp-checkins'), bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'object' => 'user', 'type' => 'thumb', 'width' => 20, 'height' => 20)) . bp_core_get_userlink(bp_displayed_user_id())); } if (bp_is_groups_component() && bp_is_single_item()) { printf(__('%s's places', 'bp-checkins'), bp_core_fetch_avatar(array('item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => 'thumb', 'width' => 20, 'height' => 20)) . '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_attr($bp->groups->current_group->name) . '</a>'); } ?> </div> <?php } ?> <?php if (bp_checkins_has_places($widget_args)) { ?> <ul id="widget-places-list" class="item-list"> <?php while (bp_checkins_has_places()) { bp_checkins_the_place(); ?> <li> <div class="item-avatar"> <?php bp_checkins_places_avatar(); ?> </div> <div class="item-title"> <a href="<?php bp_checkins_places_the_permalink(); ?> " title="<?php bp_checkins_places_title(); ?> "><?php bp_checkins_places_title(); ?> </a> </div> <?php if (bp_checkins_places_is_live()) { ?> <div class="item-meta"> <span class="activity"><?php bp_checkins_places_live_status(); ?> </span> </div> <?php } ?> <div class="clear"></div> </li> <?php } ?> <?php } else { ?> <div class="widget-error"> <p><?php _e('Sorry, there was no places found.', 'bp-checkins'); ?> </p> </div> <?php } ?> <?php echo $after_widget; ?> <?php }
/** * This screen function handles actions related to group forums * * @package BuddyPress */ function groups_screen_group_forum() { global $bp; if (!bp_is_active('forums') || !bp_forums_is_installed_correctly()) { return false; } if (bp_action_variable(0) && !bp_is_action_variable('topic', 0)) { bp_do_404(); return; } if (!$bp->groups->current_group->user_has_access) { bp_core_no_access(); return; } if (bp_is_single_item()) { // Fetch the details we need $topic_slug = (string) bp_action_variable(1); $topic_id = bp_forums_get_topic_id_from_slug($topic_slug); $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id'); $user_is_banned = false; if (!bp_current_user_can('bp_moderate') && groups_is_user_banned(bp_loggedin_user_id(), $bp->groups->current_group->id)) { $user_is_banned = true; } if (!empty($topic_slug) && !empty($topic_id)) { // Posting a reply if (!$user_is_banned && !bp_action_variable(2) && isset($_POST['submit_reply'])) { // Check the nonce check_admin_referer('bp_forums_new_reply'); // Auto join this user if they are not yet a member of this group if (bp_groups_auto_join() && !bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) { groups_join_group($bp->groups->current_group->id, bp_loggedin_user_id()); } $topic_page = isset($_GET['topic_page']) ? $_GET['topic_page'] : false; if (!($post_id = groups_new_group_forum_post($_POST['reply_text'], $topic_id, $topic_page))) { bp_core_add_message(__('There was an error when replying to that topic', 'buddypress'), 'error'); } else { bp_core_add_message(__('Your reply was posted successfully', 'buddypress')); } if (isset($_SERVER['QUERY_STRING'])) { $query_vars = '?' . $_SERVER['QUERY_STRING']; } bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id); } else { if (bp_is_action_variable('stick', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) { // Check the nonce check_admin_referer('bp_forums_stick_topic'); if (!bp_forums_sticky_topic(array('topic_id' => $topic_id))) { bp_core_add_message(__('There was an error when making that topic a sticky', 'buddypress'), 'error'); } else { bp_core_add_message(__('The topic was made sticky successfully', 'buddypress')); } do_action('groups_stick_forum_topic', $topic_id); bp_core_redirect(wp_get_referer()); } else { if (bp_is_action_variable('unstick', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) { // Check the nonce check_admin_referer('bp_forums_unstick_topic'); if (!bp_forums_sticky_topic(array('topic_id' => $topic_id, 'mode' => 'unstick'))) { bp_core_add_message(__('There was an error when unsticking that topic', 'buddypress'), 'error'); } else { bp_core_add_message(__('The topic was unstuck successfully', 'buddypress')); } do_action('groups_unstick_forum_topic', $topic_id); bp_core_redirect(wp_get_referer()); } else { if (bp_is_action_variable('close', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) { // Check the nonce check_admin_referer('bp_forums_close_topic'); if (!bp_forums_openclose_topic(array('topic_id' => $topic_id))) { bp_core_add_message(__('There was an error when closing that topic', 'buddypress'), 'error'); } else { bp_core_add_message(__('The topic was closed successfully', 'buddypress')); } do_action('groups_close_forum_topic', $topic_id); bp_core_redirect(wp_get_referer()); } else { if (bp_is_action_variable('open', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) { // Check the nonce check_admin_referer('bp_forums_open_topic'); if (!bp_forums_openclose_topic(array('topic_id' => $topic_id, 'mode' => 'open'))) { bp_core_add_message(__('There was an error when opening that topic', 'buddypress'), 'error'); } else { bp_core_add_message(__('The topic was opened successfully', 'buddypress')); } do_action('groups_open_forum_topic', $topic_id); bp_core_redirect(wp_get_referer()); } else { if (empty($user_is_banned) && bp_is_action_variable('delete', 2) && !bp_action_variable(3)) { // Fetch the topic $topic = bp_forums_get_topic_details($topic_id); /* Check the logged in user can delete this topic */ if (!$bp->is_item_admin && !$bp->is_item_mod && (int) bp_loggedin_user_id() != (int) $topic->topic_poster) { bp_core_redirect(wp_get_referer()); } // Check the nonce check_admin_referer('bp_forums_delete_topic'); do_action('groups_before_delete_forum_topic', $topic_id); if (!groups_delete_group_forum_topic($topic_id)) { bp_core_add_message(__('There was an error deleting the topic', 'buddypress'), 'error'); } else { bp_core_add_message(__('The topic was deleted successfully', 'buddypress')); } do_action('groups_delete_forum_topic', $topic_id); bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'forum/'); } else { if (empty($user_is_banned) && bp_is_action_variable('edit', 2) && !bp_action_variable(3)) { // Fetch the topic $topic = bp_forums_get_topic_details($topic_id); // Check the logged in user can edit this topic if (!$bp->is_item_admin && !$bp->is_item_mod && (int) bp_loggedin_user_id() != (int) $topic->topic_poster) { bp_core_redirect(wp_get_referer()); } if (isset($_POST['save_changes'])) { // Check the nonce check_admin_referer('bp_forums_edit_topic'); $topic_tags = !empty($_POST['topic_tags']) ? $_POST['topic_tags'] : false; if (!groups_update_group_forum_topic($topic_id, $_POST['topic_title'], $_POST['topic_text'], $topic_tags)) { bp_core_add_message(__('There was an error when editing that topic', 'buddypress'), 'error'); } else { bp_core_add_message(__('The topic was edited successfully', 'buddypress')); } do_action('groups_edit_forum_topic', $topic_id); bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic_slug . '/'); } bp_core_load_template(apply_filters('groups_template_group_forum_topic_edit', 'groups/single/home')); } else { if (empty($user_is_banned) && bp_is_action_variable('delete', 2) && ($post_id = bp_action_variable(4))) { // Fetch the post $post = bp_forums_get_post($post_id); // Check the logged in user can edit this topic if (!$bp->is_item_admin && !$bp->is_item_mod && (int) bp_loggedin_user_id() != (int) $post->poster_id) { bp_core_redirect(wp_get_referer()); } // Check the nonce check_admin_referer('bp_forums_delete_post'); do_action('groups_before_delete_forum_post', $post_id); if (!groups_delete_group_forum_post($post_id)) { bp_core_add_message(__('There was an error deleting that post', 'buddypress'), 'error'); } else { bp_core_add_message(__('The post was deleted successfully', 'buddypress')); } do_action('groups_delete_forum_post', $post_id); bp_core_redirect(wp_get_referer()); } else { if (empty($user_is_banned) && bp_is_action_variable('edit', 2) && ($post_id = bp_action_variable(4))) { // Fetch the post $post = bp_forums_get_post($post_id); // Check the logged in user can edit this topic if (!$bp->is_item_admin && !$bp->is_item_mod && (int) bp_loggedin_user_id() != (int) $post->poster_id) { bp_core_redirect(wp_get_referer()); } if (isset($_POST['save_changes'])) { // Check the nonce check_admin_referer('bp_forums_edit_post'); $topic_page = isset($_GET['topic_page']) ? $_GET['topic_page'] : false; if (!($post_id = groups_update_group_forum_post($post_id, $_POST['post_text'], $topic_id, $topic_page))) { bp_core_add_message(__('There was an error when editing that post', 'buddypress'), 'error'); } else { bp_core_add_message(__('The post was edited successfully', 'buddypress')); } if ($_SERVER['QUERY_STRING']) { $query_vars = '?' . $_SERVER['QUERY_STRING']; } do_action('groups_edit_forum_post', $post_id); bp_core_redirect(bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id); } bp_core_load_template(apply_filters('groups_template_group_forum_topic_edit', 'groups/single/home')); } else { if (!empty($user_is_banned)) { bp_core_add_message(__("You have been banned from this group.", 'buddypress')); } bp_core_load_template(apply_filters('groups_template_group_forum_topic', 'groups/single/home')); } } } } } } } } } // Forum topic does not exist } elseif (!empty($topic_slug) && empty($topic_id)) { bp_do_404(); return; } else { // Posting a topic if (isset($_POST['submit_topic']) && bp_is_active('forums')) { // Check the nonce check_admin_referer('bp_forums_new_topic'); if ($user_is_banned) { $error_message = __("You have been banned from this group.", 'buddypress'); } elseif (bp_groups_auto_join() && !bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) { // Auto join this user if they are not yet a member of this group groups_join_group($bp->groups->current_group->id, bp_loggedin_user_id()); } if (empty($_POST['topic_title'])) { $error_message = __('Please provide a title for your forum topic.', 'buddypress'); } else { if (empty($_POST['topic_text'])) { $error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress'); } } if (empty($forum_id)) { $error_message = __('This group does not have a forum setup yet.', 'buddypress'); } if (isset($error_message)) { bp_core_add_message($error_message, 'error'); $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum'; } else { if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) { bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error'); $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum'; } else { bp_core_add_message(__('The topic was created successfully', 'buddypress')); $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/'; } } bp_core_redirect($redirect); } do_action('groups_screen_group_forum', $topic_id, $forum_id); bp_core_load_template(apply_filters('groups_template_group_forum', 'groups/single/home')); } } }
/** * This function looks scarier than it actually is. :) * Each object loop (activity/members/groups/blogs/forums) contains default * parameters to show specific information based on the page we are currently * looking at. * * The following function will take into account any cookies set in the JS and * allow us to override the parameters sent. That way we can change the results * returned without reloading the page. * * By using cookies we can also make sure that user settings are retained * across page loads. * * @return string Query string for the component loops * @since BuddyPress (1.2) */ function bp_legacy_theme_ajax_querystring($query_string, $object) { if (empty($object)) { return ''; } // Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts if (!empty($_POST['cookie'])) { $_BP_COOKIE = wp_parse_args(str_replace('; ', '&', urldecode($_POST['cookie']))); } else { $_BP_COOKIE =& $_COOKIE; } $qs = array(); /** * Check if any cookie values are set. If there are then override the * default params passed to the template loop. */ // Activity stream filtering on action if (!empty($_BP_COOKIE['bp-' . $object . '-filter']) && '-1' != $_BP_COOKIE['bp-' . $object . '-filter']) { $qs[] = 'type=' . $_BP_COOKIE['bp-' . $object . '-filter']; $qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter']; } if (!empty($_BP_COOKIE['bp-' . $object . '-scope'])) { if ('personal' == $_BP_COOKIE['bp-' . $object . '-scope']) { $user_id = bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id(); $qs[] = 'user_id=' . $user_id; } // Activity stream scope only on activity directory. if ('all' != $_BP_COOKIE['bp-' . $object . '-scope'] && !bp_displayed_user_id() && !bp_is_single_item()) { $qs[] = 'scope=' . $_BP_COOKIE['bp-' . $object . '-scope']; } } // If page and search_terms have been passed via the AJAX post request, use those. if (!empty($_POST['page']) && '-1' != $_POST['page']) { $qs[] = 'page=' . absint($_POST['page']); } // excludes activity just posted and avoids duplicate ids if (!empty($_POST['exclude_just_posted'])) { $just_posted = wp_parse_id_list($_POST['exclude_just_posted']); $qs[] = 'exclude=' . implode(',', $just_posted); } // to get newest activities if (!empty($_POST['offset'])) { $qs[] = 'offset=' . intval($_POST['offset']); } $object_search_text = bp_get_search_default_text($object); if (!empty($_POST['search_terms']) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms']) { $qs[] = 'search_terms=' . urlencode($_POST['search_terms']); } // Now pass the querystring to override default values. $query_string = empty($qs) ? '' : join('&', (array) $qs); $object_filter = ''; if (isset($_BP_COOKIE['bp-' . $object . '-filter'])) { $object_filter = $_BP_COOKIE['bp-' . $object . '-filter']; } $object_scope = ''; if (isset($_BP_COOKIE['bp-' . $object . '-scope'])) { $object_scope = $_BP_COOKIE['bp-' . $object . '-scope']; } $object_page = ''; if (isset($_BP_COOKIE['bp-' . $object . '-page'])) { $object_page = $_BP_COOKIE['bp-' . $object . '-page']; } $object_search_terms = ''; if (isset($_BP_COOKIE['bp-' . $object . '-search-terms'])) { $object_search_terms = $_BP_COOKIE['bp-' . $object . '-search-terms']; } $object_extras = ''; if (isset($_BP_COOKIE['bp-' . $object . '-extras'])) { $object_extras = $_BP_COOKIE['bp-' . $object . '-extras']; } /** * Filters the AJAX query string for the component loops. * * @since BuddyPress (1.7.0) * * @param string $query_string The query string we are working with. * @param string $object The type of page we are on. * @param string $object_filter The current object filter. * @param string $object_scope The current object scope. * @param string $object_page The current object page. * @param string $object_search_terms The current object search terms. * @param string $object_extras The current object extras. */ return apply_filters('bp_legacy_theme_ajax_querystring', $query_string, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras); }
/** * Catch and process "Leave Group" button clicks. * * When a group member clicks on the "Leave Group" button from a group's page, * this function is run. * * Note: When leaving a group from the group directory, AJAX is used and * another function handles this. See {@link bp_legacy_theme_ajax_joinleave_group()}. * * @since BuddyPress (1.2.4) */ function groups_action_leave_group() { if (!bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action('leave-group')) { return false; } // Nonce check if (!check_admin_referer('groups_leave_group')) { return false; } // User wants to leave any group if (groups_is_user_member(bp_loggedin_user_id(), bp_get_current_group_id())) { $bp = buddypress(); // Stop sole admins from abandoning their group $group_admins = groups_get_group_admins(bp_get_current_group_id()); if (1 == count($group_admins) && $group_admins[0]->user_id == bp_loggedin_user_id()) { bp_core_add_message(__('This group must have at least one admin', 'buddypress'), 'error'); } elseif (!groups_leave_group($bp->groups->current_group->id)) { bp_core_add_message(__('There was an error leaving the group.', 'buddypress'), 'error'); } else { bp_core_add_message(__('You successfully left the group.', 'buddypress')); } $redirect = bp_get_group_permalink(groups_get_current_group()); if ('hidden' == $bp->groups->current_group->status) { $redirect = trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug()); } bp_core_redirect($redirect); } bp_core_load_template(apply_filters('groups_template_group_home', 'groups/single/home')); }
/** * Return the permalink for the current topic in the loop. * * @return string Permalink for the current topic. */ function bp_get_the_topic_permalink() { global $forum_template, $bp; // The topic is in a loop where its parent object is loaded if (bp_get_the_topic_object_slug()) { $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_the_topic_object_slug() . '/forum'); // We are viewing a single group topic, so use the current item } elseif (bp_is_group_forum_topic()) { $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum'); // We are unsure what the context is, so fallback to forum root slug } elseif (bp_is_single_item()) { $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item()); // This is some kind of error situation, so use forum root } else { $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug()); } return apply_filters('bp_get_the_topic_permalink', trailingslashit($permalink . 'topic/' . $forum_template->topic->topic_slug)); }
/** * 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(); }
function bp_group_is_activity_permalink() { if (!bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action(bp_get_activity_slug())) { return false; } return true; }
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); }