laim_plans_function_array')){ function lp_get_claim_plans_function_array(){ $returnArray = array(); $returnArray[0] = esc_html__('Select Plan', 'listingpro'); $args = null; $args = array( 'post_type' => 'price_plan', 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query'=>array( 'relation'=> 'OR', array( 'key' => 'lp_listingpro_options', 'value' => 'claimonly', 'compare' => 'LIKE' ), array( 'key' => 'lp_listingpro_options', 'value' => 'listingandclaim', 'compare' => 'LIKE' ), ), ); $claim_Plan_Query = new WP_Query($args); if($claim_Plan_Query->have_posts()){ while ( $claim_Plan_Query->have_posts() ) { $claim_Plan_Query->the_post(); $returnArray[get_the_ID()] = get_the_title(); } wp_reset_postdata(); } return $returnArray; } } /* ==========================updated metas on success paid claim===================== */ if(!function_exists('lp_update_paid_claim_metas')){ function lp_update_paid_claim_metas($claimed_post, $post_id, $method){ listing_set_metabox('claimed_section', 'claimed', $post_id); $new_author = listing_get_metabox_by_ID('claimer', $claimed_post); $claim_plan = listing_get_metabox_by_ID('claim_plan', $claimed_post); listing_set_metabox('Plan_id',$claim_plan, $post_id); listing_set_metabox('claim_status','approved', $claimed_post); listing_set_metabox('claimed_listing', $claimed_post, $post_id); global $listingpro_options; $c_mail_subject = $listingpro_options['listingpro_subject_listing_claim_approve']; $c_mail_body = $listingpro_options['listingpro_content_listing_claim_approve']; $a_mail_subject = $listingpro_options['listingpro_subject_listing_claim_approve_old_owner']; $a_mail_body = $listingpro_options['listingpro_content_listing_claim_approve_old_owner']; $admin_email = ''; $admin_email = get_option('admin_email'); $website_url = site_url(); $website_name = get_option('blogname'); $listing_title = get_the_title($post_id); $listing_url = get_the_permalink($post_id); $headers[] = 'Content-Type: text/html; charset=UTF-8'; global $wpdb; $prefix = $wpdb->prefix; $update_data = array( 'post_author' => $new_author ); $where = array( 'ID' => $post_id ); $update_format = array( '%s' ); //$wpdb->update($prefix . 'posts', $update_data, $where, $update_format); $argddd = array( 'ID' => $post_id, 'post_author' => $new_author, ); wp_update_post($argddd); /* updte data is listing order db */ $orderTable = 'listing_orders'; lp_change_listinguser_in_db($new_author, $post_id, $orderTable); /* creating invoice */ $start = 11111111; $end = 999999999; $ord_num = random_int($start, $end); if(lp_theme_option('listingpro_invoice_start_switch')=="yes"){ $ord_num = lp_theme_option('listingpro_invoiceno_no_start'); $ord_num++; if ( class_exists( 'Redux' ) ) { $opt_name = 'listingpro_options'; Redux::setOption( $opt_name, 'listingpro_invoiceno_no_start', "$ord_num"); } } $user_obj = get_user_by('id', $new_author); $fname = $user_obj->user_login; $lname = $user_obj->user_login; $usermail = $user_obj->user_email; $currency_code = lp_theme_option('currency_paid_submission'); $plan_id = listing_get_metabox_by_ID('claim_plan', $claimed_post); $plan_price = get_post_meta($plan_id, 'plan_price', true); $plan_duration = get_post_meta($plan_id, 'plan_time', true); $plan_type = get_post_meta($plan_id, 'plan_package_type', true); $plan_title = get_the_title($plan_id); $post_info_array = array( 'user_id' => $new_author , 'post_id' => $post_id, 'plan_id' => $plan_id , 'plan_name' => $plan_title, 'plan_type' => $plan_type, 'payment_method' => $method, 'token' => '', 'price' => $plan_price, 'currency' => $currency_code , 'days' => $plan_duration , 'date' => '', 'status' => 'success', 'used' => '' , 'transaction_id' =>'', 'firstname' => $fname, 'lastname' => $lname, 'email' => $usermail , 'description' => 'purchased by paid claim' , 'summary' => '' , 'order_id' => $ord_num , ); $wpdb->insert($prefix."listing_orders", $post_info_array); } } /* =============================for making listing selected checkut session id================== */ add_action( 'wp_ajax_lp_save_thisid_in_session','lp_save_thisid_in_session' ); add_action( 'wp_ajax_nopriv_lp_save_thisid_in_session', 'lp_save_thisid_in_session' ); if(!function_exists('lp_save_thisid_in_session')){ function lp_save_thisid_in_session(){ $listingID = $_POST['listing_id']; $_SESSION['listing_id_checkout'] = $listingID; exit(); } } /* =============================for addding new column in campagins table======================== */ if(!function_exists('lp_ammend_campaigns_table')){ function lp_ammend_campaigns_table(){ global $wpdb; $table_prefix = $wpdb->prefix; $table = $table_prefix.'listing_campaigns'; if(empty(lp_check_column_exist_in_table($table, 'mode'))){ $wpdb->query( sprintf( "ALTER TABLE %s ADD mode VARCHAR(255) NOT NULL", $table) ); } if(empty(lp_check_column_exist_in_table($table, 'duration'))){ $wpdb->query( sprintf( "ALTER TABLE %s ADD duration VARCHAR(255) NOT NULL", $table) ); } if(empty(lp_check_column_exist_in_table($table, 'budget'))){ $wpdb->query( sprintf( "ALTER TABLE %s ADD budget VARCHAR(255) NOT NULL", $table) ); } if(empty(lp_check_column_exist_in_table($table, 'ad_date'))){ $wpdb->query( sprintf( "ALTER TABLE %s ADD ad_date VARCHAR(255) NOT NULL", $table) ); } if(empty(lp_check_column_exist_in_table($table, 'ad_expiryDate'))){ $wpdb->query( sprintf( "ALTER TABLE %s ADD ad_expiryDate VARCHAR(255) NOT NULL", $table) ); } } } /* ============================ for check if column exists=========================== */ if(!function_exists('lp_check_column_exist_in_table')){ function lp_check_column_exist_in_table($table_name, $column_name){ global $wpdb; if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { return false; }else{ $column = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ", DB_NAME, $table_name, $column_name ) ); if ( ! empty( $column ) ) { return true; } return false; } } } /* ============== Theme Setup init tag ============ */ add_action('init', 'listingpro_titleTag'); if( !function_exists('listingpro_titleTag') ){ function listingpro_titleTag(){ if(!is_author()){ add_theme_support( "title-tag" ); } } } /* =================ammend column for tax in order table=================== */ if(!function_exists('lp_ammend_orders_table')){ function lp_ammend_orders_table(){ global $wpdb; $table_prefix = $wpdb->prefix; $table = $table_prefix.'listing_orders'; if($wpdb->get_var("SHOW TABLES LIKE '$table'") == $table) { if(empty(lp_check_column_exist_in_table($table, 'tax'))){ $wpdb->query( sprintf( "ALTER TABLE %s ADD tax VARCHAR(255) NOT NULL", $table) ); } } } } add_action('init', 'lp_ammend_orders_table'); /* =================ammend column for tax in campagins table=================== */ if(!function_exists('lp_ammend_tax_campains_table')){ function lp_ammend_tax_campains_table(){ global $wpdb; $table_prefix = $wpdb->prefix; $table = $table_prefix.'listing_campaigns'; if($wpdb->get_var("SHOW TABLES LIKE '$table'") == $table) { if(empty(lp_check_column_exist_in_table($table, 'tax'))){ $wpdb->query( sprintf( "ALTER TABLE %s ADD tax VARCHAR(255) NOT NULL", $table) ); } } } } add_action('init', 'lp_ammend_tax_campains_table'); /* =================== front end image delete cap=========== */ add_action( 'init', 'allow_sbuscriber_to_delete_posts'); if(!function_exists('allow_sbuscriber_to_delete_posts')){ function allow_sbuscriber_to_delete_posts() { $role = get_role( 'subscriber' ); $role->add_cap( 'delete_posts' ); } } /* function to remove inbox message*/ add_action( 'wp_ajax_lp_delete_this_conversation','lp_delete_this_conversation' ); add_action( 'wp_ajax_nopriv_lp_delete_this_conversation', 'lp_delete_this_conversation' ); if(!function_exists('lp_delete_this_conversation')){ function lp_delete_this_conversation(){ $listingid = $_POST['listingid']; $emailid = $_POST['emailid']; $currentUserID = get_current_user_id(); $lpAllMessges = get_user_meta($currentUserID, 'lead_messages', true); if(!empty($lpAllMessges)){ if(isset($lpAllMessges[$listingid])){ $thisListMsgs = $lpAllMessges[$listingid]; if(isset($thisListMsgs[$emailid])){ //$thisUserMsgs = $thisListMsgs[$emailid]; unset($lpAllMessges[$listingid][$emailid]); update_user_meta($currentUserID, 'lead_messages', $lpAllMessges); } } } exit(json_encode($lpAllMessges)); } } add_action( 'wp_enqueue_scripts', 'LP_dynamic_php_css_enqueue', 11 ); if(!function_exists('LP_dynamic_php_css_enqueue')){ function LP_dynamic_php_css_enqueue() { wp_enqueue_style( 'LP_dynamic_php_css', get_template_directory_uri().'/assets/css/dynamic-css.php', ''); } }