PATH:
home
/
letacommog
/
laindinois
/
OLD
/
wp-content
/
plugins
/
dwt-listing-rest-api
/
classes
<?php /* ---- Register Starts Here ----*/ add_action( 'rest_api_init', 'dwt_listing_register_api_hooks_post', 0 ); function dwt_listing_register_api_hooks_post() { register_rest_route( 'downtown/app', '/register/', array( 'methods' => WP_REST_Server::EDITABLE, 'callback' => 'dwt_listing_register_me_post', 'permission_callback' => function () { return dwt_listing_basic_auth(); }, ) ); } function dwt_listing_register_me_post( $request ) { $uid = $u_name = $user_name = $response = ''; $json_data = $request->get_json_params(); if( empty( $json_data ) || !is_array( $json_data ) ) { $response = array( 'success' => false, 'data' => '' , 'message' => __("Please fill out all fields.", "dwt-listing-api") ); return rest_ensure_response( $response ); } $output = array(); $name = (isset($json_data['name'])) ? $json_data['name'] : ''; $email = (isset($json_data['email'])) ? $json_data['email'] : ''; $password = (isset($json_data['password'])) ? $json_data['password'] : ''; if( $name == "" ) { $response = array( 'success' => false, 'data' => '' , 'message' => __("Please enter your name.", "dwt-listing-api") ); return $response; } if( $email == "" ) { $response = array( 'success' => false, 'data' => '' , 'message' => __("Please enter your email.", "dwt-listing-api") ); return $response; } if( $password == "" ) { $response = array( 'success' => false, 'data' => '' , 'message' => __("Please enter your password.", "dwt-listing-api") ); return $response; } if ( !is_email($email) ) { $response = array( 'success' => false, 'data' => '' , 'message' => __("Email address is not valid.", "dwt-listing-api") ); return $response; } if( email_exists( $email ) == true ) { $response = array( 'success' => false, 'data' => '' , 'message' => __("Email Already Exists.", "dwt-listing-api") ); return $response; } $user_name = explode( '@', $email); $u_name = dwt_listing_check_user_name( $user_name[0] ); $uid = wp_create_user( $u_name, $password, $email); wp_update_user( array( 'ID' => $uid, 'display_name' => $name) ); //if free package assign option is enabled global $dwt_listing_options; if(!empty($dwt_listing_options['dwt_listing_enable_packages']) && $dwt_listing_options['dwt_listing_enable_packages'] == true && class_exists( 'WooCommerce' ) && in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' )) )) { if(!empty($dwt_listing_options['dwt_listing_package_type'])) { $pack_id = $dwt_listing_options['dwt_listing_package_type']; dwt_listing_store_user_package_admin($uid,$pack_id); } } // Email for new user if ( function_exists( 'dwt_listing_email_on_new_user' ) ) { dwt_listing_email_on_new_user($uid, ''); } $user_info = get_userdata($uid); $profile_arr = array(); $profile_arr['id'] = $user_info->ID; $profile_arr['user_email'] = $user_info->user_email; $profile_arr['display_name'] = $user_info->display_name; $profile_arr['profile_img'] = dwt_listing_get_user_dp($user_info->ID,'downtown-user-dp'); $message_text = __("Registered successfully.", "dwt-listing-api"); $response = array( 'success' => true, 'data' => $profile_arr, 'message' => $message_text ); return $response; } add_action( 'rest_api_init', 'dwt_listing_register_api_hooks_get', 0 ); function dwt_listing_register_api_hooks_get() { register_rest_route( 'downtown/app', '/register/', array( 'methods' => WP_REST_Server::READABLE, 'callback' => 'dwt_listing_register_me_get', 'permission_callback' => function () { return dwt_listing_basic_auth(); }, ) ); } if( !function_exists('dwt_listing_register_me_get' ) ) { function dwt_listing_register_me_get() { $response = ''; $fields[] = array("placeholder" => __("Your Name", "dwt-listing-api"), "field_type_name" => 'name'); $fields[] = array("placeholder" => __("Your Email Address", "dwt-listing-api"), "field_type_name" => 'email'); $fields[] = array("placeholder" => __("Your Password", "dwt-listing-api"), "field_type_name" => 'password'); $data['logo'] = dwt_listing_appLogo(); $data['registration_fields'] = $fields; $data['screen_txt'] = __("Sign up", "dwt-listing-api"); $data['btn_text'] = __("Sign Up", "dwt-listing-api"); $data['already_account'] = __("Already have an account? Sign Up", "dwt-listing-api"); $data['main_heading'] = __("Find & explore world top places", "dwt-listing-api"); $response = array( 'success' => true, 'data' => $data, "message" => ""); return $response; } }
[+]
..
[-] events.php
[edit]
[-] author-listings.php
[edit]
[-] fetch_data.php
[edit]
[-] forget.php
[edit]
[-] categories.php
[edit]
[-] listing-detail.php
[edit]
[-] packages.php
[edit]
[-] home.php
[edit]
[+]
packages
[-] reviews.php
[edit]
[+]
submit-listing
[-] profile.php
[edit]
[-] register.php
[edit]
[-] settings.php
[edit]
[-] events-search.php
[edit]
[-] listing-search.php
[edit]
[+]
profile
[-] event-detail.php
[edit]
[-] login.php
[edit]
[+]
payments
[-] blog.php
[edit]