Updating User Meta with Array on Click of Button AJAX
Updating User Meta with Array on Click of Button AJAX
Updating User Meta with Array on Click of Button AJAX
It turns out (via comments) that (ab)using user 0 is a really bad idea. However, WordPress is built to allow new things to get meta-tables. Which led me to make Guest Meta as a plugin. It’s available on GitHub as a gist and below in its current form. I have to point out that this … Read more
$POST = filter_var_array($_POST, FILTER_SANITIZE_STRING); $nome = $POST[‘nome’]; $cognome = $POST[‘cognome’]; $email = $POST[’email’]; $token = $POST[‘stripeToken’]; $nickname = $nome . ‘ ‘ . $cognome; // Inserisce utente nel DB $user_data = [ ‘user_login’ => $nickname, ‘user_pass’ => wp_generate_password (), ‘user_email’ => $email, ]; $user_id = wp_insert_user($user_data); update_user_meta( $user_id, ‘first_name’, $nome); update_user_meta( $user_id, ‘last_name’, $cognome); update_user_meta( … Read more
transition_post_status not working via Quick Edit
Perhaps user.php has not yet been loaded. get_users() is a wrapper for WP_User_Query, which is defined in wp-includes/user.php. Hooks indicate template_redirect is after wp, after users are registered. Perhaps you could try conditionally hooking ‘template_redirect’ on the front-end and ‘user_admin_menu’ on the back-end. if (is_admin()){ add_action(‘user_admin_menu’,’manage_new_user_submit’); } else { add_action(‘template_redirect’,’manage_new_user_submit’); } Also, you might remove … Read more
get_user_meta an ID for multiple functions
My solution ended up being: <script> var mb_user_location_current = … … </script> And then used those variables from the head to the function. But then ventured down other paths for different solutions.
Dynamic URL based on user_metadata
Meta_query on same meta key, with diffrenct values
When you are using human_time_diff for convert time to human readable format. your last_visit meta empty that is why it is return 50 years. so before convert human_time_diff you have to check value is not empty. use below code to display last_login, last_visit. $users = get_users(); foreach( $users as $user ) { $udata = get_userdata( … Read more