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

PHP bp_forums_is_installed_correctly函数代码示例

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

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



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

示例1: setup_nav

 /**
  * Setup BuddyBar navigation
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Stop if forums haven't been set up yet
     if (!bp_forums_is_installed_correctly()) {
         return;
     }
     // Stop if there is no user displayed or logged in
     if (!is_user_logged_in() && !bp_displayed_user_id()) {
         return;
     }
     // Add 'Forums' to the main navigation
     $main_nav = array('name' => __('Forums', 'buddypress'), 'slug' => $this->slug, 'position' => 80, 'screen_function' => 'bp_member_forums_screen_topics', 'default_subnav_slug' => 'topics', 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     // User link
     $forums_link = trailingslashit($user_domain . $this->slug);
     // Additional menu if friends is active
     $sub_nav[] = array('name' => __('Topics Started', 'buddypress'), 'slug' => 'topics', 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_member_forums_screen_topics', 'position' => 20, 'item_css_id' => 'topics');
     // Additional menu if friends is active
     $sub_nav[] = array('name' => __('Replied To', 'buddypress'), 'slug' => 'replies', 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_member_forums_screen_replies', 'position' => 40, 'item_css_id' => 'replies');
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:31,代码来源:bp-forums-loader.php


示例2: bp_core_exclude_pages

/**
 * Prevent specific pages (eg 'Activate') from showing on page listings.
 *
 * @uses bp_is_active() checks if a BuddyPress component is active.
 *
 * @param array $pages List of excluded page IDs, as passed to the
 *                     'wp_list_pages_excludes' filter.
 * @return array The exclude list, with BP's pages added.
 */
function bp_core_exclude_pages($pages = array())
{
    // Bail if not the root blog.
    if (!bp_is_root_blog()) {
        return $pages;
    }
    $bp = buddypress();
    if (!empty($bp->pages->activate)) {
        $pages[] = $bp->pages->activate->id;
    }
    if (!empty($bp->pages->register)) {
        $pages[] = $bp->pages->register->id;
    }
    if (!empty($bp->pages->forums) && (!bp_is_active('forums') || bp_is_active('forums') && bp_forums_has_directory() && !bp_forums_is_installed_correctly())) {
        $pages[] = $bp->pages->forums->id;
    }
    /**
     * Filters specific pages that shouldn't show up on page listings.
     *
     * @since 1.5.0
     *
     * @param array $pages Array of pages to exclude.
     */
    return apply_filters('bp_core_exclude_pages', $pages);
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:34,代码来源:bp-core-filters.php


示例3: bp_forums_bbpress_admin

function bp_forums_bbpress_admin() {
	global $bp;
?>
	<div class="wrap">

		<h2><?php _e( 'Forums Setup', 'buddypress' ) ?></h2>

		<?php if ( isset( $_POST['submit'] ) ) : ?>
			<div id="message" class="updated fade">
				<p><?php _e( 'Settings Saved.', 'buddypress' ) ?></p>
			</div>
		<?php endif;

		if ( isset( $_REQUEST['reinstall'] ) || !bp_forums_is_installed_correctly() ) {
			update_site_option( 'bb-config-location', false );
			bp_forums_bbpress_install_wizard();
		} else {
			$reinstall = network_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' ); ?>

			<p><?php printf( __( 'bbPress forum integration in BuddyPress has been set up correctly. If you are having problems you can <a href="%s" title="Reinstall bbPress">re-install</a>', 'buddypress' ), $reinstall ); ?>
			<p><?php _e( 'NOTE: The forums directory will only work if your bbPress tables are in the same database as your WordPress tables. If you are not using an existing bbPress install you can ignore this message.', 'buddypress' ) ?></p>

		<?php
		}
		?>
	</div>
<?php
}
开发者ID:n-sane,项目名称:zaroka,代码行数:28,代码来源:bp-forums-admin.php


示例4: bp_forums_directory_forums_setup

function bp_forums_directory_forums_setup()
{
    global $bp;
    if (bp_is_forums_component() && (!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) {
        if (!bp_forums_has_directory()) {
            return false;
        }
        if (!bp_forums_is_installed_correctly()) {
            bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error');
            bp_core_redirect(bp_get_root_domain());
        }
        bp_update_is_directory(true, 'forums');
        do_action('bbpress_init');
        // Check to see if the user has posted a new topic from the forums page.
        if (isset($_POST['submit_topic']) && bp_is_active('forums')) {
            check_admin_referer('bp_forums_new_topic');
            $bp->groups->current_group = groups_get_group(array('group_id' => $_POST['topic_group_id']));
            if (!empty($bp->groups->current_group->id)) {
                // Auto join this user if they are not yet a member of this group
                if (!is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member($bp->loggedin_user->id, $bp->groups->current_group->id)) {
                    groups_join_group($bp->groups->current_group->id);
                }
                $error_message = '';
                $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
                if (!empty($forum_id)) {
                    if (empty($_POST['topic_title'])) {
                        $error_message = __('Please provide a title for your forum topic.', 'buddypress');
                    } else {
                        if (empty($_POST['topic_text'])) {
                            $error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress');
                        }
                    }
                    if ($error_message) {
                        bp_core_add_message($error_message, 'error');
                        $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                    } else {
                        if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) {
                            bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error');
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                        } else {
                            bp_core_add_message(__('The topic was created successfully', 'buddypress'));
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/';
                        }
                    }
                    bp_core_redirect($redirect);
                } else {
                    bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                    bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
                }
            } else {
                bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
            }
        }
        do_action('bp_forums_directory_forums_setup');
        bp_core_load_template(apply_filters('bp_forums_template_directory_forums_setup', 'forums/index'));
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:58,代码来源:bp-forums-screens.php


示例5: bp_core_exclude_pages

/**
 * bp_core_exclude_pages()
 *
 * Excludes specific pages from showing on page listings, for example the "Activation" page.
 *
 * @package BuddyPress Core
 * @uses bp_is_active() checks if a BuddyPress component is active.
 * @return array The list of page ID's to exclude
 */
function bp_core_exclude_pages($pages)
{
    global $bp;
    if (!empty($bp->pages->activate)) {
        $pages[] = $bp->pages->activate->id;
    }
    if (!empty($bp->pages->register)) {
        $pages[] = $bp->pages->register->id;
    }
    if (!empty($bp->pages->forums) && (!bp_is_active('forums') || bp_is_active('forums') && bp_forums_has_directory() && !bp_forums_is_installed_correctly())) {
        $pages[] = $bp->pages->forums->id;
    }
    return apply_filters('bp_core_exclude_pages', $pages);
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:23,代码来源:bp-core-filters.php


示例6: groups_update_group_forum

/**
 * Update group forum metadata (title, description, slug) when the group's details are edited.
 *
 * @since BuddyPress (1.1.0)
 *
 * @param int $group_id Group id, passed from groups_details_updated.
 */
function groups_update_group_forum($group_id)
{
    $group = groups_get_group(array('group_id' => $group_id));
    /**
     * Bail in the following three situations:
     *  1. Forums are not enabled for this group
     *  2. The BP Forum component is not enabled
     *  3. The built-in bbPress forums are not correctly installed (usually means they've been
     *     uninstalled)
     */
    if (empty($group->enable_forum) || !bp_is_active('forums') || function_exists('bp_forums_is_installed_correctly') && !bp_forums_is_installed_correctly()) {
        return false;
    }
    bp_forums_update_forum(apply_filters('groups_update_group_forum', array('forum_id' => groups_get_groupmeta($group_id, 'forum_id'), 'forum_name' => $group->name, 'forum_desc' => $group->description, 'forum_slug' => $group->slug)));
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:22,代码来源:bp-groups-forums.php


示例7: bp_core_exclude_pages

/**
 * Prevent specific pages (eg 'Activate') from showing on page listings.
 *
 * @uses bp_is_active() checks if a BuddyPress component is active.
 *
 * @param array $pages List of excluded page IDs, as passed to the
 *        'wp_list_pages_excludes' filter.
 * @return array The exclude list, with BP's pages added.
 */
function bp_core_exclude_pages($pages = array())
{
    // Bail if not the root blog
    if (!bp_is_root_blog()) {
        return $pages;
    }
    $bp = buddypress();
    if (!empty($bp->pages->activate)) {
        $pages[] = $bp->pages->activate->id;
    }
    if (!empty($bp->pages->register)) {
        $pages[] = $bp->pages->register->id;
    }
    if (!empty($bp->pages->forums) && (!bp_is_active('forums') || bp_is_active('forums') && bp_forums_has_directory() && !bp_forums_is_installed_correctly())) {
        $pages[] = $bp->pages->forums->id;
    }
    return apply_filters('bp_core_exclude_pages', $pages);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:27,代码来源:bp-core-filters.php


示例8: bp_forums_directory_forums_setup

function bp_forums_directory_forums_setup() {
	global $bp;

	if ( $bp->current_component == $bp->forums->slug ) {
		if ( (int) $bp->site_options['bp-disable-forum-directory'] || !function_exists( 'groups_install' ) )
			return false;

		if ( !bp_forums_is_installed_correctly() ) {
			bp_core_add_message( __( 'The forums component has not been set up yet.', 'buddypress' ), 'error' );
			bp_core_redirect( $bp->root_domain );
		}

		$bp->is_directory = true;

		do_action( 'bbpress_init' );

		/* Check to see if the user has posted a new topic from the forums page. */
		if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic' ) ) {
			/* Check the nonce */
			check_admin_referer( 'bp_forums_new_topic' );

			if ( $bp->groups->current_group = groups_get_group( array( 'group_id' => $_POST['topic_group_id'] ) ) ) {
				/* Auto join this user if they are not yet a member of this group */
				if ( !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
					groups_join_group( $bp->groups->current_group->id, $bp->groups->current_group->id );

				if ( $forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) ) {
					if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) )
						bp_core_add_message( __( 'There was an error when creating the topic', 'buddypress'), 'error' );
					else
						bp_core_add_message( __( 'The topic was created successfully', 'buddypress') );

					bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->topic_slug . '/' );
				} else {
					bp_core_add_message( __( 'Please pick the group forum where you would like to post this topic.', 'buddypress' ), 'error' );
				}
			}
		}

		do_action( 'bp_forums_directory_forums_setup' );

		bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'forums/index' ) );
	}
}
开发者ID:n-sane,项目名称:zaroka,代码行数:44,代码来源:bp-forums.php


示例9: setup_nav

 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     // Stop if forums haven't been set up yet
     if (!bp_forums_is_installed_correctly()) {
         return;
     }
     // Stop if there is no user displayed or logged in
     if (!is_user_logged_in() && !bp_displayed_user_id()) {
         return;
     }
     // Add 'Forums' to the main navigation
     $main_nav = array('name' => __('Forums', 'buddypress'), 'slug' => $this->slug, 'position' => 80, 'screen_function' => 'bp_member_forums_screen_topics', 'default_subnav_slug' => 'topics', 'item_css_id' => $this->id);
     // Determine user to use
     if (isset($bp->displayed_user->domain)) {
         $user_domain = $bp->displayed_user->domain;
         $user_login = $bp->displayed_user->userdata->user_login;
     } elseif (isset($bp->loggedin_user->domain)) {
         $user_domain = $bp->loggedin_user->domain;
         $user_login = $bp->loggedin_user->userdata->user_login;
     } else {
         return;
     }
     // User link
     $forums_link = trailingslashit($user_domain . $this->slug);
     // Additional menu if friends is active
     $sub_nav[] = array('name' => __('Topics Started', 'buddypress'), 'slug' => 'topics', 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_member_forums_screen_topics', 'position' => 20, 'item_css_id' => 'topics');
     // Additional menu if friends is active
     $sub_nav[] = array('name' => __('Replied To', 'buddypress'), 'slug' => 'replies', 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_member_forums_screen_replies', 'position' => 40, 'item_css_id' => 'replies');
     // Favorite forums items. Disabled until future release.
     /*
     $sub_nav[] = array(
     	'name'            => __( 'Favorites', 'buddypress' ),
     	'slug'            => 'favorites',
     	'parent_url'      => $forums_link,
     	'parent_slug'     => $this->slug,
     	'screen_function' => 'bp_member_forums_screen_favorites',
     	'position'        => 60,
     	'item_css_id'     => 'favorites'
     );
     */
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:newington,项目名称:buddypress,代码行数:48,代码来源:bp-forums-loader.php


示例10: bp_forums_bbpress_admin

function bp_forums_bbpress_admin()
{
    global $bp;
    $action = bp_get_admin_url('admin.php?page=bb-forums-setup&reinstall=1');
    ?>

	<div class="wrap">
		<?php 
    screen_icon('buddypress');
    ?>

		<h2 class="nav-tab-wrapper"><?php 
    bp_core_admin_tabs(__('Forums', 'buddypress'));
    ?>
</h2>

		<?php 
    if (isset($_POST['submit'])) {
        ?>

			<div id="message" class="updated fade">
				<p><?php 
        _e('Settings Saved.', 'buddypress');
        ?>
</p>
			</div>

		<?php 
    }
    ?>

		<?php 
    if (isset($_REQUEST['reinstall']) || !bp_forums_is_installed_correctly()) {
        // Delete the bb-config.php location option
        bp_delete_option('bb-config-location');
        bp_forums_bbpress_install_wizard();
    } else {
        ?>

			<div style="width: 45%; float: left; margin-top: 20px;">
				<h3><?php 
        _e('(Installed)', 'buddypress');
        ?>
 <?php 
        _e('Forums for Groups', 'buddypress');
        ?>
</h3>

				<p><?php 
        _e('Give each individual group its own discussion forum. Choose this if you\'d like to keep your members\' conversations separated into distinct areas.', 'buddypress');
        ?>
</p>
				<p class="description"><?php 
        _e('You may use an existing bbPress installation if you have one.', 'buddypress');
        ?>
</p>

				<h4 style="margin-bottom: 10px;"><?php 
        _e('Features', 'buddypress');
        ?>
</h4>
				<ul class="description" style="list-style: square; margin-left: 30px;">
					<li><?php 
        _e('Group Integration', 'buddypress');
        ?>
</p></li>
					<li><?php 
        _e('Member Profile Integration', 'buddypress');
        ?>
</p></li>
					<li><?php 
        _e('Activity Stream Integration', 'buddypress');
        ?>
</p></li>
					<li><?php 
        _e('@ Mention Integration', 'buddypress');
        ?>
</p></li>
				</ul>

				<div>
					<a class="button button-primary" href="<?php 
        echo $action;
        ?>
"><?php 
        _e('Uninstall Group Forums', 'buddypress');
        ?>
</a> &nbsp;
				</div>
			</div>

			<div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;">
				<h3><?php 
        _e('New! Site Wide Forums', 'buddypress');
        ?>
</h3>
				<p><?php 
        _e('Your site will have central forums that are not isolated to any specific group. Choose this if you\'d like to have a central forum area for your members.', 'buddypress');
        ?>
</p>
//.........这里部分代码省略.........
开发者ID:hornetalcala,项目名称:trunk,代码行数:101,代码来源:bp-forums-admin.php


示例11: groups_screen_group_forum

/**
 * This screen function handles actions related to group forums.
 */
function groups_screen_group_forum()
{
    if (!bp_is_active('forums') || !bp_forums_is_installed_correctly()) {
        return false;
    }
    if (bp_action_variable(0) && !bp_is_action_variable('topic', 0)) {
        bp_do_404();
        return;
    }
    $bp = buddypress();
    if (!$bp->groups->current_group->user_has_access) {
        bp_core_no_access();
        return;
    }
    if (!bp_is_single_item()) {
        return false;
    }
    // Fetch the details we need.
    $topic_slug = (string) bp_action_variable(1);
    $topic_id = bp_forums_get_topic_id_from_slug($topic_slug);
    $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
    $user_is_banned = false;
    if (!bp_current_user_can('bp_moderate') && groups_is_user_banned(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
        $user_is_banned = true;
    }
    if (!empty($topic_slug) && !empty($topic_id)) {
        // Posting a reply.
        if (!$user_is_banned && !bp_action_variable(2) && isset($_POST['submit_reply'])) {
            // Check the nonce.
            check_admin_referer('bp_forums_new_reply');
            // Auto join this user if they are not yet a member of this group.
            if (bp_groups_auto_join() && !bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
                groups_join_group($bp->groups->current_group->id, bp_loggedin_user_id());
            }
            $topic_page = isset($_GET['topic_page']) ? $_GET['topic_page'] : false;
            // Don't allow reply flooding.
            if (bp_forums_reply_exists($_POST['reply_text'], $topic_id, bp_loggedin_user_id())) {
                bp_core_add_message(__('It looks like you\'ve already said that!', 'buddypress'), 'error');
            } else {
                if (!($post_id = groups_new_group_forum_post($_POST['reply_text'], $topic_id, $topic_page))) {
                    bp_core_add_message(__('There was an error when replying to that topic', 'buddypress'), 'error');
                } else {
                    bp_core_add_message(__('Your reply was posted successfully', 'buddypress'));
                }
            }
            $query_vars = isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '';
            $redirect = bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic_slug . '/' . $query_vars;
            if (!empty($post_id)) {
                $redirect .= '#post-' . $post_id;
            }
            bp_core_redirect($redirect);
        } elseif (bp_is_action_variable('stick', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
            // Check the nonce.
            check_admin_referer('bp_forums_stick_topic');
            if (!bp_forums_sticky_topic(array('topic_id' => $topic_id))) {
                bp_core_add_message(__('There was an error when making that topic a sticky', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('The topic was made sticky successfully', 'buddypress'));
            }
            /**
             * Fires after a group forum topic has been stickied.
             *
             * @since 1.1.0
             *
             * @param int $topic_id ID of the topic being stickied.
             */
            do_action('groups_stick_forum_topic', $topic_id);
            bp_core_redirect(wp_get_referer());
        } elseif (bp_is_action_variable('unstick', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
            // Check the nonce.
            check_admin_referer('bp_forums_unstick_topic');
            if (!bp_forums_sticky_topic(array('topic_id' => $topic_id, 'mode' => 'unstick'))) {
                bp_core_add_message(__('There was an error when unsticking that topic', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('The topic was unstuck successfully', 'buddypress'));
            }
            /**
             * Fires after a group forum topic has been un-stickied.
             *
             * @since 1.1.0
             *
             * @param int $topic_id ID of the topic being un-stickied.
             */
            do_action('groups_unstick_forum_topic', $topic_id);
            bp_core_redirect(wp_get_referer());
        } elseif (bp_is_action_variable('close', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
            // Check the nonce.
            check_admin_referer('bp_forums_close_topic');
            if (!bp_forums_openclose_topic(array('topic_id' => $topic_id))) {
                bp_core_add_message(__('There was an error when closing that topic', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('The topic was closed successfully', 'buddypress'));
            }
            /**
             * Fires after a group forum topic has been closed.
             *
             * @since 1.1.0
//.........这里部分代码省略.........
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:101,代码来源:bp-groups-screens.php


示例12: bp_search_form_type_select

/**
 * Generates the basic search form as used in BP-Default's header.
 *
 * @global object $bp BuddyPress global settings
 * @return string HTML <select> element
 * @since 1.0
 */
function bp_search_form_type_select()
{
    global $bp;
    $options = array();
    if (bp_is_active('xprofile')) {
        $options['members'] = __('Members', 'buddypress');
    }
    if (bp_is_active('groups')) {
        $options['groups'] = __('Groups', 'buddypress');
    }
    if (bp_is_active('blogs') && is_multisite()) {
        $options['blogs'] = __('Blogs', 'buddypress');
    }
    if (bp_is_active('forums') && bp_forums_is_installed_correctly() && bp_forums_has_directory()) {
        $options['forums'] = __('Forums', 'buddypress');
    }
    $options['posts'] = __('Posts', 'buddypress');
    // Eventually this won't be needed and a page will be built to integrate all search results.
    $selection_box = '<label for="search-which" class="accessibly-hidden">' . __('Search these:', 'buddypress') . '</label>';
    $selection_box .= '<select name="search-which" id="search-which" style="width: auto">';
    $options = apply_filters('bp_search_form_type_select_options', $options);
    foreach ((array) $options as $option_value => $option_title) {
        $selection_box .= sprintf('<option value="%s">%s</option>', $option_value, $option_title);
    }
    $selection_box .= '</select>';
    return apply_filters('bp_search_form_type_select', $selection_box);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:34,代码来源:bp-core-template.php


示例13: bp_is_group_forum

/**
 * Is the current page a group's forum page?
 *
 * Only applies to legacy bbPress forums.
 *
 * @since 1.1.0
 *
 * @return bool True if the current page is a group forum page.
 */
function bp_is_group_forum()
{
    $retval = false;
    // At a forum URL.
    if (bp_is_single_item() && bp_is_groups_component() && bp_is_current_action('forum')) {
        $retval = true;
        // If at a forum URL, set back to false if forums are inactive, or not
        // installed correctly.
        if (!bp_is_active('forums') || !bp_forums_is_installed_correctly()) {
            $retval = false;
        }
    }
    return $retval;
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:23,代码来源:bp-core-template.php


示例14: bp_group_show_invite_status_setting

						</label>

						<label>
							<input type="radio" name="group-invite-status" value="admins"<?php 
    bp_group_show_invite_status_setting('admins');
    ?>
 />
							<strong><?php 
    _e('Group admins only', 'buddypress');
    ?>
</strong>
						</label>
					</div>

					<?php 
    if (bp_is_active('forums') && bp_forums_is_installed_correctly()) {
        ?>

						<h4><?php 
        _e('Group Forums', 'buddypress');
        ?>
</h4>

						<p><?php 
        _e('Should this group have a forum?', 'buddypress');
        ?>
</p>

						<div class="checkbox">
							<label><input type="checkbox" name="group-show-forum" id="group-show-forum" value="1"<?php 
        checked(bp_get_new_group_enable_forum(), true, true);
开发者ID:naomicbush,项目名称:bp-default,代码行数:31,代码来源:create.php


示例15: bp_forums_load_bbpress

/**
 * Bootstrap bbPress 1.x, and manipulate globals to integrate with BuddyPress.
 *
 * @return bool|null Returns false on failure.
 */
function bp_forums_load_bbpress()
{
    global $wpdb, $wp_roles, $current_user, $wp_users_object;
    global $bb, $bbdb, $bb_table_prefix, $bb_current_user;
    global $bb_roles, $wp_taxonomy_object, $bb_queries;
    // Return if we've already run this function.
    if (is_object($bbdb)) {
        return;
    }
    if (!bp_forums_is_installed_correctly()) {
        return false;
    }
    $bp = buddypress();
    define('BB_PATH', $bp->plugin_dir . '/bp-forums/bbpress/');
    define('BACKPRESS_PATH', $bp->plugin_dir . '/bp-forums/bbpress/bb-includes/backpress/');
    define('BB_URL', $bp->plugin_url . 'bp-forums/bbpress/');
    define('BB_INC', 'bb-includes/');
    require BB_PATH . BB_INC . 'class.bb-query.php';
    require BB_PATH . BB_INC . 'class.bb-walker.php';
    require BB_PATH . BB_INC . 'functions.bb-core.php';
    require BB_PATH . BB_INC . 'functions.bb-forums.php';
    require BB_PATH . BB_INC . 'functions.bb-topics.php';
    require BB_PATH . BB_INC . 'functions.bb-posts.php';
    require BB_PATH . BB_INC . 'functions.bb-topic-tags.php';
    require BB_PATH . BB_INC . 'functions.bb-capabilities.php';
    require BB_PATH . BB_INC . 'functions.bb-meta.php';
    require BB_PATH . BB_INC . 'functions.bb-pluggable.php';
    require BB_PATH . BB_INC . 'functions.bb-formatting.php';
    require BB_PATH . BB_INC . 'functions.bb-template.php';
    require BACKPRESS_PATH . 'class.wp-taxonomy.php';
    require BB_PATH . BB_INC . 'class.bb-taxonomy.php';
    require BB_PATH . 'bb-admin/includes/functions.bb-admin.php';
    $bb = new stdClass();
    require bp_get_option('bb-config-location');
    // Setup the global database connection
    $bbdb = new BPDB(BBDB_USER, BBDB_PASSWORD, BBDB_NAME, BBDB_HOST);
    // Set the table names
    $bbdb->forums = $bb_table_prefix . 'forums';
    $bbdb->meta = $bb_table_prefix . 'meta';
    $bbdb->posts = $bb_table_prefix . 'posts';
    $bbdb->terms = $bb_table_prefix . 'terms';
    $bbdb->term_relationships = $bb_table_prefix . 'term_relationships';
    $bbdb->term_taxonomy = $bb_table_prefix . 'term_taxonomy';
    $bbdb->topics = $bb_table_prefix . 'topics';
    if (isset($bb->custom_user_table)) {
        $bbdb->users = $bb->custom_user_table;
    } else {
        $bbdb->users = $wpdb->users;
    }
    if (isset($bb->custom_user_meta_table)) {
        $bbdb->usermeta = $bb->custom_user_meta_table;
    } else {
        $bbdb->usermeta = $wpdb->usermeta;
    }
    $bbdb->prefix = $bb_table_prefix;
    define('BB_INSTALLING', false);
    if (is_object($wp_roles)) {
        $bb_roles = $wp_roles;
        bb_init_roles($bb_roles);
    }
    /**
     * Fires during the bootstrap setup for bbPress 1.x.
     *
     * @since 1.1.0
     */
    do_action('bb_got_roles');
    /**
     * Fires during the bootstrap setup for bbPress 1.x.
     *
     * @since 1.1.0
     */
    do_action('bb_init');
    /**
     * Fires during the bootstrap setup for bbPress 1.x.
     *
     * @since 1.1.0
     */
    do_action('init_roles');
    $bb_current_user = $current_user;
    $wp_users_object = new BP_Forums_BB_Auth();
    if (!isset($wp_taxonomy_object)) {
        $wp_taxonomy_object = new BB_Taxonomy($bbdb);
    }
    $wp_taxonomy_object->register_taxonomy('bb_topic_tag', 'bb_topic');
    // Set a site id if there isn't one already
    if (!isset($bb->site_id)) {
        $bb->site_id = bp_get_root_blog_id();
    }
    // Check if the tables are installed, if not, install them
    if (!($tables_installed = (bool) $bbdb->get_results('DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A))) {
        require BB_PATH . 'bb-admin/includes/defaults.bb-schema.php';
        // Backticks and "IF NOT EXISTS" break the dbDelta function.
        bp_bb_dbDelta(str_replace(' IF NOT EXISTS', '', str_replace('`', '', $bb_queries)));
        require BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php';
        bb_update_db_version();
//.........这里部分代码省略.........
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:101,代码来源:bp-forums-bbpress-sa.php


示例16: groups_screen_group_forum

/**
 * This screen function handles actions related to group forums
 *
 * @package BuddyPress
 */
function groups_screen_group_forum()
{
    global $bp;
    if (!bp_is_active('forums') || !bp_forums_is_installed_correctly()) {
        return false;
    }
    if (bp_action_variable(0) && !bp_is_action_variable('topic', 0)) {
        bp_do_404();
        return;
    }
    if (!$bp->groups->current_group->user_has_access) {
        bp_core_no_access();
        return;
    }
    if (bp_is_single_item()) {
        // Fetch the details we need
        $topic_slug = (string) bp_action_variable(1);
        $topic_id = bp_forums_get_topic_id_from_slug($topic_slug);
        $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
        $user_is_banned = false;
        if (!bp_current_user_can('bp_moderate') && groups_is_user_banned(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
            $user_is_banned = true;
        }
        if (!empty($topic_slug) && !empty($topic_id)) {
            // Posting a reply
            if (!$user_is_banned && !bp_action_variable(2) && isset($_POST['submit_reply'])) {
                // Check the nonce
                check_admin_referer('bp_forums_new_reply');
                // Auto join this user if they are not yet a member of this group
                if (bp_groups_auto_join() && !bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
                    groups_join_group($bp->groups->current_group->id, bp_loggedin_user_id());
                }
                $topic_page = isset($_GET['topic_page']) ? $_GET['topic_page'] : false;
                if (!($post_id = groups_new_group_forum_post($_POST['reply_text'], $topic_id, $topic_page))) {
                    bp_core_add_message(__('There was an error when replying to that topic', 'buddypress'), 'error');
                } else {
                    bp_core_add_message(__('Your reply was posted successfully', 'buddypress'));
                }
                if (isset($_SERVER['QUERY_STRING'])) {
                    $query_vars = '?' . $_SERVER['QUERY_STRING'];
                }
                bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id);
            } else {
                if (bp_is_action_variable('stick', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) {
                    // Check the nonce
                    check_admin_referer('bp_forums_stick_topic');
                    if (!bp_forums_sticky_topic(array('topic_id' => $topic_id))) {
                        bp_core_add_message(__('There was an error when making that topic a sticky', 'buddypress'), 'error');
                    } else {
                        bp_core_add_message(__('The topic was made sticky successfully', 'buddypress'));
                    }
                    do_action('groups_stick_forum_topic', $topic_id);
                    bp_core_redirect(wp_get_referer());
                } else {
                    if (bp_is_action_variable('unstick', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) {
                        // Check the nonce
                        check_admin_referer('bp_forums_unstick_topic');
                        if (!bp_forums_sticky_topic(array('topic_id' => $topic_id, 'mode' => 'unstick'))) {
                            bp_core_add_message(__('There was an error when unsticking that topic', 'buddypress'), 'error');
                        } else {
                            bp_core_add_message(__('The topic was unstuck successfully', 'buddypress'));
                        }
                        do_action('groups_unstick_forum_topic', $topic_id);
                        bp_core_redirect(wp_get_referer());
                    } else {
                        if (bp_is_action_variable('close', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) {
                            // Check the nonce
                            check_admin_referer('bp_forums_close_topic');
                            if (!bp_forums_openclose_topic(array('topic_id' => $topic_id))) {
                                bp_core_add_message(__('There was an error when closing that topic', 'buddypress'), 'error');
                            } else {
                                bp_core_add_message(__('The topic was closed successfully', 'buddypress'));
                            }
                            do_action('groups_close_forum_topic', $topic_id);
                            bp_core_redirect(wp_get_referer());
                        } else {
                            if (bp_is_action_variable('open', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) {
                                // Check the nonce
                                check_admin_referer('bp_forums_open_topic');
                                if (!bp_forums_openclose_topic(array('topic_id' => $topic_id, 'mode' => 'open'))) {
                                    bp_core_add_message(__('There was an error when opening that topic', 'buddypress'), 'error');
                                } else {
                                    bp_core_add_message(__('The topic was opened successfully', 'buddypress'));
                                }
                                do_action('groups_open_forum_topic', $topic_id);
                                bp_core_redirect(wp_get_referer());
                            } else {
                                if (empty($user_is_banned) && bp_is_action_variable('delete', 2) && !bp_action_variable(3)) {
                                    // Fetch the topic
                                    $topic = bp_forums_get_topic_details($topic_id);
                                    /* Check the logged in user can delete this topic */
                                    if (!$bp->is_item_admin && !$bp->is_item_mod && (int) bp_loggedin_user_id() != (int) $topic->topic_poster) {
                                        bp_core_redirect(wp_get_referer());
                                    }
                                    // Check the nonce
//.........这里部分代码省略.........
开发者ID:newington,项目名称:buddypress,代码行数:101,代码来源:bp-groups-screens.php


示例17: register_admin_settings

 /**
  * Register the settings
  *
  * @since BuddyPress (1.6)
  *
  * @uses add_settings_section() To add our own settings section
  * @uses add_settings_field() To add various settings fields
  * @uses register_setting() To register various settings
  * @uses do_action() Calls 'bp_register_admin_settings'
  */
 public function register_admin_settings()
 {
     /** Main Section ******************************************************/
     // Add the main section
     add_settings_section('bp_main', __('Main Settings', 'buddypress'), 'bp_admin_setting_callback_main_section', 'buddypress');
     // Hide toolbar for logged out users setting
     add_settings_field('hide-loggedout-adminbar', __('Toolbar', 'buddypress'), 'bp_admin_setting_callback_admin_bar', 'buddypress', 'bp_main');
     register_setting('buddypress', 'hide-loggedout-adminbar', 'intval');
     // Only show 'switch to Toolbar' option if the user chose to retain the BuddyBar during the 1.6 upgrade
     if ((bool) bp_get_option('_bp_force_buddybar', false)) {
         add_settings_field('_bp_force_buddybar', __('Toolbar', 'buddypress'), 'bp_admin_setting_callback_force_buddybar', 'buddypress', 'bp_main');
         register_setting('buddypress', '_bp_force_buddybar', 'bp_admin_sanitize_callback_force_buddybar');
     }
     // Allow account deletion
     add_settings_field('bp-disable-account-deletion', __('Account Deletion', 'buddypress'), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_main');
     register_setting('buddypress', 'bp-disable-account-deletion', 'intval');
     /** XProfile Section **************************************************/
     if (bp_is_active('xprofile')) {
         // Add the main section
         add_settings_section('bp_xprofile', __('Profile Settings', 'buddypress'), 'bp_admin_setting_callback_xprofile_section', 'buddypress');
         // Allow avatar uploads
         add_settings_field('bp-disable-avatar-uploads', __('Avatar Uploads', 'buddypress'), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_xprofile');
         register_setting('buddypress', 'bp-disable-avatar-uploads', 'intval');
         // Profile sync setting
         add_settings_field('bp-disable-profile-sync', __('Profile Syncing', 'buddypress'), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_xprofile');
         register_setting('buddypress', 'bp-disable-profile-sync', 'intval');
     }
     /** Groups Section ****************************************************/
     if (bp_is_active('groups')) {
         // Add the main section
         add_settings_section('bp_groups', __('Groups Settings', 'buddypress'), 'bp_admin_setting_callback_groups_section', 'buddypress');
         // Allow subscriptions setting
         add_settings_field('bp_restrict_group_creation', __('Group Creation', 'buddypress'), 'bp_admin_setting_callback_group_creation', 'buddypress', 'bp_groups');
         register_setting('buddypress', 'bp_restrict 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP bp_get_activation_page函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_forums_has_directory函数代码示例发布时间: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