// ايقاف التحدث التلقائي add_filter('auto_update_core', '__return_false'); //add_filter('auto_update_plugin', '__return_false'); //add_filter('auto_update_theme', '__return_false'); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function lg_support_form($fields, $entry, $form_data, $entry_id){ if ( absint( $form_data['id'] ) == 29601 ) { $entry = wpforms()->entry->get( $entry_id ); foreach ( $fields as $field ) { if ( $field['name'] == 'الاسم' ) $full_name = $field['value']; if ( $field['name'] == 'البريد الالكتروني للعضوية' ) $email = $field['value']; if ( $field['name'] == 'التصنيف' ) $type = $field['value']; if ( $field['name'] == 'وصف المشكلة' ) $description = $field['value']; //if ( $field['name'] == 'المرفقات' ) $files = $field['value']; } $contactApi = FluentCrmApi('contacts'); $data = [ 'full_name' => $full_name, 'email' => $email, // requied 'type' => $type, 'description' => $description, //'attachments', $files, 'status' => 'Subscribed', 'tags' => ['10'], 'lists' => ['10'] ]; $contact = $contactApi->createOrUpdate($data); } } add_action( 'wpforms_process_complete', 'lg_support_form', 10, 4 ); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // كود ارسال رابط التحقق عبر الوتساب function lg_dev_process_complete($fields, $entry, $form_data, $entry_id){ if ( absint( $form_data['id'] ) == 25729 || absint( $form_data['id'] ) == 27128 || absint( $form_data['id'] ) == 29066 ) { $entry = wpforms()->entry->get( $entry_id ); foreach ( $fields as $field ) { if ( $field['name'] == 'رقم الجوال' ) $phone_number = $field['value']; if ( $field['name'] == 'البريد الإلكتروني' ) $email = $field['value']; if ( $field['name'] == 'رقم الهوية الوطنية' ) $nationalId = $field['value']; if ( $field['name'] == 'السجل التجاري' ) $commercialRegister = $field['value']; if ( $field['name'] == 'المؤسسة/الشركة' ){ $full_name = $field['value']; $lists = 2; $tags = 1; $is_company = '1'; } if ( $field['name'] == 'الاسم الكامل' ){ $full_name = $field['value']; $lists = 3; $tags = 2; $is_company = '0'; } } $contactApi = FluentCrmApi('contacts'); $data = [ 'full_name' => $full_name, 'email' => $email, 'status' => 'Subscribed', 'tags' => [$tags], 'lists' => [$lists] ]; $contact = $contactApi->createOrUpdate($data); $user = get_user_by('email', "$email"); if ($user) { $user_id = $user->ID; if (!metadata_exists('user', $user_id, 'is_company')) { update_user_meta($user_id, 'is_company', $is_company); } if ($is_company === '1') { if (!metadata_exists('user', $user_id, 'commercial_register')) { update_user_meta($user_id, 'commercial_register', $commercialRegister); } } else { if (!metadata_exists('user', $user_id, 'national_id')) { update_user_meta($user_id, 'national_id', $nationalId); } } } $activate_code = get_user_meta($user->ID, 'wpforms-activate', true); $activate_link = "https://aqar.net.sa/?wpforms_activate=$activate_code"; $otp = $activate_link; $send_number = $phone_number; $url = "https://botsailor.com/api/v1/whatsapp/send/template?apiToken=12387%7CeX5dFlCMyLSlmMBBx6wT0epTdVDzBMDLV9ZXNJC142315a73&phone_number_id=384790231386405&template_id=118761&templateVariable-otp-1={$otp}&phone_number={$send_number}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); curl_close($ch); $response_data = json_decode($response, true); if (isset($response_data['status']) && $response_data['status'] == 0) { wp_redirect('https://aqar.net.sa/verification-unsuccessful/'); exit; } } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // بعد نجاح التسجيل يتم إنشاء صفحة للعضو function lg_register_process_complete($fields, $entry, $form_data, $entry_id){ if ( absint( $form_data['id'] ) == 29066 ) { // User Registration Form - Agency $entry = wpforms()->entry->get( $entry_id ); foreach ( $fields as $field ) { if ( $field['name'] == 'رقم الجوال' ) $phone_number = $field['value']; if ( $field['name'] == 'البريد الإلكتروني' ) $email = $field['value']; if ( $field['name'] == 'المؤسسة/الشركة' ) $co_name = $field['value']; } $user = get_user_by('email', "$email"); // Create post object $args = array( 'post_title' => $co_name, 'post_type' => 'houzez_agency', 'post_status' => 'publish' ); // Insert the post into the database $post_id = wp_insert_post( $args ); update_post_meta( $post_id, 'houzez_user_meta_id', $user->id); // used when agent custom post type updated update_user_meta( $user->id, 'fave_author_agency_id', $post_id); update_post_meta( $post_id, 'fave_agency_email', $email) ; update_post_meta( $post_id, 'fave_agency_phone', $phone_number); if( houzez_option('realtor_visible', 0) ) { update_post_meta( $post_id, 'fave_agency_visible', 1); } }elseif( absint( $form_data['id'] ) == 25729 ){ // User Registration Form - Agent $entry = wpforms()->entry->get( $entry_id ); foreach ( $fields as $field ) { if ( $field['name'] == 'رقم الجوال' ) $phone_number = $field['value']; if ( $field['name'] == 'البريد الإلكتروني' ) $email = $field['value']; if ( $field['name'] == 'الاسم الكامل' ) $co_name = $field['value']; } $user = get_user_by('email', "$email"); // Create post object $args = array( 'post_title' => $co_name, 'post_type' => 'houzez_agent', 'post_status' => 'publish' ); // Insert the post into the database $post_id = wp_insert_post( $args ); update_post_meta( $post_id, 'houzez_user_meta_id', $user->id); // used when agent custom post type updated update_user_meta( $user->id, 'fave_author_agent_id', $post_id); update_post_meta( $post_id, 'fave_agent_email', $email) ; update_post_meta( $post_id, 'fave_agent_mobile', $phone_number); if( houzez_option('realtor_visible', 0) ) { update_post_meta( $post_id, 'fave_agent_visible', 1); } } } add_action( 'wpforms_process_complete', 'lg_register_process_complete', 10, 4 ); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // اكواد للتاكد من بيانات تسجيل العضو وانه ايضا ليس ضمن قائمة الحظر add_action( 'wpforms_process_before', 'la_phone_number_check_before_registration', 1, 4 ); // اكواد للتاكد من بيانات تسجيل العضو وانه ايضا ليس ضمن قائمة الحظر add_action( 'wpforms_process_before', 'la_phone_number_check_before_registration', 1, 4 ); function la_phone_number_check_before_registration( $entry, $form_data ) { if (is_page('تسجيل - مؤسسة عقارية') || is_page('تسجيل - وسيط عقارى')) { $national_identification_number = $_COOKIE['nationalId']; $error_m = "نعتذر عن عدم إمكانية قبول عضويتكم في المنصة لحين مراجعة الهيئة العامة للعقار."; if ( absint( $form_data[ 'id' ] ) == 25729) { $phone_number = $entry['fields'][9]; $firstname = $entry['fields'][12]; $lastname = $entry['fields'][8]; $username = $entry['fields'][2]; //$national_identification_number = $entry['fields'][10]; if (!preg_match('/^[\p{Arabic}\s]{3,}$/u', $firstname)) { wpforms()->process->errors[$form_data['id']]['header'] = __('يجب أن يحتوي حقل الاسم الكامل على حروف عربية فقط وبحد أدنى 3 حروف.', 'wpforms'); } /* if (!preg_match('/^[\p{Arabic}\s]{3,}$/u', $lastname)) { wpforms()->process->errors[$form_data['id']]['header'] = __('يجب أن يحتوي حقل اسم العائلة على حروف عربية فقط وبحد أدنى 3 حروف.', 'wpforms'); } */ if (!preg_match('/^[a-zA-Z0-9\s]+$/', $username)) { wpforms()->process->errors[$form_data['id']]['header'] = __('يجب أن يحتوي حقل اسم المستخدم على حروف انجليزية فقط.', 'wpforms'); } } else if(absint( $form_data[ 'id' ] ) == 27128){ $phone_number = $entry['fields'][8]; } else if(absint( $form_data[ 'id' ] ) == 29066){ $phone_number = $entry['fields'][9]; $co_name = $entry['fields'][12]; $username = $entry['fields'][2]; //$national_identification_number = $entry['fields'][10]; $commercial_register_number = $entry['fields'][14]; //var_dump($entry['fields']); if (!preg_match('/^[\p{Arabic}\s]{3,}$/u', $co_name)) { wpforms()->process->errors[$form_data['id']]['header'] = __('يجب أن يحتوي حقل المؤسسة/الشركة على حروف عربية فقط وبحد أدنى 3 حروف.', 'wpforms'); } if (!preg_match('/^[a-zA-Z0-9\s]+$/', $username)) { wpforms()->process->errors[$form_data['id']]['header'] = __('يجب أن يحتوي حقل اسم المستخدم على حروف انجليزية فقط.', 'wpforms'); } if ( commercial_register_number_blocked( $commercial_register_number ) ) { wpforms()->process->errors[ $form_data['id'] ]['header'] = esc_html__($error_m, 'wpforms'); } } //Block uaers if ( phone_number_blocked( $phone_number ) ) { wpforms()->process->errors[ $form_data['id'] ]['header'] = esc_html__($error_m, 'wpforms'); } if ( national_identification_number_blocked( $national_identification_number ) ) { wpforms()->process->errors[ $form_data['id'] ]['header'] = esc_html__($error_m, 'wpforms'); } $pattern = '/^9665[0-9]{8}$/'; $preg_m = preg_match($pattern, $phone_number); if ($preg_m !== 1) { wpforms()->process->errors[ $form_data['id'] ]['header'] = esc_html__('رقم الجوال المدخل غير صحيح، يجب أن يبدأ بـ 9665 ويحتوي على 8 أرقام بعد ذلك.', 'wpforms'); } if ( phone_number_exists( $phone_number ) ) { wpforms()->process->errors[ $form_data['id'] ]['header'] = wp_kses( __('رقم الجوال موجود مسبقًا.
يبدو أنك تحاول التسجيل ببيانات موجودة مسبقاً. إذا كنت قد سجلت مسبقًا، يمكنك تسجيل الدخول مباشرةً من صفحة تسجيل الدخول.', 'wpforms'), array( 'a' => array( 'href' => array(), 'target' => array() ), 'br' => array() ) ); } add_action( 'wp_footer', 'la_count_down' ); } } function la_count_down(){ add_filter('pre_update_user_meta', function($value, $object_id, $meta_key) { if ($meta_key === 'rega_advertiserId' && !current_user_can('administrator')) { return get_user_meta($object_id, 'rega_advertiserId', true); // تمنع التعديل لغير المدير } return $value; }, 10, 3); add_filter('pre_update_user_meta', function($value, $object_id, $meta_key) { $blocked_keys = [ 'rega_advertiserId', 'national_id', 'commercial_registration_number', ]; if (in_array($meta_key, $blocked_keys) && !current_user_can('administrator')) { return get_user_meta($object_id, $meta_key, true); } return $value; }, 10, 3); ?>