From 807b1d579656b4d8948d33c26a7f89dc259dcfff Mon Sep 17 00:00:00 2001 From: Daniel Reintanz <85614916+FreelancerAMP@users.noreply.github.com> Date: Mon, 24 Nov 2025 14:18:55 +0100 Subject: [PATCH] ADDED logic to create profil post if logged in user doesnt exist as profil post --- efabi_net_core.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 efabi_net_core.php diff --git a/efabi_net_core.php b/efabi_net_core.php new file mode 100644 index 0000000..02fda6c --- /dev/null +++ b/efabi_net_core.php @@ -0,0 +1,56 @@ + 'profil', + 'numberposts' => -1, + 'meta_query' => + array( + 'key' => 'user_id', + 'value' => $user->ID, + 'compare' => '=' + ) + ); + $profil = get_posts($args); + if (count($profil) == 0) { + // Kein Profil gefunden, neues Profil erstellen + $new_profil = array( + 'post_title' => $user->user_login, + 'post_status' => 'publish', + 'post_type' => 'profil', + ); + + $new_profil = wp_insert_post($new_profil); + add_post_meta($new_profil, 'user_id', $user->ID); + add_post_meta($new_profil, 'email', $user->user_email); + add_post_meta($new_profil, 'first_name', $user->first_name); + add_post_meta($new_profil, 'last_name', $user->last_name); + } + + } + } + +} + +new EfabiNetCore(); \ No newline at end of file