本文整理汇总了PHP中bp_blog_signup_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_blog_signup_enabled函数的具体用法?PHP bp_blog_signup_enabled怎么用?PHP bp_blog_signup_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_blog_signup_enabled函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_blogs_screen_create_a_blog
function bp_blogs_screen_create_a_blog()
{
if (!is_multisite() || !bp_is_blogs_component() || !bp_is_current_action('create')) {
return false;
}
if (!is_user_logged_in() || !bp_blog_signup_enabled()) {
return false;
}
do_action('bp_blogs_screen_create_a_blog');
bp_core_load_template(apply_filters('bp_blogs_template_create_a_blog', 'blogs/create'));
}
示例2: bp_blogs_screen_create_a_blog
/**
* Load the "Create a Blog" screen.
*/
function bp_blogs_screen_create_a_blog()
{
if (!is_multisite() || !bp_is_blogs_component() || !bp_is_current_action('create')) {
return false;
}
if (!is_user_logged_in() || !bp_blog_signup_enabled()) {
return false;
}
/**
* Fires right before the loading of the Create A Blog screen template file.
*
* @since 1.0.0
*/
do_action('bp_blogs_screen_create_a_blog');
bp_core_load_template(apply_filters('bp_blogs_template_create_a_blog', 'blogs/create'));
}
示例3: bp_adminbar_blogs_menu
/**
* Add a Sites menu to the BuddyBar.
*
* @since BuddyPress (1.0.0)
*
* @global object $bp The BuddyPress global settings object.
*
* @return bool|null Returns false on failure. Otherwise echoes the menu item.
*/
function bp_adminbar_blogs_menu()
{
global $bp;
if (!is_user_logged_in() || !bp_is_active('blogs')) {
return false;
}
if (!is_multisite()) {
return false;
}
$blogs = wp_cache_get('bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp');
if (empty($blogs)) {
$blogs = bp_blogs_get_blogs_for_user(bp_loggedin_user_id(), true);
wp_cache_set('bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', $blogs, 'bp');
}
$counter = 0;
if (is_array($blogs['blogs']) && (int) $blogs['count']) {
echo '<li id="bp-adminbar-blogs-menu"><a href="' . trailingslashit(bp_loggedin_user_domain() . bp_get_blogs_slug()) . '">';
_e('My Sites', 'buddypress');
echo '</a>';
echo '<ul>';
foreach ((array) $blogs['blogs'] as $blog) {
$alt = 0 == $counter % 2 ? ' class="alt"' : '';
$site_url = esc_attr($blog->siteurl);
echo '<li' . $alt . '>';
echo '<a href="' . $site_url . '">' . esc_html($blog->name) . '</a>';
echo '<ul>';
echo '<li class="alt"><a href="' . $site_url . 'wp-admin/">' . __('Dashboard', 'buddypress') . '</a></li>';
echo '<li><a href="' . $site_url . 'wp-admin/post-new.php">' . __('New Post', 'buddypress') . '</a></li>';
echo '<li class="alt"><a href="' . $site_url . 'wp-admin/edit.php">' . __('Manage Posts', 'buddypress') . '</a></li>';
echo '<li><a href="' . $site_url . 'wp-admin/edit-comments.php">' . __('Manage Comments', 'buddypress') . '</a></li>';
echo '</ul>';
do_action('bp_adminbar_blog_items', $blog);
echo '</li>';
$counter++;
}
$alt = 0 == $counter % 2 ? ' class="alt"' : '';
if (bp_blog_signup_enabled()) {
echo '<li' . $alt . '>';
echo '<a href="' . bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/">' . __('Create a Site!', 'buddypress') . '</a>';
echo '</li>';
}
echo '</ul>';
echo '</li>';
}
}
示例4: do_action
?>
</div><!--/#breadcrumbs -->
<?php
}
?>
<div class="padder">
<?php
do_action('bp_before_directory_blogs');
?>
<form action="" method="post" id="blogs-directory-form" class="dir-form">
<h3><?php
_e('Site Directory', 'buddypress');
if (is_user_logged_in() && bp_blog_signup_enabled()) {
?>
<a class="button" href="<?php
echo bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/';
?>
"><?php
_e('Create a Site', 'buddypress');
?>
</a><?php
}
?>
</h3>
<?php
do_action('bp_before_directory_blogs_content');
?>
示例5: create_dummy_post
/**
* Update the global $post with create screen data.
*
* @since BuddyPress (1.7.0)
*/
public function create_dummy_post()
{
// Title based on ability to create blogs
if (is_user_logged_in() && bp_blog_signup_enabled()) {
$title = '<a class="button bp-title-button" href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug()) . '">' . __('Sites', 'buddypress') . '</a> ' . __('Create a Site', 'buddypress');
} else {
$title = __('Sites', 'buddypress');
}
bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
}
示例6: do_action
<?php
/** This action is documented in bp-templates/bp-legacy/buddypress/activity/index.php */
do_action('template_notices');
?>
<?php
/**
* Fires before the display of the blog creation form.
*
* @since BuddyPress (1.1.0)
*/
do_action('bp_before_create_blog_content');
?>
<?php
if (bp_blog_signup_enabled()) {
?>
<?php
bp_show_blog_signup_form();
?>
<?php
} else {
?>
<div id="message" class="info">
<p><?php
_e('Site registration is currently disabled', 'buddypress');
?>
</p>
示例7: bp_get_blog_create_button
/**
* Get the Create a Site button.
*
* @since BuddyPress (2.0.0)
*
* @return string
*/
function bp_get_blog_create_button()
{
if (!is_user_logged_in()) {
return false;
}
if (!bp_blog_signup_enabled()) {
return false;
}
$button_args = array('id' => 'create_blog', 'component' => 'blogs', 'link_text' => __('Create a Site', 'buddypress'), 'link_title' => __('Create a Site', 'buddypress'), 'link_class' => 'blog-create no-ajax', 'link_href' => trailingslashit(bp_get_blogs_directory_permalink() . 'create'), 'wrapper' => false, 'block_self' => false);
/**
* Filters the Create a Site button.
*
* @since BuddyPress (2.0.0)
*
* @param array $button_args Array of arguments to be used for the Create a Site button.
*/
return bp_get_button(apply_filters('bp_get_blog_create_button', $button_args));
}
示例8: setup_admin_bar
/**
* Set up bp-blogs integration with the WordPress admin bar.
*
* @since BuddyPress (1.5.0)
*
* @see BP_Component::setup_admin_bar() for a description of arguments.
*
* @param array $wp_admin_nav See BP_Component::setup_admin_bar()
* for description.
*/
public function setup_admin_bar( $wp_admin_nav = array() ) {
$bp = buddypress();
/**
* Site/post/comment menus should not appear on single WordPress setups.
*
* Comments and posts made by users will still show in their activity.
*/
if ( ! is_multisite() ) {
return false;
}
// Menus for logged in user
if ( is_user_logged_in() ) {
$blogs_link = trailingslashit( bp_loggedin_user_domain() . $this->slug );
// Add the "Sites" sub menu
$wp_admin_nav[] = array(
'parent' => $bp->my_account_menu_id,
'id' => 'my-account-' . $this->id,
'title' => __( 'Sites', 'buddypress' ),
'href' => trailingslashit( $blogs_link )
);
// My Sites
$wp_admin_nav[] = array(
'parent' => 'my-account-' . $this->id,
'id' => 'my-account-' . $this->id . '-my-sites',
'title' => __( 'My Sites', 'buddypress' ),
'href' => trailingslashit( $blogs_link )
);
// Create a Site
if ( bp_blog_signup_enabled() ) {
$wp_admin_nav[] = array(
'parent' => 'my-account-' . $this->id,
'id' => 'my-account-' . $this->id . '-create',
'title' => __( 'Create a Site', 'buddypress' ),
'href' => trailingslashit( bp_get_blogs_directory_permalink() . 'create' )
);
}
}
parent::setup_admin_bar( $wp_admin_nav );
}
示例9: bp_blogs_screen_create_a_blog
function bp_blogs_screen_create_a_blog() {
global $bp;
if ( !bp_core_is_multisite() || $bp->current_component != $bp->blogs->slug || 'create' != $bp->current_action )
return false;
if ( !is_user_logged_in() || !bp_blog_signup_enabled() )
return false;
do_action( 'bp_blogs_screen_create_a_blog' );
bp_core_load_template( apply_filters( 'bp_blogs_template_create_a_blog', 'blogs/create' ) );
}
示例10: bp_get_blog_create_button
/**
* Get the Create a Site button.
*
* @since BuddyPress (2.0.0)
*
* @return string
*/
function bp_get_blog_create_button()
{
if (!is_user_logged_in()) {
return false;
}
if (!bp_blog_signup_enabled()) {
return false;
}
$button_args = array('id' => 'create_blog', 'component' => 'blogs', 'link_text' => __('Create a Site', 'buddypress'), 'link_title' => __('Create a Site', 'buddypress'), 'link_class' => 'button blog-create bp-title-button', 'link_href' => trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug()) . trailingslashit('create'), 'wrapper' => false);
return bp_get_button(apply_filters('bp_get_blog_create_button', $button_args));
}
示例11: create_dummy_post
/**
* Update the global $post with create screen data.
*
* @since 1.7.0
*/
public function create_dummy_post()
{
// Title based on ability to create blogs.
if (is_user_logged_in() && bp_blog_signup_enabled()) {
$title = __('Create a Site', 'buddypress');
} else {
$title = __('Sites', 'buddypress');
}
bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
}
示例12: directory_before_content
function directory_before_content()
{
if (!preg_match('|^bp_before_directory_([^\\_]+)_content$|', current_filter(), $match)) {
return;
}
$component = $match[1];
$defaults = array('before_title' => '<h3>', 'after_title' => '</h3>', 'show_create' => is_user_logged_in());
switch ($component) {
case 'groups':
$defaults['directory_title'] = __('Groups Directory', 'buddypress');
$defaults['create_html'] = ' <a class="button" href="' . bp_get_root_domain() . '/' . bp_get_root_slug('groups') . '/create/">' . __('Create a Group', 'buddypress') . '</a>';
break;
case 'forums':
$defaults['directory_title'] = __('Group Forums Directory', 'buddypress');
$defaults['create_html'] = ' <a class="button" href="#new-topic" id="new-topic-button">' . __('New Topic', 'buddypress') . '</a>';
break;
case 'blogs':
$defaults['show_create'] &= bp_blog_signup_enabled();
$defaults['directory_title'] = __('Blogs Directory', 'buddypress');
$defaults['create_html'] = ' <a class="button" href="' . bp_get_root_domain() . '/' . bp_get_root_slug('blogs') . '/create/">' . __('Create a Blog', 'buddypress') . '</a>';
break;
}
$args = apply_filters('gconnect_directory_title', $defaults, $component);
extract($args, EXTR_SKIP);
echo $before_title . $directory_title;
if ($show_create) {
echo $create_html;
}
echo $after_title;
}
示例13: test_bp_signup_enabled_when_registration_setting_is_none_should_return_false
/**
* @group bp_blog_signup_enabled
*/
public function test_bp_signup_enabled_when_registration_setting_is_none_should_return_false()
{
$old_settings = $settings = buddypress()->site_options;
if (!is_array($settings)) {
$settings = array();
}
$settings['registration'] = 'none';
buddypress()->site_options = $settings;
$this->assertFalse(bp_blog_signup_enabled());
buddypress()->site_options = $old_settings;
}