Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $password = "";
- $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $codeAlphabet .= "abcdefghijklmnopqrstuvwxyz";
- $codeAlphabet .= "!@#$";
- $codeAlphabet .= "0123456789";
- $max = strlen($codeAlphabet); // edited
- for ($i = 0; $i < 12; $i++) {
- $password .= $codeAlphabet[rand(0, $max - 1)];
- }
- //Here we are storing the user data in wp
- $userData = array('user_login' => $email, 'user_pass' => $password, 'user_email' => $email, 'role' => 'subscriber');
- $userId = wp_insert_user($userData);
- // DEBUG:
- $contact_id = get_user_meta( $userId, 'ontraport_contact_id', true );
- wpf_log( 'notice', $userId, 'DEBUG: Contact ID is ' . $contact_id );
- wp_new_user_notification( $userId, null, 'user', $password);
- $subscriber_tag_id = 8;
- $tags = array($subscriber_tag_id);
- if (isset($_REQUEST['newsletter'])) {
- //$newsletter_tag_id = wp_fusion()->user->get_tag_id('newsletter');
- $newsletter_tag_id = 7;
- array_push($tags, $newsletter_tag_id);
- }
- //this is adding iscrittoFNOPI tag when fnopi is validate
- if($cf_check == 1) {
- $cf_fnopi_id = wp_fusion()->user->get_tag_id('iscrittoFNOPI');
- array_push($tags, $cf_fnopi_id);
- }
- wp_cache_delete( $userId, 'users' );
- wp_fusion()->user->apply_tags($tags, $userId);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement