Get registered user’s country or IP

You can’t know the country / IP / etc. of any user: the admin could create any number of users, and before each of those users log in, there is no way for WP to know their IP even after an user logs in, you can’t be sure he/she would log in from the same … Read more

How to expire user registration?

You would need to do a Cron. Get all user who where registered before 6 months ago and change their role to something else. in this example i have user ‘expired’ but you would need the create this role before you could use it. add_action(‘wp’, function() { if ( !wp_next_scheduled( ‘check_for_expired_users’ ) ) { wp_schedule_event( … Read more

Custom registration and pending approval

Ok, I found a way to do it. It’s not a perfect solution but will allow me to continue the project. I just created another role called ‘shop_pending’. When the user registers as a shop, he won’t get the role ‘shop’, instead he will get the role’ shop_pending’. After all the process is done, the … Read more

Allow Users to Modify Some Values of Assigned WordPress Pods [closed]

You can use map_meta_cap() to set more specific capabilities for your CPT. So instead of using the built-in edit_posts and edit_others_posts capabilities you would create edit_locations and edit_others_locations – thus allowing a new custom role to edit their own locations, but not edit_others_locations. You may find this related question helpful: Using Custom Meta Capabilities on … Read more

Get user id after save post

The action save_post gets triggered after a post is saved, not after a user is saved. For this you need the action profile_update.

How to programmatically read the plan text password when user register?

There is an action https://developer.wordpress.org/reference/hooks/check_passwords/ which can be used to add your checking code. You could save your ‘strength indicator’ by adding it to $_POST and then re-accessing it when the user data is saved. Actions for that are https://codex.wordpress.org/Plugin_API/Action_Reference/user_register and https://codex.wordpress.org/Plugin_API/Action_Reference/profile_update. These actions are listed on https://codex.wordpress.org/Plugin_API/Action_Reference. Alternatively when looking for an action or … Read more

Cannot Update user meta in custom field

Welcome, either use edit_user_profile_update which is passed user_id add_action(‘edit_user_profile_update’, ‘save_extra_fields_country_institution_user_form’ ); function save_extra_fields_country_institution_user_form($user_id){ # again do this only if you can if(!current_user_can(‘manage_options’) || !current_user_can( ‘edit_user’ )) return false; # save my custom field $result = update_user_meta($user_id, ‘verifier_assign_country’, ‘test3′); } OR when I tested on ‘edit_user_profile’, the whole user object is being passed, not just the … Read more