BBP_Forums_Group_Extension:: create_screen_save (group_id美元

在创建时保存群组论坛数据

描述

文件:bp-forums / groups.php

public function create_screen_save($group_id = 0) {// Nonce check if (!bbp_verify_nonce_request(“groups_create_save_”。$this->slug)) {bbp_add_error('bbp_create_group_forum_screen_save', __('ERROR: Are you sure you want to do that?', 'buddyboss'));返回;} //检查可能为空的group_id if (empty($group_id)) {$group_id = bp_get_new_group_id();} $create_forum = !empty($_POST['bbp-create-group-forum']) ?真:假;美元forum_id = 0;$forum_ids = bbp_get_group_forum_ids($group_id);If (!empty($forum_id)) $forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids; // Create a forum, or not switch ( $create_forum ) { case true : // Bail if initial content was already created if ( !empty( $forum_id ) ) return; // Set the default forum status switch ( bp_get_new_group_status() ) { case 'hidden' : $status = bbp_get_hidden_status_id(); break; case 'private' : $status = bbp_get_private_status_id(); break; case 'public' : default : $status = bbp_get_public_status_id(); break; } // Create the initial forum $forum_id = bbp_insert_forum( array( 'post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status ) ); // Run the BP-specific functions for new groups $this->new_forum( array( 'forum_id' => $forum_id ) ); // Update forum active groups_update_groupmeta( bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id, true ); // Toggle forum on $this->toggle_group_forum( bp_get_new_group_id(), true ); break; case false : // Forum was created but is now being undone if ( !empty( $forum_id ) ) { // Delete the forum wp_delete_post( $forum_id, true ); // Delete meta values groups_delete_groupmeta( bp_get_new_group_id(), 'forum_id' ); groups_delete_groupmeta( bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id ); // Toggle forum off $this->toggle_group_forum( bp_get_new_group_id(), false ); } break; } }

更新日志

更新日志
版本 描述
bbPress (r3465) 介绍了。

问题吗?

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