Temporary Admin User
Create a temporary WordPress admin user to provide access on support issues, etc.
by Andrew Norcross · github.com/norcross/temporary-admin-user · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/norcross/temporary-admin-user/archive/refs/heads/main.zipReadme
Temporary Admin User
Create admin users for support that expire.
Contributors
About
Create a temporary WordPress admin user to provide access on support issues, etc. Allows for extending, restricting, and deleting users created by the plugin.
Features
- Dedicated table for users created with the plugin
- Built-in processes to manage existing users
- Available actions and filters for modifying default values
- A suite of CLI commands
Frequenty Asked Questions
Do user accounts expire automatically?
Yes. There is a built in WP-Cron job that will check the user accounts created by the plugin and compare the stored expiration date. Users that have expired will be automatically set to "Subscriber".
I don't want to send the new user email. Can I prevent that?
Absolutely! There's a filter.
/**
* Don't send the new user email when creating a new user.
*
* @return boolean
*/
add_filter( 'temporary_admin_user_disable_new_user_email', '__return_true' );
Can I change the default ranges?
Sure can. There is a filter that impacts both promoting and extending a user, and then a more specific one for each action.
/**
* Change the default times for extending and promoting user actions.
*
* @param string $duration The current duration range. Default is 'day'.
* @param integer $user_id The individual user ID being updated.
*
* @return string One of the ranges to get a timestamp from.
*/
function prefix_set_default_action_range( $duration, $user_id ) {
return 'week';
}
add_filter( 'temporary_admin_user_default_user_action_range', 'prefix_set_default_action_range', 10, 2 );
/**
* Change the default times for extending, but not promoting users.
*
* @param string $duration The current duration range. Default is 'day'.
* @param integer $user_id The individual user ID being updated.
*
* @return string One of the ranges to get a timestamp from.
*/
function prefix_set_default_extend_range( $duration, $user_id ) {
return 'week';
}
add_filter( 'temporary_admin_user_default_user_extend_range', 'prefix_set_default_extend_range', 10, 2 );
/**
* Change the default times for promoting, but not extending users.
*
* @param string $duration The current duration range. Default is 'day'.
* @param integer $user_id The individual user ID being updated.
*
* @return string One of the ranges to get a timestamp from.
*/
function prefix_set_default_promote_range( $duration, $user_id ) {
return 'week';
}
add_filter( 'temporary_admin_user_default_user_promote_range', 'prefix_set_default_promote_range', 10, 2 );
Are there other hooks in the plugin?
You betcha. I would suggest reading the source code to get a better idea of what else can be done until I'm able to find time to document them all.
How do the CLI commands work?
Check in the Help Tab above the admin table, and all the commands and their options are explained. You can also type wp tmp-admin-user in the connected terminal and all the commands are shown.
I found a bug or have a feature request. How should I handle it?
Open a new issue in this repository and I'll see what I can do.
Read the full README on GitHub →
Releases
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.