New answers tagged

0

Short answer - Your original function (mostly) works. This is your function edited to do what it needs to do: function log_me_the_f_in( $user_id ) { wp_set_current_user( $user_id ); wp_set_auth_cookie( $user_id ); wp_redirect( home_url( '/some-ending-page/' ) ); exit(); } add_action( 'user_register', 'log_me_the_f_in' ); Long answer - ...


0

For those which have multilingual site, function function wp_roles_array() { $editable_roles = get_editable_roles(); foreach ($editable_roles as $role => $details) { $sub['role'] = esc_attr($role); $sub['name'] = translate_user_role($details['name']); $roles[] = $sub; } return $roles; } returns localized array ...


0

Not sure of what you are trying to achieve. If you whanted to add users to wordpress from outside wordpress and you had access to a unix shell, then perhaps you could look into wp-cli https://wp-cli.org/commands/user/create/ Then from php you could execute a system call <?php exec( 'cd '.escapeshellarg('/path/to/wp/root') .' && wp ...


0

You can get users by user meta, using the WP_User_Query class. There's a great explanation at https://tommcfarlin.com/get-user-by-meta-data/


2

wpupdateuser does not appear correct. Is it a compromise? Possibly not if you are allowing user registrations. A Google search for wpupdateuser reveals numerous sites where this username appears. Make sure WP and plugins are up to date.


5

In layman terms there is no major difference! update_user_option() uses update_user_meta() internally. The only difference is update_user_option() prefix the option name with database table prefix + blog ID if you are in multisite and just table prefix if you are in single site installation. Take a look at the code of update_user_option() /** * Update ...


5

Both write their data in the “usermeta” table. User options stored in the usermeta table retain the wordpress table prefix e.g. wp_ whereas the user meta also stored in the usermeta table doesn't. User options support blog-specific options, useful in multisite. The user meta is based on the user id specific meta data like profile information. The ...


0

This is already possible meaning two people can logon using the same credentials on different computers. No additional plugins or code are required for this.


1

WordPress doesn't do this out of the box. So if you want to know about something that has already happened you're too late :) But if you'd like to know in the future you could for instance have a look at this: https://wordpress.org/plugins/wp-security-audit-log/


0

WP-Members™ is a free membership management framework for WordPress® that restricts content to registered users. For reference please have a look


3

I think you are on the right track, wp_cache_delete was what finally helped me get an auto-signup with auto-login plugin working... I have this from there: wp_cache_delete($current_user->ID, 'users'); wp_cache_delete($current_user->user_login, 'userlogins'); Then see what roles you get after that with: $current_user = wp_get_current_user();


2

Have you tried logging in the user after your changes? Such as: wp_set_current_user( $current_user->ID, $current_user->user_login ); wp_set_auth_cookie( $current_user->ID ); do_action( 'wp_login', $current_user->user_login );


0

I found a realy great solition here. !! It is a function that kindof 'adds' 'orderby' => 'rand' as a parameter. What it does it that when someone uses that parameter, the function will query the database using regular MySQL, where random is always possible :) The function: // put this in your functions.php add_filter('pre_user_query', ...


2

Check out the WP_Query reference. For parameters. Date Parameters. $args = array( 'author' => 123 , 'date_query' => array( array( 'after' => 'January 1st, 2013', 'before' => array( 'year' => 2013, 'month' => 2, 'day' => 28, ...


0

Here is an example authentication plugin. It will pull information from your php session variables. This is how to use it: save it into a file mycustom-auth.php modify the constants near the top of the class put it into wp-content/plugins/mycustom_auth or wp-content/mu-plugins enable it in wp-admin log out of WP and log in again. You should see one ...


1

WordPress's authentication system is made up of pluggable functions, which means that you can write a plugin that has a function named, say, wp_authenticate(), and your site will use your wp_authenticate() function instead of the native WordPress one. Your comment about is_user_logged_in() (on your original post) is obviated by the fact that ...


1

You cannot query users by taxonomy. You will need to rethink your system. What would I do? Keep the taxonomies but use these only to output choosable values - wp_dropdown_categories() Save the selected value AS user meta, NOT AS taxonomies - update_user_meta() Now you can query users by that value - WP_User_Query() Example: This code would go to the ...


-2

RESOLVED!! It was me missing a trick within Role Scoper. All sorted! Thanks Mukto90 and Monkey Puzzle for your input. Cheers! Andy


1

Is using Auth0 (http://www.auth0.com) maybe an option for you? They have a very good Wordpress plugin. I think you could integrate your system and do a Single Sign On (SSO) using the plugin. I think it's a better option for you to do some stuff on your system to integrate (since you know the system and can probably be more productive), using this ...


1

If you have the ID of the user you can do this: wp_update_user([ 'ID' => $userId, // this is the ID of the user you want to update. 'first_name' => $firstName, 'last_name' => $lastName, ]); You can update / insert almost all fields with this function. Take a look at the documentation here


0

If your code, you use the first argument passed to wp_authenticate_user filter callback. That is a WP_User object, it not a email address and it is not a string. You may be confusing because of the name of the variable, $username, I suggest to change the name to $user, whcih is more appropiate and it is a better representation of the real value of that ...


0

Adminimize does not remove menu items etc, it just keeps them visually hidden. In other words, your admin pages is still accessible. Add this code to your functions.php file: add_action('admin_menu', 'edit_trustees_page'); function edit_trustees_page() { global $submenu; $trustees_page_id = 1; //change this value $url = get_admin_url() . ...


0

This list of filters at the top of admin screens are called Views. You can manage views using the views_{$this->screen->id} filter. Where you'd replace {$this->screen->id} with the name of the screen you'd like to manage. In order to filter the Users screen, you can try the following: // filter the 'users' views add_filter( "views_users", ...


0

This is for future reference: Currently: WordPress 4.5 (Date: 04/28/16 | With the nag message to update to WP 4.5.1) My tweaked version: // -- Originally in the post, not sure if this is necessary // -- remove_filter('wpmu_signup_blog_notification', 'activate_on_blog_signup'); // This function runs after Sign Up Step 2 function activate_user_and_blog( ...


1

Based on your comments, you should choose option 2 (using special template files). You can do that multiple ways, but I suggest you do the following: Create a plugin that will setup login, register, retrieve password, profile, delete account, and other related pages; (there will be a lot of pages). Creating a plugin is just a suggestion, but I prefer doing ...



Top 50 recent answers are included