Skip Navigation

[Resolved] Posts created in Cred form not showing in filtered view

This thread is resolved. Here is a description of the problem and solution.

Problem:
A CRED form is used to publish posts but a custom field assigned to the post type is missing from the published post.

Solution:
The field was not inserted in the CRED form and so was not added to the published post.

Auto-generating the markup for CRED forms will ensure that all fields are included in the form.

Relevant Documentation:
https://toolset.com/documentation/user-guides/creating-cred-forms/

This support ticket is created 7 years, 6 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 5 replies, has 2 voices.

Last updated by nickT-2 7 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#524149

Hi,

I've got a post type called Maintenance Issues and I've created a CRED form for users log issues.

I then have a page that lists these Maintenance Issues. The new posts are showing in the All list, but are not showing in the filtered list which is set to show only pending (using custom field) issues.

If I go into the users post and re-publish it then appears ok .. so is this a bug or something to do with permissions?

Please can you enable private info and I'll send you some links and user login details.

Thanks

#524162

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Nick

It sounds like field in question is not being updated by your CRED form.

Is it a standard Types field?

When you edit the post created by the user in the back end, is the field correctly set already?

What is the field (what field type is it)?

Do you have any custom code running that modifies your posts when saved?

I'll mark you next reply as private, but please give as many details as possible so I can narrow down what I am looking for. (And be sure to have a current backup before you reply.)

#524294

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Nick

The status isn't being set because you haven't included the status field in your form.

You have two forms, one to create Maintenance Issue posts, and one to edit them. The status field is included in the edit form (which is the one you linked to in your previous answer), but is not included in the form to create issue posts (which is the form included on the page you linked to).

So when the issue is initially posted with your create issue form the field is not set. When you edit the issue post in the back end, as the radio field only has two options (no "not set" option) one of these is set when you update the post.

#524344

Hi Nigel,

Thanks for having a look. The reason I haven't included the status field is because in the custom field settings it is set to required and default value of 'pending'.

This seems to have been working until a few weeks ago. Maybe an update has changed something.

So if it is needed to be in the form please can I check two things:
- how do I set a default pre-selected setting?
- how do I then hide this field on the form so the browser doesn't see it?

Thanks

#524670

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screen Shot 2017-05-16 at 10.15.07.png

Hi Nick

When you set up the radio field in Types you can specify the default value (see the screenshot for an example).

If you don't want the users to see the field in the form the easiest option is to use CSS to hide it.

In the CRED form, if you auto-generate the markup then the whole radio field content should have a class "cred-field-slug" (e.g. "cred-field-status") which you can use to add a CSS rule of, say,

.cred-field-status {
  display: none;
}

Or you can manually add an id or class to the markup to target the field.

Note if there were a security issue involved here where it was imperative that users could not use the browser dev tools to modify the field which you have hidden with CSS then the solution would require you running code on the server after the form was submitted to set the field.

#524675

Great idea ... thank you.
All working now.