We don´t know how to relate the wordpress user registration to a Custom Post type Member so we can relate this member to other CPT , see image attached the wp-user box and the Member CPT, this is what we would like to do.
link to site hidden link
Hi, there are several ways to link a WordPress User to a post.
1. Make the User the author of the post.
2. Use a custom field to store a reference to the related item. For example, you can create a custom field on the CPT Member post that holds the related WordPress User's ID. Or you can create a custom field on the WordPress User profile that holds the matching Member's post ID.
3. Use a custom taxonomy that includes a term for each User, and apply that term to each related post.
Each option has its own pros and cons, so it often depends on your site requirements. I think #2 is usually the most practical.
I used woocommerce for the user login and then a shortcode to pass the user ID to the member table CPT, so I can use all the frontend account pages from woocommerce , could you give me a hint if I would have problems in the future using this strategy ?
...and then a shortcode to pass the user ID to the member table CPT
I don't understand what this means, could you be more specific about this?
Yes, thank you for asking:
1. I use the woocommerce form to create a user
account,
2. Then I use a second form made with CRED for a CPT
called member account
Then the steps are:
--> The site managers goes and creates a new user
account (email, first name, password) through the
woocommerce default my-account form,
--> Then in the CRED form (member CPT) one of the
custom fields is "user ID"
--> for this field I used a view shortcode to auto
populate the field
[wpv-current-user info="ID"]
When the manager wants to add a new member he needs to
log out and fill up the user woocommerce form first,
create the user, and then go to the second form
(CRED, Member CPT) and the user ID wordpress, will
auto populate in the member CPT.
Then I can relate all the other tables with this
current-user info="ID" from the member CPT .
I wonder if this strategy is one way to do it or will
give me problems that I can´t see now, thanks a lot
for your reply.
When the manager wants to add a new member he needs to
log out and fill up the user woocommerce form first,
create the user, and then go to the second form...
The manager must be logged in as the new User before submitting the second form. Otherwise, the new Member will not be linked to the correct User. I'm not sure how your User form works, but it may or may not automatically log in the new User account. Other than that, sounds okay to me.
thanls a lot for your quick support!!