Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'gform_pre_submission_36', 'pre_submission_handler2' );
- function pre_submission_handler2( $form ) {
- global $wpdb;
- if ( is_user_logged_in() ) {
- $user = wp_get_current_user();
- $u_id = $user->ID;
- $user_meta=get_userdata($u_id);
- $user_roles=$user_meta->roles;
- if (in_array('sp_trainer', $user_roles))
- {
- $post_type = 'dog_training_provide';
- }
- elseif(in_array('sp_adoption', $user_roles))
- {
- $post_type = 'dog_adoption_provide';
- }
- elseif(in_array('sp_groomer', $user_roles))
- {
- $post_type = 'dog_grooming_provide';
- }
- elseif(in_array('sp_veterinarian', $user_roles))
- {
- $post_type = 'dog_health_provider';
- }
- elseif(in_array('sp_daycare', $user_roles))
- {
- $post_type = 'dog_day_care_provide';
- }
- else
- {
- $post_type = 'demo_test';
- }
- $args = array(
- 'author' => $u_id,
- 'orderby' => 'post_date',
- 'order' => 'DESC',
- 'post_type' => $post_type,
- 'posts_per_page' => 1
- );
- $the_query = new WP_Query($args) ;
- if ($the_query->have_posts()) {
- while ( $the_query->have_posts() )
- {
- $the_query->the_post();
- //update_post_meta( get_the_ID(), 'profile_title', $_POST['input_7'] );
- update_post_meta( get_the_ID(), 'profile_description', $_POST['input_8'] );
- update_post_meta( get_the_ID(), 'lead_sub_title', $_POST['input_1'] );
- update_post_meta( get_the_ID(), 'profile_key1', $_POST['input_2'] );
- update_post_meta( get_the_ID(), 'profile_key2', $_POST['input_4'] );
- update_post_meta( get_the_ID(), 'profile_key3', $_POST['input_3'] );
- update_post_meta( get_the_ID(), 'profile_key4', $_POST['input_5'] );
- update_post_meta( get_the_ID(), 'appointment_setting', $_POST['input_7'] );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement