use single form to enter multiple profiles
use single form to enter multiple profiles
use single form to enter multiple profiles
Here is how I would do it: function save_extra_user_profile_fields( $user_id ) { if (!isset($_POST[‘address’]) || empty($_POST[‘address’])) { // this field was not set or was empty // do your action wp_redirect( home_url() ); // or profile page exit; } else { // field was set and contains a value // do your action update_user_meta( $user_id, … Read more
Well, Roles are in many ways custom user types and you can add meta fields specific to roles. For example… function is_my_user_role($id = null) { global $profileuser; if (empty($profile) && !empty($id)) $profileuser = get_user_to_edit($id); return (in_array(‘myrole’,$profileuser->roles)) ? true : false; } function my_user_fields($profileuser) { if (!is_my_user_role()) return false; // HTML for the fields } add_action(‘show_user_profile’, … Read more
I feel the best way to do is add two options Body weight and Body fat(%) in the user profile, and then you can show it with the user logged from the db. I guess this would be a simpler way.
One way to do it is by creating a CPT for user profiles, and creating one “post” of that type per each user. Remove the user’s ability to add or remove osts and let him edit that post. This will make searching easier as you simply restrict the search for the specific CPT.
The default login form is not very developer friendly (and it is more developer friendly now than it used to be). If you browse the source for that page you should be able to convince yourself of that. Your plugin is not going to be able to manipulate the page the way you hope. A … Read more
So the theme I used was not firing add_action( ‘publish_place’, ‘update_package_id’ ); or any of it’s variations e.g. save_post So I created a custom hook in the functions.php file of the theme which got the post id from the url (see $_REQUEST[‘pid’]) here’s what it looked like: function update_package_id() { $postinfo = $_REQUEST[‘pid’]; $post = … Read more
Update user meta using Ajax on front end?
After some help with a PHP developer, it seems the main code above was close but certain changes were made. Here is the code for those interested. In this code, the custom post type is: Course. Change accordingly if needed for your own use. function save_educadme_courses_for_user( $user_id ) { if ( !current_user_can( ‘edit_user’, $user_id ) … Read more
How to Update User Meta Field other than from profile?