I am migrating a wordpress site to another site. The users from the old site need to work with the new site. I am doing a staggered implementation, so do not want to bring all the users over at once. Basically, when a user attempts to sign in, before the login is authenticated, if the user does not exist on the new site, I am using an api call to grab the user details from the old site, and create …
Im Trying to set an user role. if an specific user role (sales-agents) create an user. the created user should have the role b2b instead of customer here is my try: add_action( 'init', 'b2b_set_user_role' ); function b2b_set_user_role() { if ( is_user_logged_in() && wcb2bsa_has_role( get_current_user_id(), 'sales_agent' ) ) { $user->remove_role( ‘customer’ ); $user->add_role( ‘b2b’ ); } } i hope someone can help me
I have a custom meta box with some user information fields, and when the post is published, the new user account is created, along with the new post. However, the new post's author is set as the current user. Is there a way to set that post's author to be the newly created user? I have the following code: function osb_save_meta_box( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( $parent_id = wp_is_post_revision( $post_id ) …
The following code is getting all terms and see if any one of them is checked or not. If any term is checked a form should show under the selected checkbox with email, the username(auto-generated) and password(auto-generated), and admin should be available to submit each form which will create a user for a specific term. The problem is The form is being submitted to options.php which I have to submit checkboxes in the options table <div class="wrap"> <?php screen_icon(); ?> …
On multisite, setting the WP_INSTALLING constant on wp-activate.php file disables all plugins prematurely. Why didn't the core create a way to bypass this. Though this may be required for activating new sites, but by default when activating a new user, the WP_INSTALLING constants should be disabled.
When Users create custom post types, the author field does not seem to be passed back to WP posts functions. As the title says, I'm creating a user account programatically, and having that user log-in and write a post of custom post_type = 'job'. This all LOOKS good in the database - the user, and post are inserted. The post_author is indeed the same as the ID of the user who created it. But, in the User Accounts panel, that …
Using below code, I am able to create an user. But when I am login, the user is directly logging in to dashboard and there is no email sent to verify the email address. Is there any way to send verification email once the wp_insert_user function is called and the user has to confirm his email address before logging in. I have tried wp_create_user and register_new_user, but I want the function in the way I have requested. $user_login = wp_slash( …
I'm trying to do a POST request to my API when a user is created. I've installed Code snippets and added the following: add_action('user_register','my_function'); function my_function($user_id){ echo("Code has been run."); echo("<script>console.log('test')"); } Now, when I register a new user, nothing is echoed. The snippet is set to "Run snippet everywhere". I hope I've been specific enough.
I inherited this wordpress website called RxStudyGuides to use as a study tool for pharmacy students. However, the owner and creator of the website still has there contact information on the website at the bottom of the page and I can't seem to find how to edit that information. It only seems that I can edit the actual content of the website. The creator made me an editor and maybe since I am not the owner of the site I …
I have a custom plugin that automatically creates a new user via wp_insert_user() if the current user does not exist yet. We use data from our remote ldap server to provide the new user's details (user_login, user_email, etc.) for the wp_insert_user() function call. This works without a hitch on most of our sites, but on a site that uses WP REST API to render the page, we have noticed that we are sometimes getting duplicate users in the database, same …
I know the former allows additional parameters, so you can more user info, but other then that, why do both exist? The specific reason I want to know is that wp_insert_user() is happening REALLY slowly. Somewhere between 5 - 10 seconds. I don't remember having this problem in the past, when I was using create_user, so I'm wondering if there's a lot more happening behind the scenes with one as opposed to the other. Thanks.
I want to create a user via a standalone script. I want an activation email to be sent out, in the same way that it is when a user is created from the Add User screen. An email is set out with a link to create the password. There is no password in the email. There seem to be various functions for creating new users. wp_insert_user wp_create_user [register_new_user][3] There's also wp-admin/user-new.php Below is the code I have. It creates a …
I'd like to update my users list with some user from a csv file generated by another database (witch i can access too) i'd like to create dynamically a user (with username, password and so on) and other custom fields (such as language, status, and other personal variables). I've fetched my csv (that works), but when i try to create user with wp_insert_user, nothing happens :/ here's the code: function clients_csv($file){ $csv = array_map('str_getcsv', file($file)); for($i=0;$i<count($csv);$i++){ if(!email_exists($csv[7]) ){ print "CREATE …
I'm using UserUltra Pro plugin and I need to create a custom post type after user register in the site. UserUltra plugin uses wp_create_user() which I know is a wrapper for wp_insert_user(). Moreover, I know that 'user_register' is the hook called after wp_insert_user(). Beside this, I can't create new custom post type because it seems that user_register hook is not called. Is this possible? How can I manage it?
I need to display the user's nickname by default after they are created in the DB, NOT the username. I am creating a user with: wp_create_user( $user_name, $random_password, $user_email ); updating the user nickname field directly after user creation: update_user_meta($user_id, 'nickname', $user_nickName); Now i need the "Display name publicly as" to be set to the nickname as default not the username. My WP is automatically defaulting the users display name as the username. How do i put the selected value …
I am using custom urls for my author pages like this: http://site.com/author_name After I create a new user, that author page appears as not found; however, if I update my permalink structure from admin panel, the author page is found. So, is it necessary to flush rewrite rules after a new user is created? Is there any other way? From codex, I read that flushing rewrite rules is a very expensive task. So, I would like to avoid this. Is …
I am trying to create a plugin that will generate users. I am pretty new to Wordpress and my PHP is ehhhh. I got some helpful help earlier but have made a few turns since... The plugin will generate a user when submit it clicked, the issue is it ignores anything put into the input field and doesn't require it to work. Even if I set $num_users to a number it still only generates one...Perhaps an issue with my for …
I am trying to create a plugin that will generate users. I am pretty new to Wordpress and my PHP is ehhhh. The idea for it is for the plugin to generate multiple users when its finished. Right now though I am just trying to get it to generate one. But I am having issues trying to do so, any ideas? Once I click Submit, I get a 'Settings Saved'. So, I believe that means the form went through but …
First of all I would like to thank Dan Phiffer for providing such a wonderful plugin. I have installed the JSON API Plugin on my blog and it works and post perfectly. The problem that I need to add a method called create_user to create a new user. Can someone give me the steps to add such method to JSON API. Thanks for all :)
Please note that this was posted on wp-hackers mailing list. Hi guys, Just wondering, does anyone know how I can go about checking to see if there a wordpress account and create one if there isn't? Script that I got: https://gist.github.com/Danielx64/7519092 There a marker in the file that has "// Somewhere here I want to put a check to see if there a wp account" What I want to happen there is that a check get done to see if …