Customizing WP tables or adding new ones?

You should avoid adding new tables or customising the existing tables to add fields for users. If you want to store a phone number etc, do it using user meta: add_user_meta( $user_id, ‘riccardo_phone_number’, ‘0123-456-7890’ ); …. $phone_number = get_user_meta( $user_id ); User meta is a key and a value with a post ID in the … Read more

How to pre-fill Google Forms URLs with logged-in WordPress user’s data

AS easy as you said: $user = wp_get_current_user(); if(!empty($user)) { $email = $user->user_email; $fname = $user->user_firstname; $sname = $user->user_lastname; $url=”https://docs.google.com/forms/d/e/1FAIpQLSeChqhovV70FbILIlfeo8K5UL9q3hfjPkngEe4IJkXMmCbawg/viewform?entry.646601418=STUDENT+01&entry.280532864=”.$email.’&entry.1176284616=’.$fname.’&entry.165661554=’.$sname; echo $url; } else { $email=”[email protected]”; $url=”https://docs.google.com/forms/d/e/1FAIpQLSeChqhovV70FbILIlfeo8K5UL9q3hfjPkngEe4IJkXMmCbawg/viewform?entry.646601418=STUDENT+01&entry.280532864=”.$email.’&entry.1176284616=First&entry.165661554=Last’; echo $url; } If the user is logged in (if !empty ($user) ) then it grabs the data from the user variable wp_get_current_user, we could also wrap in … Read more

User defined password at registration – registration email sends auto generated pass

Welcome to WPSE. You can use wp_insert_user, you don’t need to hook onto anything. Assuming here they fill out a form with a name, username, email and password field, and you capture it however you want. $name_array = explode(‘ ‘,$_POST[‘name’]); $user = array( ‘user_login’ => $_POST[‘username’], ‘user_pass’ => $_POST[‘password’], ‘user_email’ => $_POST[’email’], ‘first_name’ => $name_array[0], … Read more

Add profile field (usermeta) to Add New User

To add data to the form at user-new-php, I believe you want the user_new_form hook. Unfortunately, it is marked “@since 3.7.0” so it isn’t in the stable release yet. I am tempted to tell you to hack it into your site in exactly the place that it will soon appear, but that would be wrong. … Read more

How to update serialized data in the user meta data

Thats just PHP serialized array notation. You would get that same result by this code: $meta_value = array( ‘alumni’ => ‘Yes’, ‘donations_collected’ => ’10’ ); update_user_meta( $team_member_id, ‘wp_s2member_custom_fields’, $meta_value); So if you want to then change the donations_collected value to 11: $meta_value = get_user_meta( $team_member_id, ‘wp_s2member_custom_fields’, true ); $meta_value[‘donations_collected’]++; update_user_meta( $team_member_id, ‘wp_s2member_custom_fields’, $meta_value);

Authors details such as social media links, emails etc → Is this Meta or something else?

Add user contact methods using the user_contactmethods filter in your theme’s functions.php or via a plugin: User contact method entries are stored in the wp_usermeta table. The URL field is special; it’s stored in the user_url field in the wp_users table. // Add user contact methods add_filter( ‘user_contactmethods’,’wpse_user_contactmethods’, 10, 1 ); function wpse_user_contactmethods( $contact_methods ) … Read more