bp_add_activation_redirect ()

在激活后,重定向用户到BP的什么是新的页面加载第一页。

描述

文件:bp-core / bp-core-update.php

function bp_add_activation_redirect(){//如果从网络激活,或批量。if (isset($_GET['activate-multi'])) {return;} //记录这是一个新的安装,因此我们显示正确的欢迎消息。If (bp_is_install()) {set_transient('_bp_is_new_install', true, 30);} // Check in Current DB having a below 2 options are saved for the BBPress Topic & Topic Reply before . //在当前DB中有一个以下2个选项。$topic_slug = get_option('_bbp_topic_slug');$topic_tag_slug = get_option('_bbp_topic_tag_slug');$topic_archive_slug = get_option('_bbp_topic_archive_slug');if (empty($topic_slug)){//检查DB中是否有topic。$topics = get_posts(array('post_type' => 'topic', 'numberposts' => 1)); // If found the topics then go ahead. if ( !empty( $topics ) ) { // Topics found so set the _bbp_topic_slug to "topic" instead of "discussion" otherwise it will create the issue who used previously BBPress. update_option( '_bbp_topic_slug', 'topic'); // Set Flag to enable Forums default. update_option( 'bbp_set_forum_to_default', 'yes'); // Get current active component. $bp_active_components = get_option( 'bp-active-components', array() ); if ( ! in_array( 'forums', $bp_active_components) ) { // Add Forums to current components. $bp_active_components['forums'] = 1; // Set the forums to in DB. bp_update_option( 'bp-active-components', $bp_active_components ); } // If Forums page is not set. $option = bp_get_option( '_bbp_root_slug_custom_slug', '' ); if ( '' === $option ) { $default_title = bp_core_get_directory_page_default_titles(); $title = ( isset( $default_title['new_forums_page'] ) ) ? $default_title['new_forums_page'] : ''; $new_page = array( 'post_title' => $title, 'post_status' => 'publish', 'post_author' => bp_loggedin_user_id(), 'post_type' => 'page', 'comment_status' => 'closed', 'ping_status' => 'closed', ); // Create Forums Page. $page_id = wp_insert_post( $new_page ); bp_update_option( '_bbp_root_slug_custom_slug', $page_id ); $slug = get_post_field( 'post_name', $page_id ); // Set BBPress root Slug bp_update_option( '_bbp_root_slug', $slug ); } // Reset the permalink. bp_update_option( 'rewrite_rules', '' ); } if ( empty( $topic_archive_slug ) ) { update_option( '_bbp_topic_archive_slug', 'topics'); } if ( empty( $topic_tag_slug ) ) { // Tags found so set the _bbp_topic_tag_slug to "topic-reply" instead of "discussion-reply" otherwise it will create the issue who used previously BBPress. update_option( '_bbp_topic_tag_slug', 'topic-tag'); } } // Add the transient to redirect. set_transient( '_bp_activation_redirect', true, 30 ); }

更新日志

更新日志
版本 描述
BuddyPress 1.7.0 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队