Advertisement
verygoodplugins

Untitled

Aug 9th, 2018
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. function property_update_shortcode() {
  2.  
  3.     ob_start(); ?>
  4.  
  5.         <form method="post">
  6.  
  7.             <input name="property_value" />
  8.  
  9.             <input type="hidden" name="action" value="update_property">
  10.             <input type="submit">
  11.  
  12.         </form>
  13.  
  14.     <?php
  15.  
  16.     return ob_get_clean();
  17.  
  18. }
  19.  
  20. add_shortcode( 'property_update', 'property_update_shortcode' );
  21.  
  22.  
  23. function save_property_data() {
  24.  
  25.     if( isset( $_POST['action'] ) && $_POST['action'] == 'property_update' ) {
  26.  
  27.         global $post;
  28.  
  29.         update_post_meta( $post->ID, 'property_value', $_POST['property_value'] );
  30.  
  31.         wp_fusion()->user->push_user_meta( get_current_user_id(), array( 'property_value' => $_POST['property_value'] ) );
  32.  
  33.     }
  34.  
  35.  
  36. }
  37.  
  38. add_action( 'init', 'save_property_data' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement