Skip Navigation

[Resolved] Populating a custom field with admin users

This support ticket is created 4 years, 2 months 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)

Author
Posts
#1808663

Hi,

2 questions:

1) I have created a cpt called Notes which is a child of Posts, so Notes can be added to Posts (note name, due date, note status). I'd also like to be able to also have a field to select an Admin or an Editor user to apply/assign to each Note. So I was thinking I could possible create a checkboxes or select field and then somehow auto-populate it with all users of those 2 roles Is this possible?

2) Is it possible to somehow have this Notes cpt trigger an email reminder X days before the "due date" field is reached?

Thanks,

Tim

#1809949

Hello,

Q1) If you are going to setup one-to-one relationship between "Notes" post and WordPress users, the best option is using WP built-in feature post author, you can try these:
1) Edit post type "Notes", in section "Sections to display when editing", enable option "Author".
2) Edit each "Notes", you can setup the post author of it.

Q2) This is possible with Toolset Forms plugin, see our document:
https://toolset.com/course-lesson/setting-up-automatic-post-expiration/
section "Sending email notifications when posts expire", screenshot:
https://toolset.com/wp-content/uploads/2014/08/cred-post-expiration-notification-options-1.png

#1810975

Thanks, that sort of works, but if I want to create or edit a Note from within a Blog post, I can only edit the custom fields, I would not be able to add/change the Note Author.

hidden link

Tim

#1811013

There isn't such kind of built-in feature within Toolset Types plugin, as I mentioned above, you need to edit each single "Note" post, and setup it's post author.

#1811017

oh, you mean I would have to set the Author manually? There's no way an Author select field can be added to a Toolset form?

I'm sure I've seen other forum topics about adding cred forms and adding author select fields to forms... no?

Tim

#1811957

There isn't such kind of built-in feature within Toolset plugins, it needs custom codes, for example, you can create a custom select field, use filter hook "wpt_field_options" to trigger a custom PHP function:
https://toolset.com/documentation/programmer-reference/types-api-filters/#wpt_field_options

Get the WordPress users you want, and populate the select field options:
https://developer.wordpress.org/reference/functions/get_users/

Then put above custom field into your post form for creating new Notes.

After user submit the form, use action hook "cred_save_data" to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

In above PHP function, update the post author to the specific user:
https://developer.wordpress.org/reference/functions/wp_update_post/

For your reference.

#1819733
#1819779

OK, please let me know if you need more assistance for it. thanks