コード例 #1
0
/**
 * Forces the BP Profile Pages to be 1 Column
 * 
 * @package lsx
 * @subpackage jetpack
 * @category infinite scroll
 */
function lsx_buddypress_page_columns($layout)
{
    if (bp_is_profile_component() || bp_is_settings_component() || bp_is_activity_component() || bp_is_group() || bp_is_messages_component() || bp_is_members_directory() || bp_is_groups_directory() || bp_is_groups_component() || bp_is_members_component()) {
        $layout = '1c';
    }
    return $layout;
}
コード例 #2
0
ファイル: bp-members-screens.php プロジェクト: eresyyl/mk
/**
 * Handle the display of the members directory index.
 */
function bp_members_screen_index()
{
    if (bp_is_members_directory()) {
        bp_update_is_directory(true, 'members');
        do_action('bp_members_screen_index');
        bp_core_load_template(apply_filters('bp_members_screen_index', 'members/index'));
    }
}
コード例 #3
0
ファイル: plugin.php プロジェクト: abegit/harmony
function ajax_test_enqueue_scripts()
{
    if (bp_is_members_directory() || bp_is_user_profile()) {
        wp_enqueue_style('love', plugins_url('/style.css', __FILE__));
    }
    wp_enqueue_script('love', plugins_url('/love-basic-ajax.js', __FILE__), '1.0', true);
    wp_localize_script('love', 'postlove', array('ajax_url' => admin_url('admin-ajax.php')));
    wp_enqueue_script('parse', '//www.parsecdn.com/js/parse-1.6.0.min.js', '1.0', true);
    wp_enqueue_script('veri', plugins_url('/veri.js', __FILE__), '1.0', true);
}
コード例 #4
0
/**
 * Enqueue the js.
 *
 * @since 1.0.0
 */
function bp_mute_js()
{
    if (!bp_mute_buddypress_exists()) {
        return;
    }
    if (!bp_is_active('activity')) {
        return;
    }
    if (!is_user_logged_in()) {
        return;
    }
    if (bp_is_user() || bp_is_members_directory() || bp_is_group_members()) {
        wp_enqueue_script('bp-mute-js', plugins_url('js/script.min.js', __FILE__), array('jquery'), NULL, true);
        wp_localize_script('bp-mute-js', 'mute', array('ajax_url' => admin_url('admin-ajax.php'), 'start' => wp_create_nonce('mute-nonce'), 'stop' => wp_create_nonce('unmute-nonce')));
    }
}
コード例 #5
0
ファイル: functions.php プロジェクト: samoakley/labtheme
/**
 * Redirect to user's Profile
 *
 * @return void
 */
function newwriting_child_redirect()
{
    // bail if not logged in
    if (!is_user_logged_in()) {
        return;
    }
    // bail if not BP root site
    if (!bp_is_root_blog()) {
        return;
    }
    // bail if POST
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        return;
    }
    // if restricted pages requested
    if (bp_is_activity_directory() or bp_is_members_directory()) {
        // get profile URL
        $home = bp_core_get_user_domain(bp_loggedin_user_id()) . 'groups/';
        // redirect to member's profile
        wp_redirect($home);
        exit;
    }
    // groups directory
    if (bp_is_groups_directory()) {
        // bail if admin
        if (!is_super_admin()) {
            // get profile URL
            $home = bp_core_get_user_domain(bp_loggedin_user_id()) . 'groups/';
            // redirect to member's profile
            wp_redirect($home);
            exit;
        }
    }
    // groups directory
    if (is_front_page()) {
        // bail if admin
        if (!is_super_admin()) {
            // get profile URL
            $home = bp_core_get_user_domain(bp_loggedin_user_id()) . 'groups/';
            // redirect to member's profile
            wp_redirect($home);
            exit;
        }
    }
}
コード例 #6
0
/**
 * Handle the display of the members directory index.
 */
function bp_members_screen_index()
{
    if (bp_is_members_directory()) {
        bp_update_is_directory(true, 'members');
        /**
         * Fires right before the loading of the Member directory index screen template file.
         *
         * @since BuddyPress (1.5.0)
         */
        do_action('bp_members_screen_index');
        /**
         * Filters the template to load for the Member directory page screen.
         *
         * @since BuddyPress (1.5.0)
         *
         * @param string $value Path to the member directory template to load.
         */
        bp_core_load_template(apply_filters('bp_members_screen_index', 'members/index'));
    }
}
コード例 #7
0
ファイル: hooks-functions.php プロジェクト: jun200/wordpress
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 = ' » ';
    // 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>';
    }
}
コード例 #8
0
 function x_buddypress_is_component_with_landmark_header()
 {
     if (bp_is_activity_directory() || bp_is_groups_directory() || bp_is_members_directory() || bp_is_blogs_directory() || bp_is_current_component('register') || bp_is_current_component('activate')) {
         return true;
     } else {
         return false;
     }
 }
コード例 #9
0
function x_is_buddypress_members_directory()
{
    if (function_exists('bp_is_members_directory') && bp_is_members_directory()) {
        return true;
    } else {
        return false;
    }
}
コード例 #10
0
function kleo_bp_get_page_id()
{
    $current_page_id = NULL;
    $page_array = get_option('bp-pages');
    if (bp_is_register_page()) {
        /* register page */
        $current_page_id = $page_array['register'];
    } elseif (bp_is_members_directory()) {
        /* members directory */
        $current_page_id = $page_array['members'];
    } elseif (bp_is_activity_directory()) {
        /* activity directory */
        $current_page_id = $page_array['activity'];
    } elseif (bp_is_groups_directory()) {
        /* groups directory */
        $current_page_id = $page_array['groups'];
    } elseif (bp_is_activation_page()) {
        /* activation page */
        $current_page_id = $page_array['activate'];
    }
    return $current_page_id;
}