Batch users creation

This is a small code I wrote to batch create generic users <?php $lock = true; //true = disabled (locked) if(!$lock) { // if not locked require_once( $_SERVER[‘DOCUMENT_ROOT’] . ‘/wp-load.php’ ); $last_registered_user = $wpdb->get_row(“SELECT ID FROM $wpdb->users ORDER BY ID DESC LIMIT 1”); $new_id = $last_registered_user->ID + 1; $limit = false; // extra lock while($new_id … Read more

Registering without e-mail adress!

WordPress registration process is based on the use of email. You can create your own registration page, and use fake random email just to fill the required email field, but you need to custom code registration process up to a point. How will you reach your users, if you have no way to contact them?

How to get the ID of the currently logged in user?

get_current_user_id() effectively does what @Giri had described in the first snippet. The internal WordPress function-call chain eventually calls get_currentuserinfo() which already checks if there is a WP_User object, meaning a user is logged in. Thus, from what I can see in the linked code, get_current_user_id() always returns the ID of the user that is logged … Read more

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