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.
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.)
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.
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?
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.