You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to propose two ideas for improving the plugin:
1. Enable super admin login on local environments when the plugin is installed.
It would be beneficial to allow users to log in as a super admin in a local environment when the plugin is installed. Here is a code snippet demonstrating this concept:
$id = 1;
if (
wp_get_environment_type() !== 'local' || // if not localis_user_logged_in() || // if user is already logged inis_admin() === false || // if not adminis_super_admin($id) === false// if user is not super admin
) {
return;
}
$user = get_user_by('id', $id);
$login = $user->data->user_login;
wp_set_current_user($id, $login);
wp_set_auth_cookie($id, true);
do_action('wp_login', $login, $user);
if (isset($_SERVER['REQUEST_URI'])) {
wp_safe_redirect($_SERVER['REQUEST_URI']);
exit;
}
2. Implement a constant for automatic super admin login in local environments.
As an alternative, introducing a constant that enables automatic super admin login in local environments when set to true could be advantageous:
AUTOMATIC_LOGIN=true
One of these enhancements would provide additional flexibility and ease of use for developers working with the plugin in their local environments. Please let me know your thoughts on these suggestions. I prefer the first one 😊
The text was updated successfully, but these errors were encountered:
I would like to propose two ideas for improving the plugin:
1. Enable super admin login on local environments when the plugin is installed.
It would be beneficial to allow users to log in as a super admin in a local environment when the plugin is installed. Here is a code snippet demonstrating this concept:
2. Implement a constant for automatic super admin login in local environments.
As an alternative, introducing a constant that enables automatic super admin login in local environments when set to
true
could be advantageous:One of these enhancements would provide additional flexibility and ease of use for developers working with the plugin in their local environments. Please let me know your thoughts on these suggestions. I prefer the first one 😊
The text was updated successfully, but these errors were encountered: