Force “Submit to review” when a post is updated

It is possible to stop author to publish post, and force him to Submit For Preview. Just add this code to your functions.php and you are all done. <?php function take_away_publish_permissions() { $user = get_role(‘author’); $user->add_cap(‘publish_posts’,false); } add_action(‘init’, ‘take_away_publish_permissions’ ); ?> ** Updated Code ** This code shared here is for setting post status to … Read more

How to auto login user again after change user_login

I found when attempting similar I needed to clear the user cache to get the relogin to work (after much frustrating testing!): wp_cache_delete($user_id, ‘users’); wp_cache_delete($old_user_login, ‘userlogins’); // maybe unnecessary? $creds = array(‘user_login’ => $user_login, ‘user_password’ => $user_password, ‘remember’ => true); wp_signon($creds); Note for this to work you may also need the user to change their … Read more

wp_delete_user with username

There is no way to do this with only one query. But to be honest – deleting user takes more than one query itself… You shouldn’t use custom SQL for that, because there are many things you could break this way… Always use WP functions, if they exists (what if some plugin logs every deleted … Read more

Setting WP Admin passwords to expire

I was busy writing up a plugin for this without even checking of one already existed. So I did a little research and found out that it does indeed already exist and that the path I was going down was the right one. Well, there’s no need to reinvent the wheel here, so here’s the … Read more

Upload gravatar in WP profile?

If you are looking to connect your sites sign-up with Gravatar then you simply can’t, since Gravatar don’t have a sing-up api you can use. But if you are just looking to let your users upload there own photos the either Simple Local Avatars Plugin that Chip suggested or one I’ve used a lot before … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)