Skip Navigation

[Resolved] Forms – Assign a category or taxonomy based on logged in user

This support ticket is created 3 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 3 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#2216157

Tell us what you are trying to do?

I would like to build a website for photographers.

First question:
I would like to make a form the add a new photographer for the website. By adding the new user, a new category or taxonomy field should be added automatically based on the new username. So suppose I add user John Doe, automtically a new category or taxonomy field called 'john-doe' is added to the Custom Post Type Photoalbum.

Second question:
Each photographer should be able to log in and add photos to his/her own photoalbum (a Custom Post Type). I want to create a form so user can upload a photo. On the form to upload a new photo I would like to automatically assign a category or taxonomy based on the user who is logged in. Suppose the authors name is John Doe, the category or taxonomy field added automatically to the post should be called: john-doe
How can I make sure the category or taxonomy field is automatically filled in with proper value 'john-doe'?

Links below give some direction, but examples are not exactly what I want:
https://toolset.com/forums/topic/force-taxonomy-to-be-required-in-cred-post-form/
https://toolset.com/forums/topic/show-only-terms-created-by-current-user-in-taxonomy-dropdown-on-the-form/

What is the link to your site?
This is a pre-sale question. If there is a solution I will buy Toolset.

#2216465

Hello,

There isn't such kind of built-in feature within Toolset, it needs custom codes, for example:
1) After new user created, you can use action hook "user_register" to trigger a PHP function:
https://developer.wordpress.org/reference/hooks/user_register/

2) In this PHP function:
- get the user's username value:
https://developer.wordpress.org/reference/functions/get_user_by/
- Add a term into your custom taxonomy
https://developer.wordpress.org/reference/functions/wp_create_term/

for your reference.

#2219197

Hello,

Building a directory-listing/membership website requires ability to add, edit and delete users (including content uploaded by user) easily. This is even a requirement from GDPR point of view.

Is there some guidance how to build such a website? As an administrator I want users to be in control as much as possible. So users should be able to register, edit account and delete there account (including uploaded content) themselves. Could Toolset write documentation how to build such a website? This would help more people buying your product.

I hope Toolset consider this suggestion.

Regards, Fred

#2220879

You can follow our document to setup user forms:
Register users:
https://toolset.com/course-lesson/creating-forms-for-registering-users/
Edit user:
https://toolset.com/course-lesson/using-forms-to-create-an-edit-your-profile-page/
Delete user, it needs little custom codes, see the solution of below similar thread:
https://toolset.com/forums/topic/add-the-link-delete-account/