New answers tagged

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 ...


0

Use WordPress' built-in wp_dropdown_users with an advanced query as discussed in http://stackoverflow.com/questions/34142789/change-wp-dropdown-users-filter-by-user-role


10

Yes, this is a good question and the answer is basic Wordpress 101 (core), contrary to the two comments above. No plugin necessary. You simply go to Users and delete the author (user) that you don't want to keep. Wordpress then asks you if you want to delete their content or attribute it to another user. Choose the author (user) you wish to keep and it will ...


1

Consider using DateTime as this would give the ability to format the date: $user = wp_get_current_user(); $date = new DateTime($user->user_registered); echo 'Registered since: '.$date->format('jS F Y');


3

first_name and last_name are not the part of _users table it is user metadata. Therefore, user object does not have it. So when you access the property first_name user object has a PHP magic method __get() /** * Magic method for accessing custom fields * * @since 3.3.0 * @param string $key * @return mixed */ public function __get( $key ) { if ( ...


4

You can use the views_users filter to alter it. Here's an example: /** * Remove the users view */ add_filter( 'views_users', '__return_empty_array' ); if you want to remove it for every user. Here's another example how you could remove it for non-admins (PHP 5.4+): /** * Remove the users view for non-admins */ add_filter( 'views_users', function( ...


3

Register a collection post type to represent a single collection. You'll get permalinks and rewrite rules to resolve the requests for free. Insert a new collection post for a user when they create a collection, and save the chosen post IDs as an array in post meta. You can pass that array directly as post__in argument in a WP_Query instance to load the ...


0

I think you might have to modify the plugin, fork it, if you like the rest of it's functionality. Then add functionality that when you "favourite" a post/image, instead of adding it to your favourites you get a list which collection you want to add it to. All of these collections could have their own url like www.mysite.com/user/collections/collection-name ...


1

Place the following code in your theme's functions.php file: add_filter( 'bp_core_enable_root_profiles', '__return_true' ); I hope this helps.


3

Trying to detect when a UI was triggered, is indeed the wrong general approach (unless you want to tie to the UI). A proper one will be to hook on the user_register action. add_action( 'user_register', 'wpse223196_registration_save', 10, 1 ); function wpse223196_registration_save( $user_id ) { add_user_meta($user_id, 'score', 5); }


1

'users' != $current_screen->id in your file $current_screen is not set therefore, you are getting warning. You can pass custom var in your user query and check before running your code. $blogusers = get_users( 'orderby=nicename&order=ASC&my_filter=1' ); Here we are passing my_filter=1 then later we can check in pre_user_query global $wpdb, ...


0

yes, you would have to loop through all users so that you could then update that user_meta field: // Create the WP_User_Query object $wp_user_query = new WP_User_Query(array('role' => 'Subscriber')); // Get the results $users = $wp_user_query->get_results(); // Check for results if (!empty($users)) { // loop trough each author foreach ...



Top 50 recent answers are included