Example #1
0
 public function check_legacy($tpl)
 {
     $status = function_exists('buddypress');
     if (!$status) {
         return $tpl;
     }
     $this->bp_plugin_name = bp_get_name_from_root_slug();
     // This check fails for some plugins
     // $status = $this->bp_plugin_name != false;
     if ($status) {
         $bp_defaults = array('members', 'xprofile', 'activity', 'blogs', 'messages', 'friends', 'groups', 'forums', 'settings');
         foreach ($bp_defaults as $bp_default) {
             if (bp_is_current_component($bp_default)) {
                 break;
             }
         }
     }
     if ($status && bp_is_directory()) {
         $this->is_legacy = $status = false;
     }
     if ($status && false === (bool) locate_template(array('members/single/item-header.php'), false)) {
         add_action('wp_footer', array($this, 'item_header'));
     }
     if ($status) {
         add_action('wp_footer', array($this, 'page_title'));
         add_action('wp_footer', array($this, 'echo_legacy_tpl'));
     }
     return $tpl;
 }
Example #2
0
    function transparent_header_title_background()
    {
        $header_style = vibe_get_customizer('header_style');
        if ($header_style == 'transparent') {
            if (is_page() || is_single() || bp_is_directory() || is_archive()) {
                global $post;
                $title_bg = get_post_meta($post->ID, 'vibe_title_bg', true);
                if (empty($title_bg)) {
                    $title_bg = vibe_get_option('title_bg');
                    if (empty($title_bg)) {
                        $title_bg = VIBE_URL . '/assets/images/title_bg.jpg';
                    }
                }
                if (is_numeric($title_bg)) {
                    $bg = wp_get_attachment_image_src($title_bg, 'full');
                    if (!empty($bg)) {
                        $title_bg = $bg[0];
                    }
                }
                if (!empty($title_bg)) {
                    ?>
	    		<style>.course_header,.group_header{background:url(<?php 
                    echo $title_bg;
                    ?>
) !important;}#title{background:url(<?php 
                    echo $title_bg;
                    ?>
) !important;padding-bottom:30px !important; background-size: cover;}#title h1,#title h5,#title a,#title,#breadcrumbs li+li:before{color:#fff !important;}</style>
	    		<?php 
                }
            }
        }
    }
Example #3
0
function bp_course_add_js()
{
    global $bp;
    if (!function_exists('vibe_logo_url')) {
        return;
    }
    // Checks if WPLMS is active in current site in WP Multisite
    wp_enqueue_script('bp-extras-js', plugins_url('/vibe-course-module/includes/js/course-module-js.min.js'), array('jquery'), bp_course_version(), true);
    if (function_exists('vibe_get_option')) {
        if (is_singular('unit') || is_singular('question') || is_singular('quiz') || is_singular('wplms-assignment') || is_page(vibe_get_option('take_course_page')) || is_page(vibe_get_option('create_course')) || isset($_GET['edit'])) {
            wp_enqueue_script('jquery-ui-core');
            wp_enqueue_script('jquery-ui-sortable');
            wp_enqueue_script('jquery-ui-droppable');
            wp_enqueue_script('jquery-ui-datepicker');
            wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
        }
    }
    if (function_exists('bp_is_directory')) {
        if (bp_is_directory() && bp_current_component() == 'course') {
            wp_enqueue_script('jquery-ui-datepicker');
        }
    }
    $action = bp_current_action();
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    }
    if (in_array($action, array('admin', 'submissions', 'stats'))) {
        wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
    }
    wp_enqueue_script('bp-course-js', plugins_url('/vibe-course-module/includes/js/course.js'), array('jquery', 'wp-mediaelement', 'buddypress-js'), bp_course_version(), true);
    $color = bp_wplms_get_theme_color();
    $single_dark_color = bp_wplms_get_theme_single_dark_color();
    $translation_array = array('too_fast_answer' => _x('Too Fast or Answer not marked.', 'Quiz answer being marked very fast', 'vibe'), 'answer_saved' => _x('Answer Saved.', 'Save answer on every question, confirmation message', 'vibe'), 'processing' => _x('Processing...', 'Quiz question anwer save under progress', 'vibe'), 'saving_answer' => _x('Saving Answer...please wait', 'Saving quiz answers under progress', 'vibe'), 'remove_user_text' => __('This step is irreversible. Are you sure you want to remove the User from the course ?', 'vibe'), 'remove_user_button' => __('Confirm, Remove User from Course', 'vibe'), 'confirm' => _x('Confirm', 'Confirm button for various popup confirmation messages', 'vibe'), 'cancel' => _x('Cancel', 'Cancel button for various popup confirmation messages', 'vibe'), 'reset_user_text' => __('This step is irreversible. All Units, Quiz results would be reset for this user. Are you sure you want to Reset the Course for this User?', 'vibe'), 'reset_user_button' => __('Confirm, Reset Course for this User', 'vibe'), 'quiz_reset' => __('This step is irreversible. All Questions answers would be reset for this user. Are you sure you want to Reset the Quiz for this User? ', 'vibe'), 'quiz_reset_button' => __('Confirm, Reset Quiz for this User', 'vibe'), 'marks_saved' => __('Marks Saved', 'vibe'), 'quiz_marks_saved' => __('Quiz Marks Saved', 'vibe'), 'submit_quiz' => __('Submit Quiz', 'vibe'), 'sending_messages' => __('Sending Messages ...', 'vibe'), 'adding_students' => __('Adding Students to Course ...', 'vibe'), 'successfuly_added_students' => __('Students successfully added to Course', 'vibe'), 'unable_add_students' => __('Unable to Add students to Course', 'vibe'), 'select_fields' => __('Please select fields to download', 'vibe'), 'download' => __('Download', 'vibe'), 'timeout' => __('TIMEOUT', 'vibe'), 'theme_color' => $color, 'single_dark_color' => $single_dark_color, 'for_course' => __('for Course', 'vibe'), 'active_filters' => __('Active Filters', 'vibe'), 'clear_filters' => __('Clear all filters', 'vibe'), 'remove_comment' => __('Are you sure you want to remove this note?', 'vibe'), 'remove_comment_button' => __('Confirm, remove note', 'vibe'), 'private_comment' => __('Make Private', 'vibe'), 'add_comment' => __('Add your note', 'vibe'), 'submit_quiz_error' => __('Please add questions or retake the quiz !', 'vibe'), 'remove_announcement' => __('Are you sure you want to remove this Annoucement?', 'vibe'), 'start_quiz_notification' => __('You\'re about to start the Quiz. Please click confirm to begin the quiz.', 'vibe'), 'submit_quiz_notification' => __('Are you sure you want to submit the quiz. Submitting the quiz will freeze all your answers, you can not change them.  Please confirm.', 'vibe'), 'check_results' => __('Check results', 'vibe'), 'correct' => __('Correct', 'vibe'), 'incorrect' => __('Incorrect', 'vibe'), 'confirm_apply' => _x('Are you sure you want to apply for this Course ?', 'confirmation message when user clicks on apply for course', 'vibe'), 'instructor_uncomplete_unit' => _x('Are you sure you want mark this unit "uncomplete" for the user ?', 'Popup confirmation message when instructor marks the unit uncomplete for the user.', 'vibe'), 'instructor_complete_unit' => _x('Are you sure you want to mark this unit "complete" for the user ?', 'Popup confirmation message ', 'vibe'), 'unanswered_questions' => __('You have few unanswered questions. Are you sure you want to continue ?', 'vibe'));
    wp_localize_script('bp-course-js', 'vibe_course_module_strings', $translation_array);
}
Example #4
0
 function remove_wpseo_from_buddypress($title)
 {
     global $bp, $post;
     if (empty($this->bp_pages)) {
         $this->bp_pages = get_option('bp-pages');
     }
     if (function_exists('bp_is_directory') && bp_is_directory() || in_array($post->ID, $this->bp_pages)) {
         $title = sprintf(_x('%s Directory - %s', 'Directory Title format', 'vibe'), ucfirst(bp_current_component()), get_bloginfo('name'));
     }
     if (function_exists('bp_is_user') && bp_is_user()) {
         //$title = sprintf(_x('%1s group - %2s','Member Name',ucfirst(bp_get_displayed_user_fullname()),get_bloginfo('name')));
         $title = ucfirst(bp_get_displayed_user_fullname()) . ' - ' . get_bloginfo('name');
     }
     if (function_exists('bp_is_group') && bp_is_group()) {
         //$title = sprintf(_x('%1s group - %2s','Group Name',ucfirst(bp_get_current_group_name()),get_bloginfo('name')));
         $title = ucfirst(bp_get_current_group_name()) . ' - ' . get_bloginfo('name');
     }
     return $title;
 }
    /**
     * Output the RSS feed.
     */
    protected function output()
    {
        // set up some additional headers if not on a directory page
        // this is done b/c BP uses pseudo-pages
        if (!bp_is_directory()) {
            global $wp_query;
            $wp_query->is_404 = false;
            status_header(200);
        }
        header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
        echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
        ?>

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	<?php 
        do_action('bp_activity_feed_rss_attributes');
        ?>
>

<channel>
	<title><?php 
        echo $this->title;
        ?>
</title>
	<link><?php 
        echo $this->link;
        ?>
</link>
	<atom:link href="<?php 
        self_link();
        ?>
" rel="self" type="application/rss+xml" />
	<description><?php 
        echo $this->description;
        ?>
</description>
	<lastBuildDate><?php 
        echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
        ?>
</lastBuildDate>
	<generator>http://buddypress.org/?v=<?php 
        bp_version();
        ?>
</generator>
	<language><?php 
        bloginfo_rss('language');
        ?>
</language>
	<ttl><?php 
        echo $this->ttl;
        ?>
</ttl>
	<sy:updatePeriod><?php 
        echo $this->update_period;
        ?>
</sy:updatePeriod>
 	<sy:updateFrequency><?php 
        echo $this->update_frequency;
        ?>
</sy:updateFrequency>
	<?php 
        do_action('bp_activity_feed_channel_elements');
        ?>

	<?php 
        if (bp_has_activities($this->activity_args)) {
            ?>
		<?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>
			<item>
				<guid isPermaLink="false"><?php 
                bp_activity_feed_item_guid();
                ?>
</guid>
				<title><?php 
                echo stripslashes(bp_get_activity_feed_item_title());
                ?>
</title>
				<link><?php 
                bp_activity_thread_permalink();
                ?>
</link>
				<pubDate><?php 
                echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false);
                ?>
</pubDate>

				<?php 
                if (bp_get_activity_feed_item_description()) {
                    ?>
					<content:encoded><![CDATA[<?php 
                    $this->feed_content();
                    ?>
]]></content:encoded>
				<?php 
                }
                ?>

				<?php 
                if (bp_activity_can_comment()) {
                    ?>
					<slash:comments><?php 
                    bp_activity_comment_count();
                    ?>
</slash:comments>
				<?php 
                }
                ?>

				<?php 
                do_action('bp_activity_feed_item_elements');
                ?>
			</item>
		<?php 
            }
            ?>

	<?php 
        }
        ?>
</channel>
</rss><?php 
    }
 /**
  * load_template()
  *
  * Choose the best way to load your plugin's content
  *
  * @package BuddyDrive Component
  * @subpackage Screens
  * @since 1.2.0
  */
 public static function load_template($template = '', $screen = '')
 {
     $buddydrive = buddydrive();
     /****
      * Displaying Content
      */
     $buddydrive->screens->template = $template;
     $buddydrive->screens->current_screen = $screen;
     if (buddypress()->theme_compat->use_with_current_theme && !empty($template)) {
         add_filter('bp_get_template_part', array(__CLASS__, 'template_part'), 10, 3);
     } else {
         // You can only use this method for users profile pages
         if (!bp_is_directory()) {
             $buddydrive->screens->template = 'members/single/plugins';
             add_action('bp_template_title', "buddydrive_{$screen}_title");
             add_action('bp_template_content', "buddydrive_{$screen}_content");
         }
     }
     bp_core_load_template(apply_filters("buddydrive_template_{$screen}", $buddydrive->screens->template));
 }
Example #7
0
/**
 * Infinity Theme: Custom Activity Tabs Template
 *
 * @author Bowe Frankema <*****@*****.**>
 * @link http://infinity.presscrew.com/
 * @copyright Copyright (C) 2010-2011 Bowe Frankema
 * @license http://www.gnu.org/licenses/gpl.html GPLv2 or later
 * @package Infinity
 * @subpackage templates
 * @since 1.0
 */
?>

<?php 
if (bp_is_activity_component() && bp_is_directory()) {
    ?>
<div id="vertical-activity-tabs" class="item-list-tabs activity-type-tabs sidebar-activity-tabs" role="navigation">
	<h4>Activity</h4>
			<ul>
				<?php 
    do_action('bp_before_activity_type_tab_all');
    ?>

				<li class="selected" id="activity-all"><a href="<?php 
    echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/';
    ?>
" title="<?php 
    _e('The public activity for everyone on this site.', 'buddypress');
    ?>
"><?php 
Example #8
0
<?php

get_header();
$cb_user_page = $cb_group_creator = $cb_title_prefix = $cb_bp_class = $cb_breadcrumbs_override = NULL;
global $bb_current_user;
$cb_breadcrumbs = ot_get_option('cb_breadcrumbs', 'on');
$cb_theme_style = ot_get_option('cb_theme_style', 'cb_boxed');
$cb_buddypress_sidebar = ot_get_option('cb_buddypress_sidebar', 'sidebar');
$cb_buddypress_global_color = ot_get_option('cb_buddypress_global_color', '#eb9812');
$cb_current_user = bp_displayed_user_id();
$cb_title = get_the_title();
$cb_bp_current_component = bp_current_component();
$cb_bp_current_action = bp_current_action();
if (($cb_bp_current_component == 'activity' || $cb_bp_current_component == 'profile') && bp_is_directory() == false && $cb_bp_current_action != NULL) {
    $cb_title_prefix = '<span>' . __('Member', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'groups' && $cb_bp_current_action != NULL) {
    $cb_title_prefix = '<span>' . __('Group', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'groups' && ($cb_bp_current_action == 'my-groups' || $cb_bp_current_action == 'invites')) {
    $cb_title_prefix = NULL;
    $cb_title = __('Groups', 'cubell');
}
if ($cb_bp_current_component == 'settings') {
    $cb_title_prefix = '<span>' . __('Settings', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'forums') {
    $cb_title_prefix = '<span>' . __('Forums', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'activity' && $cb_bp_current_action == NULL) {
    $cb_title = __('Latest Activity', 'cubell');
Example #9
0
function meso_schema_breadcrumbs()
{
    global $post;
    $schema_on = '';
    $schema_link = '';
    $schema_prop_url = '';
    $schema_prop_title = '';
    $showOnHome = 1;
    // 1 - show breadcrumbs on the homepage, 0 - don't show
    $delimiter = ' &raquo; ';
    // delimiter between crumbs
    $home = __('Home', 'mesocolumn');
    // text for the 'Home' link
    $showCurrent = 1;
    // 1 - show current post/page title in breadcrumbs, 0 - don't show
    $before = '<span class="current">';
    // tag before the current crumb
    $after = '</span>';
    // tag after the current crumb
    $schema_breadcrumb_on = get_theme_mod('schema_breadcrumb_on');
    if ($schema_breadcrumb_on == 'enable') {
        $schema_link = ' itemscope itemtype="http://data-vocabulary.org/Breadcrumb"';
        $schema_prop_url = ' itemprop="url"';
        $schema_prop_title = ' itemprop="title"';
    }
    $homeLink = home_url();
    if (is_home() || is_front_page()) {
        if ($showOnHome == 1) {
            echo '<div id="breadcrumbs"><div class="innerwrap">';
            echo __('You are here: ', 'mesocolumn');
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $homeLink . '">' . '<span' . $schema_prop_title . '>' . $home . '</span>' . '</a></span>';
            echo '</div></div>';
        }
    } else {
        echo '<div id="breadcrumbs"><div class="innerwrap">';
        if (!is_single()) {
            echo __('You are here: ', 'mesocolumn');
        }
        echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $homeLink . '">' . '<span' . $schema_prop_title . '>' . $home . '</span>' . '</a></span>' . $delimiter . ' ';
        if (is_category()) {
            $thisCat = get_category(get_query_var('cat'), false);
            if ($thisCat->parent != 0) {
                $category_link = get_category_link($thisCat->parent);
                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $category_link . '">' . '<span' . $schema_prop_title . '>' . get_cat_name($thisCat->parent) . '</span>' . '</a></span>' . $delimiter . ' ';
            }
            $category_id = get_cat_ID(single_cat_title('', false));
            $category_link = get_category_link($category_id);
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $category_link . '">' . '<span' . $schema_prop_title . '>' . single_cat_title('', false) . '</span>' . '</a></span>';
        } elseif (is_search()) {
            echo __('Search results for', 'mesocolumn') . ' "' . get_search_query() . '"';
        } elseif (is_day()) {
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_year_link(get_the_time('Y')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('Y') . '</span>' . '</a></span>' . $delimiter . ' ';
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('F') . '</span>' . '</a></span>' . $delimiter . ' ';
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('d') . '</span>' . '</a></span>';
        } elseif (is_month()) {
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_year_link(get_the_time('Y')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('Y') . '</span>' . '</a></span>' . $delimiter . ' ';
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('F') . '</span>' . '</a></span>';
        } elseif (is_year()) {
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_year_link(get_the_time('Y')) . '">' . '<span' . $schema_prop_title . '>' . get_the_time('Y') . '</span>' . '</a></span>';
        } elseif (is_single() && !is_attachment()) {
            if (get_post_type() != 'post') {
                $post_type = get_post_type_object(get_post_type());
                $slug = $post_type->rewrite;
                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $homeLink . '/' . $slug['slug'] . '">' . '<span' . $schema_prop_title . '>' . $post_type->labels->singular_name . '</span>' . '</a></span>';
                // get post type by post
                $post_type = $post->post_type;
                // get post type taxonomies
                $taxonomies = get_object_taxonomies($post_type, 'objects');
                if ($taxonomies) {
                    foreach ($taxonomies as $taxonomy_slug => $taxonomy) {
                        // get the terms related to post
                        $terms = get_the_terms($post->ID, $taxonomy_slug);
                        if (!empty($terms)) {
                            foreach ($terms as $term) {
                                $taxlist .= ' ' . $delimiter . ' ' . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_term_link($term->slug, $taxonomy_slug) . '">' . '<span' . $schema_prop_title . '>' . ucfirst($term->name) . '</span>' . '</a></span>';
                            }
                        }
                    }
                    if ($taxlist) {
                        echo $taxlist;
                    }
                }
                echo ' ' . $delimiter . ' ' . __('You are reading &raquo;', 'mesocolumn');
            } else {
                $category = get_the_category();
                if ($category) {
                    foreach ($category as $cat) {
                        echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_category_link($cat->term_id) . '">' . '<span' . $schema_prop_title . '>' . $cat->name . '</span>' . '</a></span>' . $delimiter . ' ';
                    }
                }
                echo __('You are reading &raquo;', 'mesocolumn');
            }
        } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
            $post_type = get_post_type_object(get_post_type());
            echo $before . $post_type->labels->singular_name . $after;
        } elseif (is_attachment()) {
            $parent = get_post($post->post_parent);
            $cat = get_the_category($parent->ID);
            $cat = $cat[0];
            if ($cat) {
                echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
            }
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($parent) . '">' . '<span' . $schema_prop_title . '>' . $parent->post_title . '</span>' . '</a></span>';
            if ($showCurrent == 1) {
                echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
            }
        } elseif (is_page() && !$post->post_parent) {
            if (class_exists('buddypress')) {
                global $bp;
                if (bp_is_groups_component()) {
                    echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('groups') . '</span>' . '</a></span>';
                    if (!bp_is_directory()) {
                        echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '">' . '<span' . $schema_prop_title . '>' . bp_current_item() . '</span>' . '</a></span>';
                        if (bp_current_action()) {
                            echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '/' . bp_current_action() . '">' . '<span' . $schema_prop_title . '>' . bp_current_action() . '</span>' . '</a></span>';
                        }
                    }
                } else {
                    if (bp_is_members_directory()) {
                        echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
                    } else {
                        if (bp_is_user()) {
                            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
                            echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . '">' . '<span' . $schema_prop_title . '>' . bp_get_displayed_user_username() . '</span>' . '</a></span>';
                            if (bp_current_action()) {
                                echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . bp_current_component() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
                            }
                        } else {
                            if (bp_is_directory()) {
                                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
                            } else {
                                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
                            }
                        }
                    }
                }
            } else {
                echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
            }
        } elseif (is_page() && $post->post_parent) {
            $parent_id = $post->post_parent;
            $breadcrumbs = array();
            while ($parent_id) {
                $page = get_page($parent_id);
                $breadcrumbs[] = '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($page->ID) . '">' . '<span' . $schema_prop_title . '>' . get_the_title($page->ID) . '</span>' . '</a></span>';
                $parent_id = $page->post_parent;
            }
            $breadcrumbs = array_reverse($breadcrumbs);
            for ($i = 0; $i < count($breadcrumbs); $i++) {
                echo $breadcrumbs[$i];
                if ($i != count($breadcrumbs) - 1) {
                    echo ' ' . $delimiter . ' ';
                }
            }
            echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
        } elseif (is_tag()) {
            $tag_id = get_term_by('name', single_cat_title('', false), 'post_tag');
            if ($tag_id) {
                $tag_link = get_tag_link($tag_id->term_id);
            }
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $tag_link . '">' . '<span' . $schema_prop_title . '>' . single_cat_title('', false) . '</span>' . '</a></span>';
        } elseif (is_author()) {
            global $author;
            $userdata = get_userdata($author);
            echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_author_posts_url($userdata->ID) . '">' . '<span' . $schema_prop_title . '>' . $userdata->display_name . '</span>' . '</a></span>';
        } elseif (is_404()) {
            echo ' ' . $delimiter . ' ' . __('Error 404', 'mesocolumn');
        }
        if (get_query_var('paged')) {
            if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
                echo ' (';
            }
            echo ' ' . $delimiter . ' ' . __('Page', 'mesocolumn') . ' ' . get_query_var('paged');
            if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
                echo ')';
            }
        }
        echo '</div></div>';
    }
}
Example #10
0
/**
 * Filter the page title for BuddyPress pages.
 *
 * @since BuddyPress (1.5.0)
 *
 * @see wp_title()
 * @global object $bp BuddyPress global settings.
 *
 * @param string $title Original page title.
 * @param string $sep How to separate the various items within the page title.
 * @param string $seplocation Direction to display title.
 * @return string New page title.
 */
function bp_modify_page_title( $title, $sep = '', $seplocation = '' ) {
	global $bp;

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

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

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

	$title = '';

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

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

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

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

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

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

		} else {
			$component_subnav_name = '';
		}

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

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

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

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

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

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

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

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

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

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

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

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

	return apply_filters( 'bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation );
}
/**
 * Render the navigation markup for the logged-in user.
 *
 * Each component adds to this navigation array within its own
 * [component_name]setup_nav() function.
 *
 * This navigation array is the top level navigation, so it contains items such as:
 *      [Blog, Profile, Messages, Groups, Friends] ...
 *
 * The function will also analyze the current component the user is in, to
 * determine whether or not to highlight a particular nav item.
 *
 * @todo Move to a back-compat file?
 * @deprecated Does not seem to be called anywhere in BP core.
 */
function bp_get_loggedin_user_nav()
{
    $bp = buddypress();
    // Loop through each navigation item.
    foreach ((array) $bp->bp_nav as $nav_item) {
        $selected = '';
        // If the current component matches the nav item id, then add a highlight CSS class.
        if (!bp_is_directory() && !empty($bp->active_components[bp_current_component()]) && $bp->active_components[bp_current_component()] == $nav_item['css_id']) {
            $selected = ' class="current selected"';
        }
        // If we are viewing another person (current_userid does not equal
        // loggedin_user->id then check to see if the two users are friends.
        // if they are, add a highlight CSS class to the friends nav item
        // if it exists.
        if (!bp_is_my_profile() && bp_displayed_user_id()) {
            $selected = '';
            if (bp_is_active('friends')) {
                if ($nav_item['css_id'] == $bp->friends->id) {
                    if (friends_check_friendship(bp_loggedin_user_id(), bp_displayed_user_id())) {
                        $selected = ' class="current selected"';
                    }
                }
            }
        }
        // Echo out the final list item.
        echo apply_filters_ref_array('bp_get_loggedin_user_nav_' . $nav_item['css_id'], array('<li id="li-nav-' . $nav_item['css_id'] . '" ' . $selected . '><a id="my-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a></li>', &$nav_item));
    }
    // Always add a log out list item to the end of the navigation.
    $logout_link = '<li><a id="wp-logout" href="' . wp_logout_url(bp_get_root_domain()) . '">' . __('Log Out', 'buddypress') . '</a></li>';
    echo apply_filters('bp_logout_nav_link', $logout_link);
}
Example #12
0
    function widget($args, $instance)
    {
        global $bp, $wpdb;
        extract($args);
        extract($instance, EXTR_SKIP);
        if (!is_post_type_archive('course') && !is_tax('course-cat') && !(function_exists('bp_is_directory') && bp_is_directory('course') && $bp->current_component == 'course')) {
            return;
        }
        echo $before_widget . '<div class="course_filters">';
        /* Exclude check     */
        $exclude_array = array();
        if (isset($exclude) && $exclude) {
            if (strpos($exclude, ',')) {
                $exclude_array = explode(',', $exclude);
            } else {
                $exclude_array[] = $exclude;
            }
        }
        if (isset($category) && $category) {
            $cat_args = apply_filters('wplms_course_filters_course_cat', array('orderby' => 'count', 'order' => 'DESC', 'parent' => 0));
            $categories = get_terms('course-cat', $cat_args);
            if (isset($categories) && is_array($categories)) {
                echo '<h4>' . $category_label . '</h4>';
                echo '<ul class="category_filter">';
                foreach ($categories as $category) {
                    if (!in_array($category->slug, $exclude_array)) {
                        $sub_args = array('orderby' => 'count', 'order' => 'DESC', 'child_of' => $category->term_id);
                        $sub_categories = get_terms('course-cat', $sub_args);
                        echo '<li>' . (isset($sub_categories) && is_Array($sub_categories) && count($sub_categories) ? '<span></span>' : '') . '
						<div class="checkbox">
							<input id="' . $category->slug . '" type="checkbox" class="bp-course-category-filter" name="bp-course-category-filter" value="' . $category->slug . '" /> 
							<label for="' . $category->slug . '">' . $category->name . '</label>
						</div>';
                        if (isset($sub_categories) && is_Array($sub_categories) && count($sub_categories)) {
                            echo '<ul class="sub_categories">';
                            foreach ($sub_categories as $sub_category) {
                                echo '<li>
								<div class="checkbox">
									<input id="' . $sub_category->slug . '" type="checkbox" class="bp-course-category-filter" name="bp-course-category-filter" value="' . $sub_category->slug . '" /> 
									<label for="' . $sub_category->slug . '">' . $sub_category->name . '</label>
								</div>';
                            }
                            echo '</ul>';
                        }
                        echo '</li>';
                    }
                }
                echo '</ul>';
            }
        }
        if (isset($location) && $location) {
            $args = apply_filters('wplms_course_filters_location', array('orderby' => 'count', 'order' => 'DESC'));
            $categories = get_terms('location', $args);
            if (isset($categories) && is_array($categories)) {
                echo '<h4>' . $location_label . '</h4>';
                echo '<ul class="location_filter">';
                foreach ($categories as $category) {
                    if (!in_array($category->slug, $exclude_array)) {
                        echo '<li>
						<div class="checkbox">
							<input id="' . $category->slug . '" type="checkbox" class="bp-course-location-filter" name="bp-course-category-level" value="' . $category->slug . '" /> 
							<label for="' . $category->slug . '">' . $category->name . '</label>
						</div></li>';
                    }
                }
                echo '</ul>';
            }
        }
        if (isset($level) && $level) {
            $args = apply_filters('wplms_course_filters_level', array('orderby' => 'count', 'order' => 'DESC'));
            $categories = get_terms('level', $args);
            if (isset($categories) && is_array($categories)) {
                echo '<h4>' . $level_label . '</h4>';
                echo '<ul class="level_filter">';
                foreach ($categories as $category) {
                    if (!in_array($category->slug, $exclude_array)) {
                        echo '<li>
						<div class="checkbox">
							<input id="' . $category->slug . '" type="checkbox" class="bp-course-level-filter" name="bp-course-category-level" value="' . $category->slug . '" /> 
							<label for="' . $category->slug . '">' . $category->name . '</label>
						</div></li>';
                    }
                }
                echo '</ul>';
            }
        }
        if (isset($instructor) && $instructor) {
            echo '<h4>' . $instructor_label . '</h4>';
            echo '<ul class="instructor_filter">';
            $flag = apply_filters('wplms_show_admin_in_instructors', 1);
            if (isset($flag) && $flag) {
                $instructor_args = apply_filters('wplms_course_filter_admin_args', array('role' => 'Administrator'));
                $user_query = new WP_User_Query($instructor_args);
                // User Loop
                if (!empty($user_query->results)) {
                    foreach ($user_query->results as $user) {
                        echo '<li>
							<div class="checkbox">
								<input id="user' . $user->ID . '" type="checkbox" class="bp-course-instructor-filter" name="bp-course-instructor-filter" value="' . $user->ID . '" /> <label for="user' . $user->ID . '">' . $user->display_name . '</label>
							</div></li>';
                    }
                }
            }
            $instructor_args = apply_filters('wplms_course_filter_instructor_args', array('role' => 'Instructor'));
            $user_query = new WP_User_Query($instructor_args);
            // User Loop
            if (!empty($user_query->results)) {
                foreach ($user_query->results as $user) {
                    echo '<li><div class="checkbox">
							<input id="user' . $user->ID . '" type="checkbox" class="bp-course-instructor-filter" name="bp-course-instructor-filter" value="' . $user->ID . '" /> <label for="user' . $user->ID . '">' . $user->display_name . '</label>
							</div></li>';
                }
            }
            echo '</ul>';
        }
        if (isset($offline) && $offline) {
            echo '<h4>' . $offline_label . '</h4>';
            echo '<ul class="type_filter">';
            echo '<li><div class="radio"><input id="all_online" type="radio" class="bp-course-offline-filter" name="bp-course-offline-filter" value="all" /><label for="all_online">' . __('All', 'vibe') . '</label></div></li>';
            echo '<li><div class="radio"><input id="online" type="radio" class="bp-course-offline-filter" name="bp-course-offline-filter" value="H" /><label for="online">' . __('Online', 'vibe') . '</label></div></li>';
            echo '<li><div class="radio"><input id="offline" type="radio" class="bp-course-offline-filter" name="bp-course-offline-filter" value="S" /><label for="offline">' . __('Offline', 'vibe') . '</label></div></li>';
            echo '</ul>';
        }
        if (isset($upcoming) && $upcoming) {
            echo '<h4>' . $upcoming_label . '</h4>';
            echo '<ul class="date_filter">';
            echo '<li><input type="text" id="start_date" class="datepicker form_field bp-course-date-filter" data-type="start_date" value="" placeholder="' . __('Start Date', 'vibe') . '"></li>';
            echo '<li><input type="text" id="end_date" class="datepicker form_field bp-course-date-filter"  data-type="end_date" value="" placeholder="' . __('End Date', 'vibe') . '"></li>';
            echo '</ul>';
        }
        if (isset($free) && $free) {
            echo '<h4>' . $free_label . '</h4>';
            echo '<ul class="type_filter">';
            echo '<li><div class="radio"><input id="all" type="radio" class="bp-course-free-filter" name="bp-course-free-filter" value="all"  /> <label for="all">' . __('All', 'vibe') . '</label></div></li>';
            echo '<li><div class="radio"><input id="free" type="radio" class="bp-course-free-filter" name="bp-course-free-filter" value="free" /> <label for="free">' . __('Free', 'vibe') . '</label></div></li>';
            echo '<li><div class="radio"><input id="paid" type="radio" class="bp-course-free-filter" name="bp-course-free-filter" value="paid" /> <label for="paid">' . __('Paid', 'vibe') . '</label></div></li>';
            echo '</ul>';
        }
        echo '<a id="submit_filters" class="button full">' . __('Filter Results', 'vibe') . '</a>';
        echo '</div>' . $after_widget;
        ?>
	<?php 
    }
/**
 * Is this the Achievements Directory page?
 *
 * @global object $bp BuddyPress global settings
 * @global bool $is_member_page If we are under anything with a members slug
 * @return bool
 * @since 2.0
 */
function dpa_is_directory_page()
{
    global $bp, $is_member_page;
    return apply_filters('dpa_is_directory_page', bp_is_current_component($bp->achievements->slug) && (bp_is_directory() || bp_is_current_component($bp->achievements->slug) && !$bp->current_action && !$bp->current_item && !$is_member_page));
}
Example #14
0
 /**
  *
  */
 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;
 }
Example #15
0
/**
 * 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));
}
Example #16
0
function kleo_bp_get_total_friend_count_member_type()
{
    $user_id = get_current_user_id();
    $count = friends_get_total_friend_count($user_id);
    $member_type = bp_get_current_member_type();
    if (bp_is_directory() && $member_type) {
        global $bp, $wpdb;
        $friends = $wpdb->get_results("SELECT count(1) as count FROM {$bp->friends->table_name} bpf\n        LEFT JOIN {$wpdb->term_relationships} tr ON (bpf.initiator_user_id = tr.object_id || bpf.friend_user_id = tr.object_id )\n        LEFT JOIN {$wpdb->terms} t ON t.term_id = tr.term_taxonomy_id\n        WHERE t.slug = '" . $member_type . "' AND (bpf.initiator_user_id = {$user_id} || bpf.friend_user_id = {$user_id} ) AND tr.object_id != {$user_id} AND bpf.is_confirmed = 1", ARRAY_A);
        $count = 0;
        if (isset($friends['0']['count']) && is_numeric($friends['0']['count'])) {
            $count = $friends['0']['count'];
        }
    }
    return $count;
}
Example #17
0
        ?>
" tabindex="100" />
							<input type="hidden" name="testcookie" value="1" />
						</form>

						<?php 
        do_action('bp_after_sidebar_login_form');
        ?>
						</div>
					<?php 
    }
    ?>

					<?php 
    /* Show forum tags on the forums directory */
    if (BP_FORUMS_SLUG == bp_current_component() && bp_is_directory()) {
        ?>
						<h3 class="widgettitle"><?php 
        _e('Forum Topic Tags', 'framemarket');
        ?>
</h3>
						<div class="widget">
						<div id="forum-directory-tags" class="widget tags">
							<?php 
        if (function_exists('bp_forums_tag_heat_map')) {
            ?>
								<div id="tag-text"><?php 
            bp_forums_tag_heat_map();
            ?>
</div>
							<?php 
Example #18
0
    if (!is_front_page() && !is_page_template('page-templates/front-page.php')) {
        $topnav_style = ot_get_option('topnav_style', 'dark');
        ?>
<div class="blog-heading <?php 
        echo $topnav_style == 'light' ? 'heading-light' : '';
        ?>
">
    <div class="container">
        <h1><?php 
        echo $post->post_title;
        ?>
</h1>
        <?php 
        if (is_plugin_active('buddypress/bp-loader.php') && bp_current_component()) {
            //buddypress
            if (bp_is_directory()) {
                //sitewide
                if (bp_is_activity_component()) {
                    //activity
                } elseif (bp_is_groups_component()) {
                    //groups
                    ?>
        <div id="group-dir-search" class="dir-search pull-right" role="search">
            <?php 
                    bp_directory_groups_search_form();
                    ?>
        </div>
        <!-- #group-dir-search -->
        <?php 
                } elseif (bp_current_component('members')) {
                    //members
/**
 * 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));
}
/**
 * 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 = '&raquo;', $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);
}
 /**
  * Sets various HTTP headers related to Content-Type and browser caching.
  *
  * Most of this class method is derived from {@link WP::send_headers()}.
  *
  * @since 1.9.0
  */
 protected function http_headers()
 {
     // Set up some additional headers if not on a directory page
     // this is done b/c BP uses pseudo-pages.
     if (!bp_is_directory()) {
         global $wp_query;
         $wp_query->is_404 = false;
         status_header(200);
     }
     // Set content-type.
     @header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
     send_nosniff_header();
     // Cache-related variables.
     $last_modified = mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
     $modified_timestamp = strtotime($last_modified);
     $etag = md5($last_modified);
     // Set cache-related headers.
     @header('Last-Modified: ' . $last_modified);
     @header('Pragma: no-cache');
     @header('ETag: ' . '"' . $etag . '"');
     // First commit of BuddyPress! (Easter egg).
     @header('Expires: Tue, 25 Mar 2008 17:13:55 GMT');
     // Get ETag from supported user agents.
     if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
         $client_etag = wp_unslash($_SERVER['HTTP_IF_NONE_MATCH']);
         // Remove quotes from ETag.
         $client_etag = trim($client_etag, '"');
         // Strip suffixes from ETag if they exist (eg. "-gzip").
         $etag_suffix_pos = strpos($client_etag, '-');
         if (!empty($etag_suffix_pos)) {
             $client_etag = substr($client_etag, 0, $etag_suffix_pos);
         }
         // No ETag found.
     } else {
         $client_etag = false;
     }
     // Get client last modified timestamp from supported user agents.
     $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
     $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
     // Set 304 status if feed hasn't been updated since last fetch.
     if ($client_last_modified && $client_etag ? $client_modified_timestamp >= $modified_timestamp && $client_etag == $etag : $client_modified_timestamp >= $modified_timestamp || $client_etag == $etag) {
         $status = 304;
     } else {
         $status = false;
     }
     // If feed hasn't changed as reported by the user agent, set 304 status header.
     if (!empty($status)) {
         status_header($status);
         // Cached response, so stop now!
         if ($status == 304) {
             exit;
         }
     }
 }
Example #22
0
function kleo_bp_change_layout($layout)
{
    global $bp;
    if (!bp_is_blog_page()) {
        $layout = sq_option('bp_layout', 'right');
        //profile page
        if (sq_option('bp_layout_profile', 'default') != 'default' && bp_is_user()) {
            $layout = sq_option('bp_layout_profile', 'right');
        } elseif (sq_option('bp_layout_members_dir', 'default') != 'default' && bp_is_current_component($bp->members->slug) && bp_is_directory()) {
            $layout = sq_option('bp_layout_members_dir', 'right');
        } elseif (sq_option('bp_layout_groups', 'default') != 'default' && bp_is_current_component($bp->groups->slug)) {
            $layout = sq_option('bp_layout_groups', 'right');
        } elseif (sq_option('bp_layout_activity', 'default') != 'default' && bp_is_current_component($bp->activity->slug)) {
            $layout = sq_option('bp_layout_activity', 'right');
        } elseif (sq_option('bp_layout_register', 'default') != 'default' && bp_is_register_page()) {
            $layout = sq_option('bp_layout_register', 'right');
        }
    }
    return $layout;
}
function bp_has_links($args = array())
{
    global $links_template, $bp;
    if (empty($args)) {
        // The following code will auto set parameters based on the page being viewed.
        // for example on example.com/members/marshall/links/my-links/popular/
        // $type = 'popular'
        //
        if (true === bp_is_directory() && 'my-links' == $bp->current_action) {
            $order = $bp->action_variables[0];
            if ('active' == $order) {
                $type = 'active';
            } elseif ('all' == $order) {
                $type = 'all';
            } elseif ('newest' == $order) {
                $type = 'newest';
            } else {
                if ('popular' == $order) {
                    $type = 'popular';
                } else {
                    if ('most-votes' == $order) {
                        $type = 'most-votes';
                    } else {
                        if ('high-votes' == $order) {
                            $type = 'high-votes';
                        }
                    }
                }
            }
        } else {
            if ($bp->links->current_link->slug) {
                $type = 'single-link';
                $args['slug'] = $bp->links->current_link->slug;
            }
        }
        $args['order'] = $order;
        $args['type'] = $type;
    }
    // default args to use IF args is not empty
    $defaults = array('type' => false, 'page' => 1, 'per_page' => 10, 'max' => false, 'avatar_size' => false, 'user_id' => false, 'slug' => false, 'search_terms' => false, 'category_id' => false, 'category_slug' => null);
    // args to pass to template class
    $template_args = wp_parse_args($args, $defaults);
    // category slug in path overrides any category id that is set
    if (false === defined('DOING_AJAX') && true === bp_is_directory() && BP_LINKS_CAT_URL_SLUG == bp_current_action()) {
        // get current item
        $category_slug = bp_action_variable(0);
        // have a category slug?
        if (false === empty($category_slug)) {
            // yes, set it
            $template_args['category_slug'] = $category_slug;
            // ...and kill any category id that is set
            $template_args['category_id'] = false;
        }
    }
    switch (true) {
        case isset($_REQUEST['link-filter-box']):
            $template_args['search_terms'] = $_REQUEST['link-filter-box'];
            break;
        case isset($_REQUEST['s']):
            $template_args['search_terms'] = $_REQUEST['s'];
            break;
    }
    $template_args = apply_filters('bp_has_links_template_args', $template_args);
    $links_template = new BP_Links_Template($template_args);
    return apply_filters('bp_has_links', $links_template->has_links(), $links_template);
}
/**
 * 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);
}
 /**
  * Filter the default theme compatibility root template hierarchy, and prepend
  * a page template to the front if it's set.
  *
  * @see https://buddypress.trac.wordpress.org/ticket/6065
  *
  * @since BuddyPress (2.2.0)
  *
  * @param  array $templates
  * @uses   apply_filters() call 'bp_legacy_theme_compat_page_templates_directory_only' and return false
  *                         to use the defined page template for component's directory and its single items
  * @return array
  */
 public function theme_compat_page_templates($templates = array())
 {
     /**
      * Filters whether or not we are looking at a directory to determine if to return early.
      *
      * @since BuddyPress (2.2.0)
      *
      * @param bool $value Whether or not we are viewing a directory.
      */
     if (true === (bool) apply_filters('bp_legacy_theme_compat_page_templates_directory_only', !bp_is_directory())) {
         return $templates;
     }
     // No page ID yet
     $page_id = 0;
     // Get the WordPress Page ID for the current view.
     foreach ((array) buddypress()->pages as $component => $bp_page) {
         // Handles the majority of components.
         if (bp_is_current_component($component)) {
             $page_id = (int) $bp_page->id;
         }
         // Stop if not on a user page.
         if (!bp_is_user() && !empty($page_id)) {
             break;
         }
         // The Members component requires an explicit check due to overlapping components.
         if (bp_is_user() && 'members' === $component) {
             $page_id = (int) $bp_page->id;
             break;
         }
     }
     // Bail if no directory page set
     if (0 === $page_id) {
         return $templates;
     }
     // Check for page template
     $page_template = get_page_template_slug($page_id);
     // Add it to the beginning of the templates array so it takes precedence
     // over the default hierarchy.
     if (!empty($page_template)) {
         /**
          * Check for existence of template before adding it to template
          * stack to avoid accidentally including an unintended file.
          *
          * @see: https://buddypress.trac.wordpress.org/ticket/6190
          */
         if ('' !== locate_template($page_template)) {
             array_unshift($templates, $page_template);
         }
     }
     return $templates;
 }
 /**
  * Constructor method.
  *
  * @param string $type The 'type' is the sort order/kind. 'newest',
  *        'popular', 'unreplied', 'tags'.
  * @param int $forum_id The ID of the forum for which topics are being
  *        queried.
  * @param int $user_id The ID of the user to whom topics should be
  *        limited. Pass false to remove this filter.
  * @param int $page The number of the page being requested.
  * @param int $per_page The number of items being requested perpage.
  * @param string $no_stickies Requested sticky format.
  * @param string $search_terms Filter results by a string.
  * @param int $offset Optional. Offset results by a given numeric value.
  * @param int $number Optional. Total number of items to retrieve.
  */
 function __construct($type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms, $offset = false, $number = false)
 {
     global $bp;
     $this->pag_page = $page;
     $this->pag_num = $per_page;
     $this->type = $type;
     $this->search_terms = $search_terms;
     $this->forum_id = $forum_id;
     $this->offset = $offset;
     $this->number = $number;
     switch ($type) {
         case 'newest':
         default:
             $this->topics = bp_forums_get_forum_topics(array('user_id' => $user_id, 'forum_id' => $forum_id, 'filter' => $search_terms, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $no_stickies, 'offset' => $offset, 'number' => $number));
             break;
         case 'popular':
             $this->topics = bp_forums_get_forum_topics(array('user_id' => $user_id, 'type' => 'popular', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $no_stickies, 'offset' => $offset, 'number' => $number));
             break;
         case 'unreplied':
             $this->topics = bp_forums_get_forum_topics(array('user_id' => $user_id, 'type' => 'unreplied', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $no_stickies, 'offset' => $offset, 'number' => $number));
             break;
         case 'tags':
             $this->topics = bp_forums_get_forum_topics(array('user_id' => $user_id, 'type' => 'tags', 'filter' => $search_terms, 'forum_id' => $forum_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'show_stickies' => $no_stickies, 'offset' => $offset, 'number' => $number));
             break;
     }
     $this->topics = apply_filters('bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies);
     if (!(int) $this->topics) {
         $this->topic_count = 0;
         $this->total_topic_count = 0;
     } else {
         // Get a total topic count, for use in pagination. This value will differ
         // depending on scope
         if (!empty($forum_id)) {
             // Group forums
             $topic_count = bp_forums_get_forum($forum_id);
             $topic_count = (int) $topic_count->topics;
         } else {
             if (!empty($bp->groups->current_group)) {
                 $topic_count = (int) groups_total_public_forum_topic_count($type);
             } else {
                 if (bp_is_user_forums_started() || bp_is_directory() && $user_id) {
                     // This covers the case of Profile > Forums > Topics Started, as
                     // well as Forum Directory > My Topics
                     $topic_count = bp_forums_total_topic_count_for_user(bp_displayed_user_id(), $type);
                 } else {
                     if (bp_is_user_forums_replied_to()) {
                         // Profile > Forums > Replied To
                         $topic_count = bp_forums_total_replied_count_for_user(bp_displayed_user_id(), $type);
                     } else {
                         if ('tags' == $type) {
                             $tag = bb_get_tag($search_terms);
                             $topic_count = $tag->count;
                         } else {
                             // For forum directories (All Topics), get a true count
                             $status = bp_current_user_can('bp_moderate') ? 'all' : 'public';
                             // todo: member-of
                             $topic_count = (int) groups_total_forum_topic_count($status, $search_terms);
                         }
                     }
                 }
             }
         }
         if (!$max || $max >= $topic_count) {
             $this->total_topic_count = $topic_count;
         } else {
             $this->total_topic_count = (int) $max;
         }
         if ($max) {
             if ($max >= count($this->topics)) {
                 $this->topic_count = count($this->topics);
             } else {
                 $this->topic_count = (int) $max;
             }
         } else {
             $this->topic_count = count($this->topics);
         }
     }
     $this->topic_count = apply_filters_ref_array('bp_forums_template_topic_count', array($this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies));
     $this->total_topic_count = apply_filters_ref_array('bp_forums_template_total_topic_count', array($this->total_topic_count, $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies));
     // Fetch extra information for topics, so we don't have to query inside the loop
     $this->topics = bp_forums_get_topic_extras($this->topics);
     if ((int) $this->total_topic_count && (int) $this->pag_num) {
         $this->pag_links = paginate_links(array('base' => add_query_arg(array('p' => '%#%', 'n' => $this->pag_num)), 'format' => '', 'total' => ceil((int) $this->total_topic_count / (int) $this->pag_num), 'current' => $this->pag_page, 'prev_text' => _x('&larr;', 'Forum topic pagination previous text', 'buddypress'), 'next_text' => _x('&rarr;', 'Forum topic pagination next text', 'buddypress'), 'mid_size' => 1));
     }
 }
        bp_message_get_notices();
        /* Site wide notices to all users */
        ?>
			<?php 
    }
    ?>
		</div>
		<?php 
    do_action('bp_after_sidebar_me');
    ?>
	<?php 
}
?>
	<?php 
/* Show forum tags on the forums directory */
if (bp_is_active('forums') && bp_is_forums_component() && bp_is_directory()) {
    ?>
		<aside id="forum-directory-tags" class="widget tags">
			<h3 class="widgettitle"><?php 
    _e('Forum Topic Tags', 'status');
    ?>
</h3>
			<div id="tag-text"><?php 
    bp_forums_tag_heat_map();
    ?>
</div>
		</aside>
	<?php 
}
?>
Example #28
0
 function cb_breadcrumbs($cb_padding = 'padding-on')
 {
     $cb_breadcrumb = NULL;
     $cb_post_type = get_post_type();
     if ($cb_padding == 'padding-off') {
         $cb_padding_type = ' cb-padding-off';
     } else {
         $cb_padding_type = NULL;
     }
     if (is_page() == false) {
         $cb_breadcrumb = '<div class="cb-breadcrumbs wrap' . $cb_padding_type . '">';
         $cb_icon = '<i class="icon-angle-right"></i>';
         $cb_breadcrumb .= '<a href="' . home_url() . '">' . __("Home", "cubell") . '</a>' . $cb_icon;
         if (is_category()) {
             $cb_cat_id = get_query_var('cat');
             $cb_current_category = get_category($cb_cat_id);
             if ($cb_current_category->category_parent == '0') {
                 $cb_breadcrumb .= '<a href="' . get_category_link($cb_current_category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), $cb_current_category->name)) . '">' . $cb_current_category->name . '</a>';
             } else {
                 $cb_breadcrumb .= '<a href="' . get_category_link($cb_current_category->category_parent) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), get_the_category_by_ID($cb_current_category->category_parent))) . '">' . get_the_category_by_ID($cb_current_category->category_parent) . '</a>' . $cb_icon;
                 $cb_breadcrumb .= '<a href="' . get_category_link($cb_current_category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), $cb_current_category->name)) . '">' . $cb_current_category->name . '</a>';
             }
         } elseif (function_exists('buddypress') && is_buddypress() == true) {
             global $bp;
             $cb_bp_output = NULL;
             $cb_bp_current_component = bp_current_component();
             $cb_bp_current_action = bp_current_action();
             if ($cb_bp_current_action != 'my-groups' && $cb_bp_current_component == 'groups') {
                 $cb_bp_group = $bp->groups->current_group;
                 if (!is_numeric($cb_bp_group)) {
                     $cb_bp_group_id = $cb_bp_group->id;
                     $cb_bp_group_name = $cb_bp_group->name;
                     $cb_bp_group_link = bp_get_group_permalink($cb_bp_group);
                     $cb_bp_output = '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()) . '">' . __('Groups', 'cubell') . '</a>' . $cb_icon . $cb_bp_group_name;
                 } else {
                     $cb_bp_output = __('Groups', 'cubell');
                 }
                 $cb_breadcrumb .= $cb_bp_output;
             }
             if ($cb_bp_current_component == 'activity' || $cb_bp_current_action == 'my-groups' || $cb_bp_current_action == 'public' || $cb_bp_current_component == 'settings' || $cb_bp_current_component == 'forums' || $cb_bp_current_component == 'friends') {
                 $cb_activity_title = get_the_title();
                 $cb_bp_activity = $bp->activity->current_id;
                 $cb_bp_activity_link = bp_get_members_directory_permalink();
                 $cb_bp_output .= '<a href="' . $cb_bp_activity_link . '">' . __('Members', 'cubell') . '</a>' . $cb_icon . $cb_activity_title;
                 if ($cb_bp_activity != NULL) {
                     $cb_bp_output .= __('Members', 'cubell');
                 }
                 $cb_breadcrumb .= $cb_bp_output;
             }
             if ($cb_bp_current_component == 'messages') {
                 $cb_breadcrumb .= __('Messages', 'cubell');
             }
             if (bp_is_directory() == true) {
                 $cb_breadcrumb = '<div>';
             }
         } elseif ($cb_post_type == 'post') {
             $cb_categories = get_the_category();
             if ($cb_categories[0]->category_parent == '0') {
                 $cb_breadcrumb .= '<a href="' . get_category_link($cb_categories[0]->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), $cb_categories[0]->name)) . '">' . $cb_categories[0]->name . '</a>';
             } else {
                 $cb_breadcrumb .= '<a href="' . get_category_link($cb_categories[0]->category_parent) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), get_the_category_by_ID($cb_categories[0]->category_parent))) . '">' . get_the_category_by_ID($cb_categories[0]->category_parent) . '</a>' . $cb_icon;
                 $cb_breadcrumb .= '<a href="' . get_category_link($cb_categories[0]->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "cubell"), $cb_categories[0]->name)) . '">' . $cb_categories[0]->name . '</a>';
             }
         }
         $cb_breadcrumb .= '</div>';
     }
     return $cb_breadcrumb;
 }
Example #29
0
/**
 *  buddypress default forum topic tags widget to show forum tags on the forums directory
 *
 * @package Custom Community
 * @since 1.8.3
 */
function forum_tags_widget()
{
    /* Show forum tags on the forums directory */
    if (BP_FORUMS_SLUG == bp_current_component() && bp_is_directory()) {
        ?>
		<div id="forum-directory-tags" class="widget tags">

			<h3 class="widgettitle"><?php 
        _e('Forum Topic Tags', 'cc');
        ?>
</h3>
			<?php 
        if (function_exists('bp_forums_tag_heat_map')) {
            ?>
				<div id="tag-text"><?php 
            bp_forums_tag_heat_map();
            ?>
</div>
			<?php 
        }
        ?>
		</div>
<?php 
    }
}
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);
}