• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_get_root_blog_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中bp_get_root_blog_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_root_blog_id函数的具体用法?PHP bp_get_root_blog_id怎么用?PHP bp_get_root_blog_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bp_get_root_blog_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: test_bp_core_ajax_url

 function test_bp_core_ajax_url()
 {
     $forced = force_ssl_admin();
     // (1) HTTPS off
     force_ssl_admin(false);
     $_SERVER['HTTPS'] = 'off';
     // (1a) Front-end
     $this->go_to('/');
     $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
     // (1b) Dashboard
     $this->go_to('/wp-admin');
     $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
     // (2) FORCE_SSL_ADMIN
     force_ssl_admin(true);
     // (2a) Front-end
     $this->go_to('/');
     $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
     // (2b) Dashboard
     $this->go_to('/wp-admin');
     $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'https'));
     force_ssl_admin($forced);
     // (3) Multisite, root blog other than 1
     if (is_multisite()) {
         $original_root_blog = bp_get_root_blog_id();
         $blog_id = $this->factory->blog->create(array('path' => '/path' . rand() . time() . '/'));
         buddypress()->root_blog_id = $blog_id;
         $blog_url = get_blog_option($blog_id, 'siteurl');
         $this->go_to(trailingslashit($blog_url));
         buddypress()->root_blog_id = $original_root_blog;
         $ajax_url = bp_core_ajax_url();
         $this->go_to('/');
         $this->assertEquals($blog_url . '/wp-admin/admin-ajax.php', $ajax_url);
     }
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:34,代码来源:url.php


示例2: friends_notification_accepted_request

function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
    global $bp;
    $friendship = new BP_Friends_Friendship($friendship_id, false, false);
    $friend_name = bp_core_get_user_displayname($friend_id);
    if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) {
        return false;
    }
    $ud = get_userdata($initiator_id);
    $friend_link = bp_core_get_user_domain($friend_id);
    $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
    $settings_link = bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications';
    // Set up and send the message
    $to = $ud->user_email;
    $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
    $subject = '[' . $sitename . '] ' . sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name);
    $message = sprintf(__('%1$s accepted your friend request.

To view %2$s\'s profile: %3$s

---------------------
', 'buddypress'), $friend_name, $friend_name, $friend_link);
    $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
    /* Send the message */
    $to = apply_filters('friends_notification_accepted_request_to', $to);
    $subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name);
    $message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link);
    nxt_mail($to, $subject, $message);
    do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:30,代码来源:bp-friends-notifications.php


示例3: bp_adminbar_authors_menu

function bp_adminbar_authors_menu()
{
    global $bp, $nxtdb;
    // Only for multisite
    if (!is_multisite()) {
        return false;
    }
    // Hide on root blog
    if ($nxtdb->blogid == bp_get_root_blog_id() || !bp_is_active('blogs')) {
        return false;
    }
    $blog_prefix = $nxtdb->get_blog_prefix($nxtdb->blogid);
    $authors = $nxtdb->get_results("SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM {$nxtdb->users} u, {$nxtdb->usermeta} um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id");
    if (!empty($authors)) {
        // This is a blog, render a menu with links to all authors
        echo '<li id="bp-adminbar-authors-menu"><a href="/">';
        _e('Blog Authors', 'buddypress');
        echo '</a>';
        echo '<ul class="author-list">';
        foreach ((array) $authors as $author) {
            $caps = maybe_unserialize($author->caps);
            if (isset($caps['subscriber']) || isset($caps['contributor'])) {
                continue;
            }
            echo '<li>';
            echo '<a href="' . bp_core_get_user_domain($author->user_id, $author->user_nicename, $author->user_login) . '">';
            echo bp_core_fetch_avatar(array('item_id' => $author->user_id, 'email' => $author->user_email, 'width' => 15, 'height' => 15));
            echo ' ' . $author->display_name . '</a>';
            echo '<div class="admin-bar-clear"></div>';
            echo '</li>';
        }
        echo '</ul>';
        echo '</li>';
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:35,代码来源:bp-members-buddybar.php


示例4: bp_blogs_register_widgets

function bp_blogs_register_widgets()
{
    global $wpdb;
    if (bp_is_active('activity') && (int) $wpdb->blogid == bp_get_root_blog_id()) {
        add_action('widgets_init', create_function('', 'return register_widget("BP_Blogs_Recent_Posts_Widget");'));
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:7,代码来源:bp-blogs-widgets.php


示例5: bp_core_allow_default_theme

/**
 * bp_core_allow_default_theme()
 *
 * On multiblog installations you must first allow themes to be activated and show
 * up on the theme selection screen. This function will let the BuddyPress bundled
 * themes show up on the root blog selection screen and bypass this step. It also
 * means that the themes won't show for selection on other blogs.
 *
 * @package BuddyPress Core
 */
function bp_core_allow_default_theme($themes)
{
    global $wpdb;
    if (!bp_current_user_can('bp_moderate')) {
        return $themes;
    }
    if ($wpdb->blogid == bp_get_root_blog_id()) {
        $themes['bp-default'] = 1;
    }
    return $themes;
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:21,代码来源:bp-core-filters.php


示例6: bp_get_object_terms

/**
 * Get taxonomy terms for a BuddyPress object.
 *
 * @since BuddyPress (2.2.0)
 *
 * @see wp_get_object_terms() for a full description of function and parameters.
 *
 * @param int|array    $object_ids ID or IDs of objects.
 * @param string|array $taxonomies Name or names of taxonomies to match.
 * @param array        $args       See {@see wp_get_object_terms()}.
 * @return array
 */
function bp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
	if ( ! bp_is_root_blog() ) {
		switch_to_blog( bp_get_root_blog_id() );
	}

	$retval = wp_get_object_terms( $object_ids, $taxonomies, $args );

	restore_current_blog();

	return $retval;
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:23,代码来源:bp-core-taxonomy.php


示例7: thatcamp_blogs_register_widgets

function thatcamp_blogs_register_widgets()
{
    global $wpdb;
    if (bp_is_active('activity') && bp_is_active('blogs') && class_exists('BP_Blogs_Recent_Posts_Widget') && (int) $wpdb->blogid == bp_get_root_blog_id()) {
        include __DIR__ . '/includes/posts-widget.php';
        add_action('widgets_init', create_function('', 'unregister_widget( "BP_Blogs_Recent_Posts_Widget" ); return register_widget("THATCamp_Blogs_Recent_Posts_Widget");'));
    }
    if (bp_is_active('groups') && (int) $wpdb->blogid == bp_get_root_blog_id()) {
        include __DIR__ . '/includes/groups-widget.php';
        add_action('widgets_init', create_function('', 'unregister_widget( "BP_Groups_Widget" ); return register_widget("THATCamp_Groups_Widget");'));
    }
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:12,代码来源:thatcamp-widgets.php


示例8: bp_get_taxonomy_term_site_id

/**
 * Gets the ID of the site that BP should use for taxonomy term storage.
 *
 * Defaults to the root blog ID.
 *
 * @since 2.6.0
 *
 * @param string $taxonomy Taxonomy slug to check for.
 * @return int
 */
function bp_get_taxonomy_term_site_id($taxonomy = '')
{
    $site_id = bp_get_root_blog_id();
    /**
     * Filters the ID of the site where BP should store taxonomy terms.
     *
     * @since 2.6.0
     *
     * @param int    $site_id  Site ID to cehck for.
     * @param string $taxonomy Taxonomy slug to check for.
     */
    return (int) apply_filters('bp_get_taxonomy_term_site_id', $site_id, $taxonomy);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:23,代码来源:bp-core-taxonomy.php


示例9: __construct

 /**
  * Constructor method
  *
  * @package Rendez_Vous
  * @subpackage Component
  *
  * @since Rendez Vous (1.0.0)
  */
 function __construct()
 {
     $bp = buddypress();
     parent::start('rendez_vous', rendez_vous()->get_component_name(), rendez_vous()->includes_dir);
     $this->includes();
     $bp->active_components[$this->id] = '1';
     /**
      * Only register the post type on the blog where BuddyPress is activated.
      */
     if (get_current_blog_id() == bp_get_root_blog_id()) {
         add_action('init', array(&$this, 'register_post_types'));
     }
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:21,代码来源:rendez-vous-loader.php


示例10: actions

 /**
  * set some actions
  *
  *
  * @package BuddyDrive
  * @since 1.2.0
  */
 private function actions()
 {
     buddypress()->active_components[$this->id] = '1';
     /**
      * Register the BuddyDrive custom post types
      */
     if (get_current_blog_id() == bp_get_root_blog_id()) {
         add_action('init', array(&$this, 'register_post_types'), 9);
         // Register the BuddyDrive upload dir
         add_action('bp_init', array($this, 'register_upload_dir'));
     }
     // register the embed handler
     add_action('bp_init', array($this, 'register_embed_code'), 4);
 }
开发者ID:MrVibe,项目名称:buddydrive,代码行数:21,代码来源:buddydrive-component.php


示例11: bp_core_allow_default_theme

/**
 * On multiblog installations you must first allow themes to be activated and
 * show up on the theme selection screen. This function will let the BuddyPress
 * bundled themes show up on the root blog selection screen and bypass this
 * step. It also means that the themes won't show for selection on other blogs.
 *
 * @deprecated BuddyPress (1.7)
 * @package BuddyPress Core
 */
function bp_core_allow_default_theme($themes)
{
    _deprecated_function(__FUNCTION__, '1.7');
    if (!bp_current_user_can('bp_moderate')) {
        return $themes;
    }
    if (bp_get_root_blog_id() != get_current_blog_id()) {
        return $themes;
    }
    if (isset($themes['bp-default'])) {
        return $themes;
    }
    $themes['bp-default'] = true;
    return $themes;
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:24,代码来源:1.7.php


示例12: test_bp_current_user_can_should_respect_blog_id_passed_in_args_array

 /**
  * @ticket BP6501
  */
 public function test_bp_current_user_can_should_respect_blog_id_passed_in_args_array()
 {
     if (!is_multisite()) {
         $this->markTestSkipped(__METHOD__ . ' requires multisite.');
     }
     $b = $this->factory->blog->create();
     $u = $this->factory->user->create();
     $this->set_current_user($u);
     add_filter('user_has_cap', array($this, 'grant_cap_foo'), 10, 2);
     $can = bp_current_user_can('foo', array('blog_id' => bp_get_root_blog_id()));
     $cant = bp_current_user_can('foo', array('blog_id' => $b));
     remove_filter('user_has_cap', array($this, 'grant_cap_foo'), 10, 2);
     $this->assertTrue($can);
     $this->assertFalse($cant);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:18,代码来源:caps.php


示例13: bp_forums_bbpress_install

function bp_forums_bbpress_install($location = '')
{
    global $wpdb, $bbdb;
    check_admin_referer('bp_forums_new_install_init');
    if (empty($location)) {
        $location = ABSPATH . 'bb-config.php';
    }
    $bp = buddypress();
    // Create the bb-config.php file.
    $initial_write = bp_forums_bbpress_write($bp->plugin_dir . '/bp-forums/bbpress/bb-config-sample.php', $location, array("define( 'BBDB_NAME'," => array("'bbpress'", "'" . DB_NAME . "'"), "define( 'BBDB_USER'," => array("'username'", "'" . DB_USER . "'"), "define( 'BBDB_PASSWO" => array("'password'", "'" . DB_PASSWORD . "'"), "define( 'BBDB_HOST'," => array("'localhost'", "'" . DB_HOST . "'"), "define( 'BBDB_CHARSE" => array("'utf8'", "'" . DB_CHARSET . "'"), "define( 'BBDB_COLLAT" => array("''", "'" . DB_COLLATE . "'"), "define( 'BB_AUTH_KEY" => array("'put your unique phrase here'", "'" . addslashes(AUTH_KEY) . "'"), "define( 'BB_SECURE_A" => array("'put your unique phrase here'", "'" . addslashes(SECURE_AUTH_KEY) . "'"), "define( 'BB_LOGGED_I" => array("'put your unique phrase here'", "'" . addslashes(LOGGED_IN_KEY) . "'"), "define( 'BB_NONCE_KE" => array("'put your unique phrase here'", "'" . addslashes(NONCE_KEY) . "'"), "\$bb_table_prefix = '" => array("'bb_'", "'" . $bp->table_prefix . "bb_'"), "define( 'BB_LANG', '" => array("''", "'" . get_locale() . "'")));
    // Add the custom user and usermeta entries to the config file.
    if ($initial_write == 1) {
        $file = file_get_contents($location);
    } else {
        $file =& $initial_write;
    }
    $file = trim($file);
    if ('?>' == substr($file, -2, 2)) {
        $file = substr($file, 0, -2);
    }
    $file .= "\n" . '$bb->custom_user_table = \'' . $wpdb->users . '\';';
    $file .= "\n" . '$bb->custom_user_meta_table = \'' . $wpdb->usermeta . '\';';
    $file .= "\n\n" . '$bb->uri = \'' . $bp->plugin_url . '/bp-forums/bbpress/\';';
    $file .= "\n" . '$bb->name = \'' . get_blog_option(bp_get_root_blog_id(), 'blogname') . ' ' . __('Forums', 'buddypress') . '\';';
    if (is_multisite()) {
        $file .= "\n" . '$bb->wordpress_mu_primary_blog_id = ' . bp_get_root_blog_id() . ';';
    }
    if (defined('AUTH_SALT')) {
        $file .= "\n\n" . 'define(\'BB_AUTH_SALT\', \'' . addslashes(AUTH_SALT) . '\');';
    }
    if (defined('LOGGED_IN_SALT')) {
        $file .= "\n" . 'define(\'BB_LOGGED_IN_SALT\', \'' . addslashes(LOGGED_IN_SALT) . '\');';
    }
    if (defined('SECURE_AUTH_SALT')) {
        $file .= "\n" . 'define(\'BB_SECURE_AUTH_SALT\', \'' . addslashes(SECURE_AUTH_SALT) . '\');';
    }
    $file .= "\n\n" . 'define(\'WP_AUTH_COOKIE_VERSION\', 2);';
    $file .= "\n\n" . '?>';
    if ($initial_write == 1) {
        $file_handle = fopen($location, 'w');
        fwrite($file_handle, $file);
        fclose($file_handle);
    } else {
        $initial_write = $file;
    }
    bp_update_option('bb-config-location', $location);
    return $initial_write;
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:48,代码来源:1.7.php


示例14: messages_notification_new_message

function messages_notification_new_message($args = array())
{
    // These should be extracted below
    $recipients = array();
    $email_subject = $email_content = '';
    extract($args);
    $sender_name = bp_core_get_user_displayname($sender_id);
    // Bail if no recipients
    if (!empty($recipients)) {
        foreach ($recipients as $recipient) {
            if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) {
                continue;
            }
            // User data and links
            $ud = get_userdata($recipient->user_id);
            $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/';
            $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
            $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/';
            // Sender info
            $sender_name = stripslashes($sender_name);
            $subject = stripslashes(wp_filter_kses($subject));
            $content = stripslashes(wp_filter_kses($content));
            // Set up and send the message
            $email_to = $ud->user_email;
            $sitename = wp_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
            $email_subject = '[' . $sitename . '] ' . sprintf(__('New message from %s', 'buddypress'), $sender_name);
            $email_content = sprintf(__('%1$s sent you a new message:

Subject: %2$s

"%3$s"

To view and read your messages please log in and visit: %4$s

---------------------
', 'buddypress'), $sender_name, $subject, $content, $message_link);
            $email_content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
            // Send the message
            $email_to = apply_filters('messages_notification_new_message_to', $email_to);
            $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name);
            $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link);
            wp_mail($email_to, $email_subject, $email_content);
        }
    }
    do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:46,代码来源:bp-messages-notifications.php


示例15: bp_admin_bar_root_site

/**
 * Add a menu for the root site of this BuddyPress network
 *
 * @global type $nxt_admin_bar
 * @return If in ajax
 */
function bp_admin_bar_root_site()
{
    global $nxt_admin_bar;
    // Create the root blog menu
    $nxt_admin_bar->add_menu(array('id' => 'bp-root-blog', 'title' => get_blog_option(bp_get_root_blog_id(), 'blogname'), 'href' => bp_get_root_domain()));
    // Logged in user
    if (is_user_logged_in()) {
        // Dashboard links
        if (is_super_admin()) {
            // Add site admin link
            $nxt_admin_bar->add_menu(array('id' => 'dashboard', 'parent' => 'bp-root-blog', 'title' => __('Admin Dashboard', 'buddypress'), 'href' => get_admin_url(bp_get_root_blog_id())));
            // Add network admin link
            if (is_multisite()) {
                // Link to the network admin dashboard
                $nxt_admin_bar->add_menu(array('id' => 'network-dashboard', 'parent' => 'bp-root-blog', 'title' => __('Network Dashboard', 'buddypress'), 'href' => network_admin_url()));
            }
        }
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:25,代码来源:bp-core-adminbar.php


示例16: register_member_type

 /**
  * Register all active member types
  * 
  */
 public function register_member_type()
 {
     //$this->register_post_type();
     $is_root_blog = bp_is_root_blog();
     //if we are not on the main bp site, switch to it before registering member type
     if (!$is_root_blog) {
         switch_to_blog(bp_get_root_blog_id());
     }
     //get all posts in memeber type post type
     $post_ids = $this->get_active_member_types();
     // get_posts( array( 'post_type'=> bp_member_type_generator()->get_post_type(), 'posts_per_page'=> -1, 'post_status'=> 'publish' ) );
     //update meta cache to avoid multiple db calls
     update_meta_cache('post', $post_ids);
     //build to register the memebr type
     $member_types = array();
     foreach ($post_ids as $post_id) {
         $is_active = get_post_meta($post_id, '_bp_member_type_is_active', true);
         $name = get_post_meta($post_id, '_bp_member_type_name', true);
         if (!$is_active || !$name) {
             continue;
             //if not active or no unique key, do not register
         }
         $enable_directory = get_post_meta($post_id, '_bp_member_type_enable_directory', true);
         $directory_slug = get_post_meta($post_id, '_bp_member_type_directory_slug', true);
         $has_dir = false;
         if ($enable_directory) {
             if ($directory_slug) {
                 $has_dir = $directory_slug;
             } else {
                 $has_dir = true;
             }
         }
         $member_types[$name] = array('labels' => array('name' => get_post_meta($post_id, '_bp_member_type_label_name', true), 'singular_name' => get_post_meta($post_id, '_bp_member_type_label_singular_name', true)), 'has_directory' => $has_dir);
     }
     foreach ($member_types as $member_type => $args) {
         bp_register_member_type($member_type, $args);
     }
     if (!$is_root_blog) {
         restore_current_blog();
     }
 }
开发者ID:buddydev,项目名称:bp-member-type-generator,代码行数:45,代码来源:actions.php


示例17: bp_core_confirmation_js

function bp_core_confirmation_js()
{
    global $nxtdb;
    if (is_multisite() && $nxtdb->blogid != bp_get_root_blog_id()) {
        return false;
    }
    if (!nxt_script_is('jquery')) {
        nxt_enqueue_script('jquery');
    }
    if (!nxt_script_is('jquery', 'done')) {
        nxt_print_scripts('jquery');
    }
    ?>

	<script type="text/javascript"> jQuery(document).ready( function() { jQuery("a.confirm").click( function() { if ( confirm( '<?php 
    _e('Are you sure?', 'buddypress');
    ?>
' ) ) return true; else return false; }); });</script>

<?php 
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:21,代码来源:bp-core-cssjs.php


示例18: bp_core_admin_slugs_options

/**
 * Creates reusable markup for page setup on the Components and Pages dashboard panel.
 *
 * @package BuddyPress
 * @since 1.6.0
 * @todo Use settings API
 */
function bp_core_admin_slugs_options()
{
    $bp = buddypress();
    // Get the existing WP pages
    $existing_pages = bp_core_get_directory_page_ids();
    // Set up an array of components (along with component names) that have
    // directory pages.
    $directory_pages = array();
    // Loop through loaded components and collect directories
    if (is_array($bp->loaded_components)) {
        foreach ($bp->loaded_components as $component_slug => $component_id) {
            // Only components that need directories should be listed here
            if (isset($bp->{$component_id}) && !empty($bp->{$component_id}->has_directory)) {
                // component->name was introduced in BP 1.5, so we must provide a fallback
                $directory_pages[$component_id] = !empty($bp->{$component_id}->name) ? $bp->{$component_id}->name : ucwords($component_id);
            }
        }
    }
    /** Directory Display *****************************************************/
    /**
     * Filters the loaded components needing directory page association to a WordPress page.
     *
     * @since 1.5.0
     *
     * @param array $directory_pages Array of available components to set associations for.
     */
    $directory_pages = apply_filters('bp_directory_pages', $directory_pages);
    if (!empty($directory_pages)) {
        ?>

		<h3><?php 
        _e('Directories', 'buddypress');
        ?>
</h3>

		<p><?php 
        _e('Associate a WordPress Page with each BuddyPress component directory.', 'buddypress');
        ?>
</p>

		<table class="form-table">
			<tbody>

				<?php 
        foreach ($directory_pages as $name => $label) {
            ?>

					<tr valign="top">
						<th scope="row">
							<label for="bp_pages[<?php 
            echo esc_attr($name);
            ?>
]"><?php 
            echo esc_html($label);
            ?>
</label>
						</th>

						<td>

							<?php 
            if (!bp_is_root_blog()) {
                switch_to_blog(bp_get_root_blog_id());
            }
            ?>

							<?php 
            echo wp_dropdown_pages(array('name' => 'bp_pages[' . esc_attr($name) . ']', 'echo' => false, 'show_option_none' => __('- None -', 'buddypress'), 'selected' => !empty($existing_pages[$name]) ? $existing_pages[$name] : false));
            ?>

							<?php 
            if (!empty($existing_pages[$name])) {
                ?>

								<a href="<?php 
                echo get_permalink($existing_pages[$name]);
                ?>
" class="button-secondary" target="_bp"><?php 
                _e('View', 'buddypress');
                ?>
</a>

							<?php 
            }
            ?>

							<?php 
            if (!bp_is_root_blog()) {
                restore_current_blog();
            }
            ?>

						</td>
//.........这里部分代码省略.........
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:101,代码来源:bp-core-admin-slugs.php


示例19:

<?php

/**
 * Radio-box selection with descriptions template. 
 * 
 * Copy this file into your theme directory and edit away!
 * You can also use $templates array to iterate through your templates.
 */
if (defined('BP_VERSION') && 'bp-default' == get_blog_option(bp_get_root_blog_id(), 'stylesheet')) {
    echo '<br style="clear:both" />';
}
?>
<div id="blog_template-selection">
	<div class="blog_template-option">
		<label for="blog_template"><?php 
_e('Select a template', 'blog_templates');
?>
</label>
	<?php 
foreach ($templates as $tkey => $template) {
    ?>
		<label for="blog_template-<?php 
    echo $tkey;
    ?>
">
			<input type="radio" id="blog_template-<?php 
    echo $tkey;
    ?>
" name="blog_template" value="<?php 
    echo $tkey;
    ?>
开发者ID:hscale,项目名称:webento,代码行数:31,代码来源:blog_templates-registration-description.php


示例20: bp_current_user_can

/**
 * Whether current user has a capability or role. Can be passed blog ID, or will
 * use the root blod by default
 *
 * @since BuddyPress (1.6)
 *
 * @param string $capability Capability or role name.
 * @param int $blog_id Blog ID
 * @return bool
 */
function bp_current_user_can($capability, $blog_id = 0)
{
    // Use root blog if no ID passed
    if (empty($blog_id)) {
        $blog_id = bp_get_root_blog_id();
    }
    $retval = current_user_can_for_blog($blog_id, $capability);
    return (bool) apply_filters('bp_current_user_can', $retval, $capability, $blog_id);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:19,代码来源:bp-core-caps.php



注:本文中的bp_get_root_blog_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_get_root_domain函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_get_requested_url函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap