[themify_is_logged_in]
########################## WPUFpro to CITADELA Item ################################## function wpuf_to_citadela( $post_id, $form_id ) { if ( $form_id != 27 ) { return; } if ( isset( $_POST['bezahlung'] ) ) { $wpuf_bezahlung = get_post_meta( $post_id, 'bezahlung', true ); $wpuf_bezahlung = explode( '|', $wpuf_bezahlung ); update_post_meta( $post_id, '_citadela_item_extension_bezahlung', '' ); foreach ( $wpuf_bezahlung as $citadela_bezahlung ) { update_post_meta( $post_id, '_citadela_item_extension_bezahlung_'.trim( $citadela_bezahlung ), 1 ); } } if ( isset( $_POST['service'] ) ) { $wpuf_service = get_post_meta( $post_id, 'service', true ); $wpuf_service = explode( '|', $wpuf_service ); update_post_meta( $post_id, '_citadela_item_extension_service', '' ); foreach ($wpuf_service as $citadela_service) { update_post_meta( $post_id, '_citadela_item_extension_service_'.trim( $citadela_service ), 1 ); } } if ( isset( $_POST['feature'] ) ) { $wpuf_feature = get_post_meta( $post_id, 'feature', true ); $wpuf_feature = explode( '|', $wpuf_feature ); update_post_meta( $post_id, '_citadela_item_extension_feature', '' ); foreach ($wpuf_feature as $citadela_feature) { update_post_meta( $post_id, '_citadela_item_extension_feature_'.trim( $citadela_feature), 1 ); } } } add_action( 'wpuf_add_post_after_insert', 'wpuf_to_citadela', 10, 2 );
Hier die Variante, ohne GET POST META
########################## WPUFpro to CITADELA Item ################################## function wpuf_to_citadela_directory_plugin( $post_id, $form_id ) { if ( $form_id != 27 ) { return; } if ( ! $post_id ) { return; } if ( isset( $_POST['bezahlung'] ) ) { // wpuf meta name update_post_meta( $post_id, '_citadela_item_extension_payment', '' ); foreach ( $_POST['bezahlung'] as $citadela_payment ) { update_post_meta( $post_id, '_citadela_item_extension_payment_'.trim( $citadela_payment ), 1 ); } } if ( isset( $_POST['service'] ) ) { // wpuf meta name update_post_meta( $post_id, '_citadela_item_extension_service', '' ); foreach ( $_POST['service'] as $citadela_service ) { update_post_meta( $post_id, '_citadela_item_extension_service_'.trim( $citadela_service ), 1 ); } } if ( isset( $_POST['feature'] ) ) { // wpuf meta name update_post_meta( $post_id, '_citadela_item_extension_feature', '' ); foreach ( $_POST['feature'] as $citadela_feature ) { update_post_meta( $post_id, '_citadela_item_extension_feature_'.trim( $citadela_feature), 1 ); } } if ( isset( $_POST['google_map'] ) ) { // wpuf meta name list( $wpuf_address, $wpuf_lat, $wpuf_lng ) = explode( '||', $_POST['google_map'] ); if ( $wpuf_address ) { update_post_meta( $post_id, '_citadela_address', trim( $wpuf_address ) ); } if ( $wpuf_lat ) { update_post_meta( $post_id, '_citadela_latitude', (float)$wpuf_lat ); } if ( $wpuf_lng ) { update_post_meta( $post_id, '_citadela_longitude', (float)$wpuf_lng ); } } ##################### This is the FOREACH version to get the POST fields values ############################### if ( isset( $_POST['google_map'] ) ) { $test_google = get_post_meta( $post_id, 'google_map', true ); foreach ( $test_google as $test_google_maps => $test_google_map ) { update_post_meta( $post_id, '_a_google_map_test_'.trim( $test_google_maps ), $test_google_map ); } } } add_action( 'wpuf_add_post_after_insert', 'wpuf_to_citadela_directory_plugin', 10, 2 ); add_action( 'wpuf_edit_post_after_update', 'wpuf_to_citadela_directory_plugin', 10, 2 );
[/themify_is_logged_in]