Advertisement
verygoodplugins

Untitled

Sep 19th, 2022 (edited)
3,669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. $password = "";
  2. $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  3. $codeAlphabet .= "abcdefghijklmnopqrstuvwxyz";
  4. $codeAlphabet .= "!@#$";
  5. $codeAlphabet .= "0123456789";
  6. $max = strlen($codeAlphabet); // edited
  7. for ($i = 0; $i < 12; $i++) {
  8. $password .= $codeAlphabet[rand(0, $max - 1)];
  9. }
  10.  
  11. //Here we are storing the user data in wp
  12. $userData = array('user_login' => $email, 'user_pass' => $password, 'user_email' => $email, 'role' => 'subscriber');
  13. $userId = wp_insert_user($userData);
  14.  
  15. // DEBUG:
  16. $contact_id = get_user_meta( $userId, 'ontraport_contact_id', true );
  17. ​wpf_log( 'notice', $userId, 'DEBUG: Contact ID is ' . $contact_id );
  18.  
  19. wp_new_user_notification( $userId, null, 'user', $password);
  20.  
  21. $subscriber_tag_id = 8;
  22.  
  23. $tags = array($subscriber_tag_id);
  24.  
  25. if (isset($_REQUEST['newsletter'])) {
  26. //$newsletter_tag_id = wp_fusion()->user->get_tag_id('newsletter');
  27. $newsletter_tag_id = 7;
  28. array_push($tags, $newsletter_tag_id);
  29. }
  30. //this is adding iscrittoFNOPI tag when fnopi is validate
  31. if($cf_check == 1) {
  32. $cf_fnopi_id = wp_fusion()->user->get_tag_id('iscrittoFNOPI');
  33. array_push($tags, $cf_fnopi_id);
  34. }
  35.  
  36. wp_cache_delete( $userId, 'users' );
  37.  
  38. wp_fusion()->user->apply_tags($tags, $userId);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement