Update a user field with a generated text

Your hook already gives you user id, you don’t need to $current_user. add_action (‘user_register’, ‘mailboxNumberGenerator’, 10, 1); function mailboxNumberGenerator($user_id) { $initialMailboxNum = 100000; $user_query = new WP_User_Query( array( ‘role’ => ‘Customer’ ) ); $user_query2 = new WP_User_Query( array( ‘role’ => ‘Subscriber’ ) ); $currentMailboxNum = $initialMailboxNum + $user_query->get_total() + $user_query2->get_total(); $newMailboxNum = $currentMailboxNum + 1; … Read more

Add custom Date column to “All Users” admin panel in WP

This should be it <?php function new_contact_methods( $contactmethods ) { $contactmethods[‘signupdate’] = ‘Date’; return $contactmethods; } add_filter( ‘user_contactmethods’, ‘new_contact_methods’, 10, 1 ); function new_modify_user_table( $column ) { $column[‘signupdate’] = ‘Date’; return $column; } add_filter( ‘manage_users_columns’, ‘new_modify_user_table’ ); function new_modify_user_table_row( $val, $column_name, $user_id ) { $user = get_user_by( ‘id’, $user_id ); $date_formatted = new DateTime($user->user_registered); switch … Read more

How to hide username on wordpress registration?

Well I was overthinking this way too much!! All you need to do for the form is put in a dummy value for user_login so that it looks like: <input class=”form-control” type=”hidden” name=”user_login” id=”user_login” value=”ABC”> On the top of the page I remove the $current_username = $current_email;. On the form submission code, I make the … Read more

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