コード例 #1
1
function bphelp_pbpp_redirect()
{
    global $bp;
    //IMPORTANT: Do not alter the following line.
    $bphelp_my_redirect_slug = get_option('bphelp-my-redirect-slug', 'register');
    if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bbp_is_single_forum() || bbp_is_single_topic() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_members_component() || bp_is_profile_component()) {
        if (!is_user_logged_in()) {
            bp_core_redirect(get_option('home') . '/' . $bphelp_my_redirect_slug);
        }
    }
}
 /**
  * Are we looking at something that needs group theme compatibility?
  *
  * @since 1.7.0
  */
 public function is_group()
 {
     // Bail if not looking at a group.
     if (!bp_is_groups_component()) {
         return;
     }
     // Group Directory.
     if (!bp_current_action() && !bp_current_item()) {
         bp_update_is_directory(true, 'groups');
         /**
          * Fires at the start of the group theme compatibility setup.
          *
          * @since 1.1.0
          */
         do_action('groups_directory_groups_setup');
         add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'directory_content'));
         // Creating a group.
     } elseif (bp_is_groups_component() && bp_is_current_action('create')) {
         add_filter('bp_get_buddypress_template', array($this, 'create_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'create_content'));
         // Group page.
     } elseif (bp_is_single_item()) {
         add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'single_content'));
     }
 }
コード例 #3
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;
}
コード例 #4
0
function bp_groupblog_blog_defaults($blog_id)
{
    global $bp, $wp_rewrite;
    // only apply defaults to groupblog blogs
    if (bp_is_groups_component()) {
        switch_to_blog($blog_id);
        // get the site options
        $options = get_site_option('bp_groupblog_blog_defaults_options');
        foreach ((array) $options as $key => $value) {
            update_option($key, $value);
        }
        // override default themes
        if (!empty($options['theme'])) {
            // we want something other than the default theme
            $values = explode("|", $options['theme']);
            switch_theme($values[0], $values[1]);
        }
        // groupblog bonus options
        if (strlen($options['default_cat_name']) > 0) {
            global $wpdb;
            $cat = $options['default_cat_name'];
            $slug = str_replace(' ', '-', strtolower($cat));
            $results = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->terms} SET name = %s, slug = %s  WHERE term_id = 1", $cat, $slug));
        }
        if (strlen($options['default_link_cat']) > 0) {
            global $wpdb;
            $cat = $options['default_link_cat'];
            $slug = str_replace(' ', '-', strtolower($cat));
            $results = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->terms} SET name = %s, slug = %s  WHERE term_id = 2", $cat, $slug));
        }
        if (isset($options['delete_first_post']) && $options['delete_first_post'] == 1) {
            global $wpdb;
            $statement = "UPDATE {$wpdb->posts} SET post_status = 'draft'  WHERE id = 1";
            $results = $wpdb->query($statement);
        }
        if (isset($options['delete_first_comment']) && $options['delete_first_comment'] == 1) {
            wp_delete_comment(1);
        }
        if ($options['delete_blogroll_links'] == 1) {
            wp_delete_link(1);
            //delete Wordpress.com blogroll link
            wp_delete_link(2);
            //delete Wordpress.org blogroll link
        }
        if ($options['redirectblog'] == 2) {
            $blog_page = array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_status' => 'publish', 'post_name' => $options['pageslug'], 'post_title' => $options['pagetitle'], 'post_type' => 'page', 'post_content' => __('<p><strong>This page has been created automatically by the BuddyPress GroupBlog plugin.</strong></p><p>Please contact the site admin if you see this message instead of your blog posts. Possible solution: please advise your site admin to create the <a href="http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates">page template</a> needed for the BuddyPress GroupBlog plugin.<p>', 'groupblog'));
            $blog_page_id = wp_insert_post($blog_page);
            if ($blog_page_id) {
                add_post_meta($blog_page_id, '_wp_page_template', 'blog.php');
            }
            add_post_meta($blog_page_id, 'created_by_groupblog_dont_change', '1');
            // Set the Blog Reading Settings to load the template page as front page
            if ($options['deep_group_integration'] == 1) {
                update_option('show_on_front', 'page');
                update_option('page_on_front', $blog_page_id);
            }
        }
        restore_current_blog();
    }
}
コード例 #5
0
 public function ass_add_javascript()
 {
     if (bp_is_groups_component()) {
         wp_register_script('bp-activity-subscription-js', plugins_url() . '/buddypress-group-email-subscription/bp-activity-subscription-js.js', array('jquery'));
         wp_enqueue_script('bp-activity-subscription-js');
         wp_localize_script('bp-activity-subscription-js', 'bp_ass', array('mute' => __('Mute', 'bp-ass'), 'follow' => __('Follow', 'bp-ass'), 'error' => __('Error', 'bp-ass')));
     }
 }
コード例 #6
0
function bp_checkins_is_group_places_area()
{
    if (bp_is_groups_component() && bp_is_single_item() && bp_is_current_action('checkins') && bp_action_variable(0) == 'places') {
        return true;
    } else {
        return false;
    }
}
コード例 #7
0
 public function ass_add_javascript()
 {
     if (bp_is_groups_component()) {
         $revision_date = '20130729';
         wp_register_script('bp-activity-subscription-js', plugins_url('bp-activity-subscription-js.js', __FILE__), array('jquery'), $revision_date);
         wp_enqueue_script('bp-activity-subscription-js');
         wp_localize_script('bp-activity-subscription-js', 'bp_ass', array('mute' => __('Mute', 'bp-ass'), 'follow' => __('Follow', 'bp-ass'), 'error' => __('Error', 'bp-ass')));
     }
 }
コード例 #8
0
/**
 * bp_groupblog_add_screen_css()
 */
function bp_groupblog_add_screen_css()
{
    if (bp_is_groups_component()) {
        if (file_exists(get_stylesheet_directory() . '/groupblog/css/style.css')) {
            wp_enqueue_style('bp-groupblog-screen', get_stylesheet_directory_uri() . '/groupblog/css/style.css');
        } else {
            wp_enqueue_style('bp-groupblog-screen', plugins_url() . '/bp-groupblog/groupblog/css/style.css');
        }
    }
}
コード例 #9
0
function bp_checkins_is_group_checkins_area()
{
    if (!(int) bp_get_option('bp-checkins-activate-component') || '' == bp_get_option('bp-checkins-activate-component')) {
        return false;
    }
    if (bp_is_groups_component() && bp_is_single_item() && bp_is_current_action('checkins')) {
        return true;
    } else {
        return false;
    }
}
コード例 #10
0
/**
 * Catch requests for the groups component and find the requested group
 */
function group_hierarchy_override_current_action($current_action)
{
    global $bp;
    do_action('bp_group_hierarchy_route_requests');
    /** Only process once - hopefully this won't have any side effects */
    remove_action('bp_current_action', 'group_hierarchy_override_current_action');
    /** Abort processing on dashboard pages and when not in groups component */
    if (is_admin() && !strpos(admin_url('admin-ajax.php'), $_SERVER['REQUEST_URI'])) {
        return $current_action;
    }
    if (!bp_is_groups_component()) {
        return $current_action;
    }
    $groups_slug = bp_get_groups_root_slug();
    bp_group_hierarchy_debug('Routing request');
    bp_group_hierarchy_debug('Current component: ' . $bp->current_component);
    bp_group_hierarchy_debug('Current action: ' . $current_action);
    bp_group_hierarchy_debug('Groups slug: ' . $groups_slug);
    bp_group_hierarchy_debug('Are we on a user profile page?: ' . (empty($bp->displayed_user->id) ? 'N' : 'Y'));
    if ($current_action == '') {
        return $current_action;
    }
    if (!empty($bp->displayed_user->id) || in_array($current_action, apply_filters('groups_forbidden_names', array('my-groups', 'create', 'invites', 'send-invites', 'forum', 'delete', 'add', 'admin', 'request-membership', 'members', 'settings', 'avatar', $groups_slug, '')))) {
        bp_group_hierarchy_debug('Not rewriting current action.');
        return $current_action;
    }
    $action_vars = $bp->action_variables;
    $group = new BP_Groups_Hierarchy($current_action);
    if (!$group->id && (!isset($bp->current_item) || !$bp->current_item)) {
        $current_action = '';
        bp_group_hierarchy_debug('Group not found - returning 404.');
        bp_do_404();
        return;
    }
    if ($group->has_children()) {
        $parent_id = $group->id;
        foreach ($bp->action_variables as $action_var) {
            $subgroup_id = BP_Groups_Hierarchy::check_slug($action_var, $parent_id);
            if ($subgroup_id) {
                $action_var = array_shift($action_vars);
                $current_action .= '/' . $action_var;
                $parent_id = $subgroup_id;
            } else {
                // once we find something that isn't a group, we're done
                break;
            }
        }
    }
    bp_group_hierarchy_debug('Action changed to: ' . $current_action);
    $bp->action_variables = $action_vars;
    $bp->current_action = $current_action;
    return $current_action;
}
コード例 #11
0
ファイル: RTMediaPrivacy.php プロジェクト: rtCamp/rtMedia
 /**
  * Hooked to `bp_activity_entry_meta`
  *
  * Show privacy dropdown inside activity loop along with activity meta buttons.
  */
 function update_activity_privacy_option()
 {
     if (function_exists('bp_activity_user_can_delete') && bp_activity_user_can_delete() && !bp_is_groups_component() && is_rtmedia_privacy_user_overide() && apply_filters('rtm_load_bp_activity_privacy_update_ui', true)) {
         global $activities_template;
         $selected = 0;
         if (isset($activities_template->activity->privacy)) {
             $selected = intval($activities_template->activity->privacy);
         }
         //todo strict standard error
         self::select_privacy_ui(true, 'rtm-ac-privacy-' . $activities_template->activity->id, array('rtm-activity-privacy-opt'), $selected);
     }
 }
コード例 #12
0
function thatcamp_new_group_rss_catcher()
{
    global $wp_query;
    $feed_template = false;
    if (bp_is_groups_component() && bp_is_current_action('feed')) {
        $feed_template = 'rss-newest-groups.php';
    }
    if (!$feed_template) {
        return;
    }
    $wp_query->is_404 = false;
    status_header(200);
    include __DIR__ . '/includes/' . $feed_template;
    die;
}
コード例 #13
0
function logged_out_redirect()
{
    global $bp;
    // BuddyPress components to lock
    if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_page(BP_MEMBERS_SLUG) || bp_is_profile_component()) {
        // Check if user is logged out
        if (!is_user_logged_in()) {
            // Check if a page was selected for redirection
            if (of_get_option('redirect')) {
                $redirect_page = get_permalink(of_get_option('redirect'));
                // If not redirect to login page
            } else {
                $redirect_page = site_url('/wp-login.php');
            }
            wp_redirect($redirect_page);
            exit;
        }
    }
}
コード例 #14
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 = ' &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>';
    }
}
コード例 #15
0
function bp_is_group_admin_screen($slug)
{
    if (!bp_is_groups_component() || !bp_is_current_action('admin')) {
        return false;
    }
    if (bp_is_action_variable($slug)) {
        return true;
    }
    return false;
}
コード例 #16
0
    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        if (bp_checkins_is_group_places_area() || bp_checkins_is_user_area() && bp_is_current_action('places-area') || bp_checkins_if_single_place()) {
            return false;
        }
        if (!$instance['max_places']) {
            $instance['max_places'] = 5;
        }
        if (!$instance['places_type']) {
            $instance['places_type'] = -1;
        }
        if ($instance['dynamic'] === false) {
            $instance['dynamic'] = 1;
        }
        echo $before_widget;
        echo $before_title . $instance['title'] . $after_title;
        ?>
		
		<?php 
        $widget_args = array('per_page' => $instance['max_places'], 'type' => $instance['places_type']);
        if ((int) $instance['dynamic'] == 1 && bp_displayed_user_id()) {
            $widget_args['user_id'] = bp_displayed_user_id();
        }
        if ((int) $instance['dynamic'] == 1 && bp_is_groups_component() && bp_is_single_item() && $bp->groups->current_group->status == 'public') {
            $widget_args['group_id'] = $bp->groups->current_group->id;
        }
        ?>
		
		<?php 
        if (!empty($widget_args['group_id']) || !empty($widget_args['user_id'])) {
            ?>
			
			<div class="item-options">
				
				<?php 
            if (bp_displayed_user_id()) {
                printf(__('%s&#039;s places', 'bp-checkins'), bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'object' => 'user', 'type' => 'thumb', 'width' => 20, 'height' => 20)) . bp_core_get_userlink(bp_displayed_user_id()));
            }
            if (bp_is_groups_component() && bp_is_single_item()) {
                printf(__('%s&#039;s places', 'bp-checkins'), bp_core_fetch_avatar(array('item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => 'thumb', 'width' => 20, 'height' => 20)) . '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_attr($bp->groups->current_group->name) . '</a>');
            }
            ?>
	
				
			</div>
		
		<?php 
        }
        ?>

		<?php 
        if (bp_checkins_has_places($widget_args)) {
            ?>
			
			<ul id="widget-places-list" class="item-list">
				<?php 
            while (bp_checkins_has_places()) {
                bp_checkins_the_place();
                ?>

					<li>
						<div class="item-avatar">
							<?php 
                bp_checkins_places_avatar();
                ?>
						</div>
						<div class="item-title">
							<a href="<?php 
                bp_checkins_places_the_permalink();
                ?>
" title="<?php 
                bp_checkins_places_title();
                ?>
"><?php 
                bp_checkins_places_title();
                ?>
</a>
						</div>
						<?php 
                if (bp_checkins_places_is_live()) {
                    ?>
							<div class="item-meta">
								<span class="activity"><?php 
                    bp_checkins_places_live_status();
                    ?>
</span>
							</div>
						<?php 
                }
                ?>
						<div class="clear"></div>
					</li>

				<?php 
            }
            ?>

		<?php 
        } else {
            ?>

			<div class="widget-error">
				<p><?php 
            _e('Sorry, there was no places found.', 'bp-checkins');
            ?>
</p>
			</div>

		<?php 
        }
        ?>


		<?php 
        echo $after_widget;
        ?>
	<?php 
    }
コード例 #17
0
function rtmedia_modify_activity_upload_url($params)
{
    // return original params if BuddyPress multilingual plugin is not active
    include_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (function_exists('is_plugin_active') && is_plugin_active('buddypress-multilingual/sitepress-bp.php')) {
        if (class_exists('BuddyPress')) {
            // change upload url only if it's activity page and if it's group page than it shouldn't group media page
            if (bp_is_activity_component() || bp_is_groups_component() && !is_rtmedia_page()) {
                if (function_exists('bp_get_activity_directory_permalink')) {
                    $params['url'] = bp_get_activity_directory_permalink() . 'upload/';
                }
            }
        }
    }
    return $params;
}
コード例 #18
0
/**
 * Customize the body class, according to the currently displayed BP content.
 *
 * Uses the above is_() functions to output a body class for each scenario.
 *
 * @since 1.1.0
 *
 * @param array      $wp_classes     The body classes coming from WP.
 * @param array|bool $custom_classes Classes that were passed to get_body_class().
 * @return array $classes The BP-adjusted body classes.
 */
function bp_get_the_body_class($wp_classes = array(), $custom_classes = false)
{
    $bp_classes = array();
    /* Pages *************************************************************/
    if (is_front_page()) {
        $bp_classes[] = 'home-page';
    }
    if (bp_is_directory()) {
        $bp_classes[] = 'directory';
    }
    if (bp_is_single_item()) {
        $bp_classes[] = 'single-item';
    }
    /* Components ********************************************************/
    if (!bp_is_blog_page()) {
        if (bp_is_user_profile()) {
            $bp_classes[] = 'xprofile';
        }
        if (bp_is_activity_component()) {
            $bp_classes[] = 'activity';
        }
        if (bp_is_blogs_component()) {
            $bp_classes[] = 'blogs';
        }
        if (bp_is_messages_component()) {
            $bp_classes[] = 'messages';
        }
        if (bp_is_friends_component()) {
            $bp_classes[] = 'friends';
        }
        if (bp_is_groups_component()) {
            $bp_classes[] = 'groups';
        }
        if (bp_is_settings_component()) {
            $bp_classes[] = 'settings';
        }
    }
    /* User **************************************************************/
    if (bp_is_user()) {
        $bp_classes[] = 'bp-user';
        // Add current user member types.
        if ($member_types = bp_get_member_type(bp_displayed_user_id(), false)) {
            foreach ($member_types as $member_type) {
                $bp_classes[] = sprintf('member-type-%s', esc_attr($member_type));
            }
        }
    }
    if (!bp_is_directory()) {
        if (bp_is_user_blogs()) {
            $bp_classes[] = 'my-blogs';
        }
        if (bp_is_user_groups()) {
            $bp_classes[] = 'my-groups';
        }
        if (bp_is_user_activity()) {
            $bp_classes[] = 'my-activity';
        }
    } else {
        if (bp_get_current_member_type()) {
            $bp_classes[] = 'type';
        }
    }
    if (bp_is_my_profile()) {
        $bp_classes[] = 'my-account';
    }
    if (bp_is_user_profile()) {
        $bp_classes[] = 'my-profile';
    }
    if (bp_is_user_friends()) {
        $bp_classes[] = 'my-friends';
    }
    if (bp_is_user_messages()) {
        $bp_classes[] = 'my-messages';
    }
    if (bp_is_user_recent_commments()) {
        $bp_classes[] = 'recent-comments';
    }
    if (bp_is_user_recent_posts()) {
        $bp_classes[] = 'recent-posts';
    }
    if (bp_is_user_change_avatar()) {
        $bp_classes[] = 'change-avatar';
    }
    if (bp_is_user_profile_edit()) {
        $bp_classes[] = 'profile-edit';
    }
    if (bp_is_user_friends_activity()) {
        $bp_classes[] = 'friends-activity';
    }
    if (bp_is_user_groups_activity()) {
        $bp_classes[] = 'groups-activity';
    }
    /* Messages **********************************************************/
    if (bp_is_messages_inbox()) {
        $bp_classes[] = 'inbox';
    }
    if (bp_is_messages_sentbox()) {
        $bp_classes[] = 'sentbox';
    }
    if (bp_is_messages_compose_screen()) {
        $bp_classes[] = 'compose';
    }
    if (bp_is_notices()) {
        $bp_classes[] = 'notices';
    }
    if (bp_is_user_friend_requests()) {
        $bp_classes[] = 'friend-requests';
    }
    if (bp_is_create_blog()) {
        $bp_classes[] = 'create-blog';
    }
    /* Groups ************************************************************/
    if (bp_is_group()) {
        $bp_classes[] = 'group-' . groups_get_current_group()->slug;
        // Add current group types.
        if ($group_types = bp_groups_get_group_type(bp_get_current_group_id(), false)) {
            foreach ($group_types as $group_type) {
                $bp_classes[] = sprintf('group-type-%s', esc_attr($group_type));
            }
        }
    }
    if (bp_is_group_leave()) {
        $bp_classes[] = 'leave-group';
    }
    if (bp_is_group_invites()) {
        $bp_classes[] = 'group-invites';
    }
    if (bp_is_group_members()) {
        $bp_classes[] = 'group-members';
    }
    if (bp_is_group_forum_topic()) {
        $bp_classes[] = 'group-forum-topic';
    }
    if (bp_is_group_forum_topic_edit()) {
        $bp_classes[] = 'group-forum-topic-edit';
    }
    if (bp_is_group_forum()) {
        $bp_classes[] = 'group-forum';
    }
    if (bp_is_group_admin_page()) {
        $bp_classes[] = 'group-admin';
        $bp_classes[] = bp_get_group_current_admin_tab();
    }
    if (bp_is_group_create()) {
        $bp_classes[] = 'group-create';
        $bp_classes[] = bp_get_groups_current_create_step();
    }
    if (bp_is_group_home()) {
        $bp_classes[] = 'group-home';
    }
    if (bp_is_single_activity()) {
        $bp_classes[] = 'activity-permalink';
    }
    /* Registration ******************************************************/
    if (bp_is_register_page()) {
        $bp_classes[] = 'registration';
    }
    if (bp_is_activation_page()) {
        $bp_classes[] = 'activation';
    }
    /* Current Component & Action ****************************************/
    if (!bp_is_blog_page()) {
        $bp_classes[] = bp_current_component();
        $bp_classes[] = bp_current_action();
    }
    /* Clean up ***********************************************************/
    // Add BuddyPress class if we are within a BuddyPress page.
    if (!bp_is_blog_page()) {
        $bp_classes[] = 'buddypress';
    }
    // Merge WP classes with BuddyPress classes and remove any duplicates.
    $classes = array_unique(array_merge((array) $bp_classes, (array) $wp_classes));
    /**
     * Filters the BuddyPress classes to be added to body_class()
     *
     * @since 1.1.0
     *
     * @param array $classes        Array of body classes to add.
     * @param array $bp_classes     Array of BuddyPress-based classes.
     * @param array $wp_classes     Array of WordPress-based classes.
     * @param array $custom_classes Array of classes that were passed to get_body_class().
     */
    return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes);
}
コード例 #19
0
 /**
  * Set up the title for pages and <title>.
  */
 public function setup_title()
 {
     if (bp_is_groups_component()) {
         $bp = buddypress();
         if (bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_title = _x('Memberships', 'My Groups page <title>', 'buddypress');
         } elseif (!bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), bp_get_displayed_user_fullname())));
             $bp->bp_options_title = bp_get_displayed_user_fullname();
             // We are viewing a single group, so set up the
             // group navigation menu using the $this->current_group global.
         } elseif (bp_is_single_item()) {
             $bp->bp_options_title = $this->current_group->name;
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => $this->current_group->id, 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => __('Group Profile Photo', 'buddypress')));
             if (empty($bp->bp_options_avatar)) {
                 $bp->bp_options_avatar = '<img src="' . esc_url(bp_core_avatar_default_thumb()) . '" alt="' . esc_attr__('No Group Profile Photo', 'buddypress') . '" class="avatar" />';
             }
         }
     }
     parent::setup_title();
 }
コード例 #20
0
ファイル: page.php プロジェクト: venamax/trixandtrax-cl
        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
                    ?>
        <div id="members-dir-search" class="dir-search pull-right" role="search">
            <?php 
                    bp_directory_members_search_form();
コード例 #21
0
ファイル: header.php プロジェクト: JeffreyBue/jb
    echo bp_get_members_root_slug();
    ?>
/" title="<?php 
    _e('Members', 'framemarket');
    ?>
"><?php 
    _e('Members', 'framemarket');
    ?>
</a>
									</li>

									<?php 
    if (bp_is_active('groups')) {
        ?>
										<li<?php 
        if ((bp_is_groups_component() || bp_is_group()) && !bp_is_user_groups()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
											<a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo bp_groups_root_slug();
        ?>
/" title="<?php 
        _e('Groups', 'framemarket');
        ?>
"><?php 
コード例 #22
0
ファイル: buddypress.php プロジェクト: quyip8818/wps
        <div id="item-header" role="complementary">

            <?php 
    bp_get_template_part('members/single/member-header');
    ?>

        </div>
        <!-- #item-header -->
    </section>

<?php 
}
?>

<?php 
if (sq_option('bp_full_group', 0) == 1 && bp_is_single_item() && bp_is_groups_component()) {
    ?>

    <?php 
    if (bp_has_groups()) {
        while (bp_groups()) {
            bp_the_group();
            ?>

    <section class="alternate-color bp-full-width-profile">
        <div id="item-header" role="complementary">

            <?php 
            bp_get_template_part('groups/single/group-header');
            ?>
コード例 #23
0
/**
 * Returns the current group admin tab slug
 *
 * @since BuddyPress (1.6)
 *
 * @uses apply_filters() Filter bp_get_current_group_admin_tab to modify return value
 * @return string $tab The current tab's slug
 */
function bp_get_group_current_admin_tab()
{
    if (bp_is_groups_component() && bp_is_current_action('admin')) {
        $tab = bp_action_variable(0);
    } else {
        $tab = '';
    }
    return apply_filters('bp_get_current_group_admin_tab', $tab);
}
コード例 #24
0
/**
 * Return the permalink to a given forum.
 *
 * @param int $forum_id Optional. Defaults to the current forum, if
 *        there is one.
 * @return string|bool False on failure, a URL on success.
 */
function bp_get_forum_permalink($forum_id = 0)
{
    global $bp;
    if (bp_is_groups_component()) {
        $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum');
    } else {
        if (empty($forum_id)) {
            global $topic_template;
            if (isset($topic_template->forum_id)) {
                $forum_id = $topic_template->forum_id;
            }
        }
        if ($forum = bp_forums_get_forum($forum_id)) {
            $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' . $forum->forum_slug);
        } else {
            return false;
        }
    }
    return apply_filters('bp_get_forum_permalink', trailingslashit($permalink));
}
コード例 #25
0
/**
 * Returns the current group admin tab slug.
 *
 * @since 1.6.0
 *
 * @uses apply_filters() Filter bp_get_current_group_admin_tab to modify return value.
 *
 * @return string $tab The current tab's slug.
 */
function bp_get_group_current_admin_tab()
{
    if (bp_is_groups_component() && bp_is_current_action('admin')) {
        $tab = bp_action_variable(0);
    } else {
        $tab = '';
    }
    /**
     * Filters the current group admin tab slug.
     *
     * @since 1.6.0
     *
     * @param string $tab Current group admin tab slug.
     */
    return apply_filters('bp_get_current_group_admin_tab', $tab);
}
コード例 #26
0
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);
}
コード例 #27
0
/**
 *  widget for the community navigation
 *
 * @package Custom Community
 * @since 1.8.3
 */
function widget_community_nav($sidebar_id = false)
{
    ?>
		<?php 
    global $cap;
    if ($sidebar_id == 'leftsidebar' && $cap->bg_leftsidebar_default_nav && $cap->bg_leftsidebar_default_nav == 'no') {
        return;
    }
    ?>
  		<div id="community-nav" class="widget widget-title" >
        	<h3 class="widgettitle"><?php 
    _e('Community', 'cc');
    ?>
</h3>
  				<ul class="item-list">
					
			  		<?php 
    if ('activity' != bp_dtheme_page_on_front() && bp_is_active('activity')) {
        ?>
                                        <li<?php 
        if (bp_is_activity_component()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
							<a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo BP_ACTIVITY_SLUG;
        ?>
/" title="<?php 
        _e('Activity', 'cc');
        ?>
"><?php 
        _e('Activity', 'cc');
        ?>
</a>
						</li>
					<?php 
    }
    ?>

                                        <li<?php 
    if (bp_is_members_component() || bp_is_user()) {
        ?>
 class="selected"<?php 
    }
    ?>
>
                                                <a href="<?php 
    echo site_url();
    ?>
/<?php 
    echo BP_MEMBERS_SLUG;
    ?>
/" title="<?php 
    _e('Members', 'cc');
    ?>
"><?php 
    _e('Members', 'cc');
    ?>
</a>
                                        </li>
			
                                    <?php 
    if (bp_is_active('groups')) {
        ?>
                                            <li<?php 
        if (bp_is_groups_component() || bp_is_group()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
                                                    <a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo BP_GROUPS_SLUG;
        ?>
/" title="<?php 
        _e('Groups', 'cc');
        ?>
"><?php 
        _e('Groups', 'cc');
        ?>
</a>
                                            </li>
			
                                        <?php 
        if (bp_is_active('forums') && (function_exists('bp_forums_is_installed_correctly') && !(int) bp_get_option('bp-disable-forum-directory')) && bp_forums_is_installed_correctly()) {
            ?>
                                                <li<?php 
            if (bp_is_forums_component()) {
                ?>
 class="selected"<?php 
            }
            ?>
>
                                                        <a href="<?php 
            echo site_url();
            ?>
/<?php 
            echo BP_FORUMS_SLUG;
            ?>
/" title="<?php 
            _e('Forums', 'cc');
            ?>
"><?php 
            _e('Forums', 'cc');
            ?>
</a>
                                                </li>
                                        <?php 
        }
        ?>
					<?php 
    }
    ?>
					<?php 
    if (bp_is_active('blogs') && is_multisite()) {
        ?>
                                                        <li<?php 
        if (bp_is_blogs_component()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
							<a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo BP_BLOGS_SLUG;
        ?>
/" title="<?php 
        _e('Blogs', 'cc');
        ?>
"><?php 
        _e('Blogs', 'cc');
        ?>
</a>
						</li>
					<?php 
    }
    ?>
  				</ul>
				
   <?php 
    if (bp_is_single_item() || bp_is_user()) {
        ?>
	   	<?php 
        if (bp_is_group()) {
            ?>
		<div id="community-single-nav" class="widget-title" >
		  <ul class="item-list">
		  <h3 class="widgettitle"><?php 
            _e('@ Group', 'cc');
            ?>
</h3>
				<?php 
            bp_get_options_nav();
            ?>
				<?php 
            do_action('bp_group_options_nav');
            ?>
			</ul>
		
		</div>	
		<?php 
        }
        ?>

		<?php 
        if (bp_is_user()) {
            ?>
		<div id="community-single-nav" class="widget-title" >
		  <ul class="item-list">
		  <h3 class="widgettitle"><?php 
            _e('@ Member', 'cc');
            ?>
</h3>
		  <?php 
            bp_get_displayed_user_nav();
            ?>
				<?php 
            do_action('bp_group_options_nav');
            ?>
			</ul>
		
		</div>	
		<?php 
        }
        ?>
  	<?php 
    }
    ?>
  	</div>
<?php 
}
コード例 #28
0
	/**
	 * Return the permalink to a given forum.
	 *
	 * @param int $forum_id Optional. Defaults to the current forum, if
	 *        there is one.
	 * @return string|bool False on failure, a URL on success.
	 */
	function bp_get_forum_permalink( $forum_id = 0 ) {
		global $bp;

		if ( bp_is_groups_component() ) {
			$permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum' );
		} else {
			if ( empty( $forum_id ) ) {
				global $topic_template;
				if ( isset( $topic_template->forum_id ) )
					$forum_id = $topic_template->forum_id;
			}

			if ( $forum = bp_forums_get_forum( $forum_id ) )
				$permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' . $forum->forum_slug );
			else
				return false;
		}

		/**
		 * Filters the permalink to a given forum.
		 *
		 * @since BuddyPress (1.0.0)
		 *
		 * @param string $value Peramlink to the given forum.
		 */
		return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) );
	}
コード例 #29
0
 function _register()
 {
     global $bp;
     // If admin/create names and slugs are not provided, they fall back on the main
     // name and slug for the extension
     if (!$this->admin_name) {
         $this->admin_name = $this->name;
     }
     if (!$this->admin_slug) {
         $this->admin_slug = $this->slug;
     }
     if (!$this->create_name) {
         $this->create_name = $this->name;
     }
     if (!$this->create_slug) {
         $this->create_slug = $this->slug;
     }
     if (!empty($this->enable_create_step)) {
         // Insert the group creation step for the new group extension
         $bp->groups->group_creation_steps[$this->create_slug] = array('name' => $this->create_name, 'slug' => $this->create_slug, 'position' => $this->create_step_position);
         // Attach the group creation step display content action
         add_action('groups_custom_create_steps', array(&$this, 'create_screen'));
         // Attach the group creation step save content action
         add_action('groups_create_group_step_save_' . $this->create_slug, array(&$this, 'create_screen_save'));
     }
     // When we are viewing a single group, add the group extension nav item
     if (bp_is_group()) {
         if ($this->visibility == 'public' || $this->visibility != 'public' && $bp->groups->current_group->user_has_access) {
             if ($this->enable_nav_item) {
                 bp_core_new_subnav_item(array('name' => !$this->nav_item_name ? $this->name : $this->nav_item_name, 'slug' => $this->slug, 'parent_slug' => $bp->groups->current_group->slug, 'parent_url' => bp_get_group_permalink($bp->groups->current_group), 'position' => $this->nav_item_position, 'item_css_id' => 'nav-' . $this->slug, 'screen_function' => array(&$this, '_display_hook'), 'user_has_access' => $this->enable_nav_item));
                 // When we are viewing the extension display page, set the title and options title
                 if (bp_is_current_action($this->slug)) {
                     add_action('bp_template_content_header', create_function('', 'echo "' . esc_attr($this->name) . '";'));
                     add_action('bp_template_title', create_function('', 'echo "' . esc_attr($this->name) . '";'));
                 }
             }
             // Hook the group home widget
             if (!bp_current_action() && bp_is_current_action('home')) {
                 add_action($this->display_hook, array(&$this, 'widget_display'));
             }
         }
     }
     // Construct the admin edit tab for the new group extension
     if (!empty($this->enable_edit_item) && bp_is_item_admin()) {
         add_action('groups_admin_tabs', create_function('$current, $group_slug', '$selected = ""; if ( "' . esc_attr($this->admin_slug) . '" == $current ) $selected = " class=\\"current\\""; echo "<li{$selected}><a href=\\"' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/{$group_slug}/admin/' . esc_attr($this->admin_slug)) . '\\">' . esc_attr($this->admin_name) . '</a></li>";'), 10, 2);
         // Catch the edit screen and forward it to the plugin template
         if (bp_is_groups_component() && bp_is_current_action('admin') && bp_is_action_variable($this->admin_slug, 0)) {
             // Check whether the user is saving changes
             $this->edit_screen_save();
             add_action('groups_custom_edit_steps', array(&$this, 'edit_screen'));
             if ('' != locate_template(array('groups/single/home.php'), false)) {
                 bp_core_load_template(apply_filters('groups_template_group_home', 'groups/single/home'));
             } else {
                 add_action('bp_template_content_header', create_function('', 'echo "<ul class=\\"content-header-nav\\">"; bp_group_admin_tabs(); echo "</ul>";'));
                 add_action('bp_template_content', array(&$this, 'edit_screen'));
                 bp_core_load_template(apply_filters('bp_core_template_plugin', '/groups/single/plugins'));
             }
         }
     }
 }
コード例 #30
0
    /**
     * Hook this extension's Edit panel into BuddyPress, if necessary
     *
     * @since BuddyPress (1.8)
     */
    protected function setup_edit_hooks()
    {
        // Bail if not an edit screen
        if (!$this->is_screen_enabled('edit') || !bp_is_item_admin()) {
            return;
        }
        $screen = $this->screens['edit'];
        $position = isset($screen['position']) ? (int) $screen['position'] : 10;
        // Add the tab
        // @todo BP should be using bp_core_new_subnav_item()
        add_action('groups_admin_tabs', create_function('$current, $group_slug', '$selected = "";
			if ( "' . esc_attr($screen['slug']) . '" == $current )
				$selected = " class=\\"current\\"";
			echo "<li{$selected}><a href=\\"' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/{$group_slug}/admin/' . esc_attr($screen['slug'])) . '\\">' . esc_attr($screen['name']) . '</a></li>";'), $position, 2);
        // Catch the edit screen and forward it to the plugin template
        if (bp_is_groups_component() && bp_is_current_action('admin') && bp_is_action_variable($screen['slug'], 0)) {
            $this->call_edit_screen_save($this->group_id);
            add_action('groups_custom_edit_steps', array(&$this, 'call_edit_screen'));
            // Determine the proper template and save for later
            // loading
            if ('' !== bp_locate_template(array('groups/single/home.php'), false)) {
                $this->edit_screen_template = '/groups/single/home';
            } else {
                add_action('bp_template_content_header', create_function('', 'echo "<ul class=\\"content-header-nav\\">"; bp_group_admin_tabs(); echo "</ul>";'));
                add_action('bp_template_content', array(&$this, 'call_edit_screen'));
                $this->edit_screen_template = '/groups/single/plugins';
            }
            // We load the template at bp_screens, to give all
            // extensions a chance to load
            add_action('bp_screens', array($this, 'call_edit_screen_template_loader'));
        }
    }