How to change the value of a variable using input field?

Please try below snippet of code. HTML : <input name=”getUser” id=”getUser” value=””/> <div id=”user_data”></div> JS (js/my-ajax-script.js) jQuery(document).ready(function($){ $(‘#getUser’).keyup(function(e) { var user_id = e.target.value; console.log(user_id); $.ajax({ url:my_ajax_object.ajaxurl, #add here your ajax url type:’POST’, data:’action=get_this_user_data&user_id=’+user_id , success:function(results) { jQuery(‘#user_data’).html(results); } }); }); }); Ajax (add in functions.php) function my_enqueue() { wp_enqueue_script( ‘ajax-script’, get_template_directory_uri() . ‘/js/my-ajax-script.js’, array(‘jquery’) ); … Read more

SQL – Shorter way to query user and usermeta data

I was just trying out the wp_get_users() function and I think that’s a much cleaner way to get the user data in a table. I can simply do something like this: $users = get_users(‘role=um_student’); foreach ( $users as $user ) { echo “<tr>”; echo “<td>$user->ID</td>”; echo “<td>$user->user_login</td>”; echo “<td>$user->first_name</td>”; echo “<td>$user->middle_name</td>”; echo “<td>$user->last_name</td>”; echo “<td>$user->university_program</td>”; … Read more

How To Export User’s Custom Fields in CSV or XLSX

Probably the easiest way to do this is to connect to the database using MySQL Workbench or similar, and extract the data using a SQL query e.g. select u.user_login, u.user_email, m1.meta_value as first_name, m2.meta_value as last_name, m3.meta_value as billing_codice_snep, m4.meta_value as codice_snep from wp_users u left join wp_usermeta m1 on m1.user_id = u.id and m1.meta_key … Read more

Edit a user profile field on front end

ACF is great for managing user custom fields, but it’s also fairly simple to do what you’re asking using just update_user_meta() to save custom data and then retrieve it with $user->get( ‘whatever’ ); Here’s an example of a form that let’s users set and update their twitter handle: <?php // Grab the current user (Or … Read more

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