Update from Git Manager GUI

This commit is contained in:
2026-03-30 20:41:48 +02:00
parent 605df075cd
commit 0efd52d893
4 changed files with 320 additions and 14 deletions

View File

@@ -125,18 +125,22 @@ class WBF_Setup {
$page_title = sanitize_text_field($_POST['page_title'] ?? 'Forum');
if ($create_page) {
$existing = get_posts(['post_type'=>'page','s'=>$page_title,'posts_per_page'=>1]);
if (empty($existing)) {
$page_id = wp_insert_post([
'post_title' => $page_title,
'post_content' => '[business_forum]',
'post_status' => 'publish',
'post_type' => 'page',
]);
if ($page_id) {
update_option('wbf_forum_page_id', $page_id);
$success = get_permalink($page_id);
}
global $wpdb;
$existing_id = $wpdb->get_var( $wpdb->prepare(
"SELECT ID FROM {$wpdb->posts} WHERE post_type = 'page' AND post_status = 'publish' AND post_content LIKE %s LIMIT 1",
'%[business_forum]%'
) );
if (empty($existing_id)) {
$page_id = wp_insert_post([
'post_title' => $page_title,
'post_content' => '[business_forum]',
'post_status' => 'publish',
'post_type' => 'page',
]);
if ($page_id) {
update_option('wbf_forum_page_id', $page_id);
$success = get_permalink($page_id);
}
} else {
$success = get_permalink($existing[0]->ID);
}