WooCommerce - Custom User Registration Fields - wordpress

I was following this blog post https://www.themelocation.com/how-to-add-custom-fields-to-user-registration-form-in-woocommerce/ to learn about creating custom user fields in Woo (for registration).
The post above worked, and I was able to see new fields during registration, but I had two questions:
How can I get these fields to appear when I'm editing a user in wp-admin? I didn't notice them rendering on the edit user page.
Right now Woo (by default) lets you just register with an e-mail. I wanted to also use a first name and last name (my custom fields), but this is already a field on the users in WordPress, so I don't want to duplicate fields. Is there a way to somehow pull in/use/associate an existing field (such as name) during the Woo registration?
Thanks so much for any help/guidance you all can give me.

1 You can use this plugin for display your custom fields in the admin view.
2 In your template HTML file, find the form, and use the default id & name tag : "Firstname" / "Lastname" ...ext

Related

Display custom post types filter by ACF with current user

I would like to display my custom posts on frontend.
I made a back office for a mobile app, but I'd like to create access from frontend to display information from my back office. First, I try to display single content from a custom post. I need to filter these pages by a custom ACF field equal to my current user.
And I need to check if the user has the good role. I've already configured all my Custom posts, all my ACF fields, and custom roles. I made a specific plugin for my back office.
I would like to create specific shortcodes to display the differents single views and the different lists I'll will need for my back-office..
Custom option
Value
Custom posts name
page_clubs
ACF field related
administrators
Custom role
club_administrators, or club_members
User
Current

Is there a WordPress plugin or a php code to insert a table that user can manipulate the data in it

Right now I am using the ultimate member plugin to register users. But the company asked me to change the form and allow users to insert their education qualifications in a table when registering. Users need to have a button that has the ability to insert more rows (If they have more qualifications).
As far as I know, I can't use the Ultimate Member plugin for that. I searched for many table plugins but didn't find anything that can do this task. I once had done this using code. But I don't know how to apply it to this registration form. If anyone can figure out a way to embed the code to Ultimate member (to save that table data) or any plugin that can do this, please let me know soon as possible.
Updated Question
I have tried that shortcode and got confused as it ruined the page. Now I'm trying a PHP method to solve this problem.
Thank You
Well you have many options to solve this problem. What you are actually looking for is Custom Fields.
WordPress has the ability to allow post authors to assign custom fields to a post. This arbitrary extra information is known as metadata.
Now, custom fields can be created in 2 ways.
Either you write php code in a plugin/theme
Or you you install plugin which helps you build custom fields.
What you are actually looking for is to create Repeatable Field Groups. These are the field which can be replicated. As many as you want.
Some plugins which provide facility to add them in no particular order are:
Advanced Custom Fields - Repeater Field : https://www.advancedcustomfields.com/resources/repeater/
Toolset - Repetable Field Group : https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/
Metabox - Meta Box Group : https://metabox.io/plugins/meta-box-group/
They all will give you ability to create repeater fields.
Repeater field can be made for both users and posts or Custom Post Types(CPT). You need them for Users. I am not sure which one of them allows you to create repeater field for Users but you can check on there website.
PS : These are all paid plugins. (They may have free version of them but repeater field comes with PRO).
Once you have created a field for users you can use that field in your registration form.
UPDATED ANSWER
As the question author wants to add the field using PHP, the field can be added as so.
After looking at all the hooks available to the user by UM (Ultimate Member) plugin. I found two hook that can be used to add fields and save in the backend.
um_after_form : Some actions after register form fields.
add_action( 'um_after_form', 'my_after_form', 10, 1 );
function my_after_form( $args ) {
// add your repetable fields here.
}
um_after_save_registration_details : Action on user registration after save details. This runs after the form is submited and user is registered. Use this to save data inside the user database.
add_action( 'um_after_save_registration_details', 'my_after_save_registration_details', 10, 2 );
function my_after_save_registration_details( $user_id, $submitted ) {
// Save field here.
// You have user_id and submitted data, do your thing here.
}

Add specific employee to a page in wordpress

We have created many pages in Wordpress and want to add an employee (name, phone, email etc.) to every page as responsible contact person. Now we want to add every contact person once in the backend and choose the right person in the page.
We also use Advanced Custom Fields (ACF) and could add a Field for adding the data, but it could be difficult if the employee gets a new phone number for example.
Has anyone an idea how to solve it in wordpress?
My proposition is:
Add custom post type named "Employees" to your WordPress.
Add custom fields (based on ACF) for contact data and assign them to mentioned post type.
Add post object field to your pages and assign employees post type to this field.
And it's done! Now you can assign a specific employee to your page as a post object and display data from it, like this.

Wordpress: Custom profile form not working in Ultimate member plugin

When I create a custom form for a custom user role using ultimate member plugin, it doesn't work. Only the default profile form works. Please what can be the problem. I need to create different profile forms for different types of users
The cause of this issue is that the original User page only contains the shortcode for the default profile form.
After you create all of your custom profile forms, and assign the relevant roles to each (Form Settings -> Disable Global Settings -> Select Role), you need to add the short codes of all your forms to the User page, just one after another.
UltimateMember will decide which of the forms to display depending on the user's role.
So on the view user page, add the shortcode for the custom form, in addition to the existing default profile form.
It's a bit weird to have multiple shortcodes but it will only show the one for that role.
Also make sure to assign a the Custom Role to the Custom Form, as stated by Michael Rodriguez

Wordpress custom post type structure

i am building a wordpress website for a client. i need to build 1 template type of page with a list of fields that the client can fill in to populate the page. so lets say i build a template page called Person Template. On it i have an empty picture placeholder on the left and an empty Name Field below that. On the right i have an empty "persons phone number" and "Persons email" field.
what i need to create somehow is a system that the client can enter these 4 items into wp-admin somewhere and save that as a new Person. Then they can repeat and save another Person until they have created say 100 Person pages.
How do I do this? I tried building a Custom Post Type called Person CPT. I have built a Page called Person Template. I have built some "Person CPT" posts and put them on a page but i dont know how to create the Entry Fields page for my client to use.
You're correct that you'll need to use a custom post type. To add the fields you have two options:
Add the fields using add_meta_box(). You'll then need to save this data as post meta. Then in your single-person.php template you would retrieve the meta using get_post_meta(). It's a tad cumbersome, as you need to write the markup for the meta box, hook it into an action to add it to the admin page, and verify the content before it's saved. Here's an article that walks you through it
Alternatively get yourself the Advanced Custom Fields plugin: it makes adding additional fields very quick and easy. I use it all the time.

Resources