Guest User

Untitled

a guest
Feb 18th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <?php
  2.  
  3. define( 'WP_USE_THEMES', false );
  4. require($_SERVER['DOCUMENT_ROOT'] .'/wp-config.php');
  5.  
  6. echo $_GET['message'];
  7.  
  8. echo ' new data: '. $data = str_replace('"','"',$_GET['message']);
  9.  
  10. print_r( ' JSON: '. $newdata = json_decode($data, true));
  11.  
  12.  
  13. echo $newauthor = $newdata['auth'];
  14. echo $user_id = $newdata['usr'];
  15.  
  16. //$key = 'userpost2';
  17.  
  18. //if($_POST['muutto']){
  19. echo $post1 = $newdata['muutto'];
  20.  
  21. //$post1 = 1564;
  22.  
  23. // }
  24. // else
  25. // {
  26. // $post1 = get_user_meta($user_id,$key,true);
  27. // }
  28.  
  29. echo 'testfun '.$post1.' NEWAUTHORE '.$newauthor;
  30.  
  31.  
  32. $newpidortest = 1488;
  33. $catg = 25;
  34.  
  35. //$user_id = $current_user->ID;
  36. //$key2 = 'pidortest';
  37. //echo $pidortest = get_user_meta($user_id,$key2,true);
  38.  
  39.  
  40.  
  41. //обновляем автора
  42. kses_remove_filters();
  43. wp_set_post_categories( $post1, $catg);
  44.  
  45. echo ' Category is ok ';
  46.  
  47.  
  48. $args = array(
  49. 'ID' => $post1,
  50. 'post_author' => $newauthor,
  51. );
  52. $post_id = wp_update_post( $args );
  53.  
  54. if (is_wp_error($post_id)) {
  55. $errors = $post_id->get_error_messages();
  56. foreach ($errors as $error) {
  57. echo $error;
  58. }
  59. }
  60.  
  61. kses_init_filters();
  62.  
  63. //update_user_meta($user_id,$key2,$newpidortest,$pidortest);
  64.  
  65. //$post_id = $post1;
  66.  
  67.  
  68. require 'https://muutonkilpailutus.fi/wp-content/plugins/newmuutto.php?firma_id='.$newauthor.'&post_id='.$post1.'&posturl='.$current_url;
  69.  
  70.  
  71.  
  72. ?>
Add Comment
Please, Sign In to add comment