As long as you know the username
you can have WP automatically log you in. You might need to ask your friend what that is.
Check to see if you’re logged in and if not, get user by login, set the current user along with the auth cookie then redirect to the ~~user’s admin~~ url or edit user url to change the password.
Place this in the functions.php
of the currently activated theme.
add_action( 'wp', 'automatic_login' );
function automatic_login() {
/*
|----------------------------------------------------------------
| SET THE USERNAME TO LOGIN WITH
|----------------------------------------------------------------
*/
$username = "Admin";
/*
|----------------------------------------------------------------
| AUTOMATICALLY LOG IN | THEN CHANGE YOUR PASSWORD!
|----------------------------------------------------------------
*/
if ( ! is_user_logged_in() && ! is_wp_error( $user = get_user_by( 'login', $username ) ) ) {
// Clear any auth cookies
wp_clear_auth_cookie();
// Log the user in
wp_set_current_user( $user->ID );
wp_set_auth_cookie( $user->ID );
// Admin Dashboard
// $redirect_to = user_admin_url();
// Go directly to the Edit User page to change your password
$redirect_to = get_edit_user_link( $user->ID ) . '#password';
wp_safe_redirect( $redirect_to );
exit();
}
}