Skip Navigation

[Resolved] Add CRED User Form on a page with CPTs authored by the user

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

Problem: I have placed a CRED form on a page that shows several CPT posts by the current User, but the form does not show up.

Solution: Check the Access settings for this form and User to ensure the User has permission to use the CRED form.

This support ticket is created 6 years, 5 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 16 replies, has 3 voices.

Last updated by carlosB-2 6 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#904398
presenter-returning.jpg

Tell us what you are trying to do?

I'm trying to add a small User CRED Form to ask a User type, Presenter, if they will be returning to this year's event. (This site manages presenters and workshops for an annual theatre convention). I'm trying to use it within a View that's tied to the Workshops CPT, so I need to reference the author of the CPTs who is also the logged in user.

The User Form just doesn't appear, when I've inserted it into the view. here's the content for the user Form

<div class="single-line-form alert-box">
[creduserform class='cred-user-form cred-keep-original']
[cred_field field='form_messages' value='' class='alert alert-warning']
<label class="main-label">Will you be participating in the [current-year] ThesCon?</label>[cred_field field='prsntr-participation-currrent-year' post='user' value='' urlparam='' output='bootstrap'][cred_field field='form_submit' value='Submit' urlparam='' class='btn btn-secondary' output='bootstrap']
[/creduserform]
</div>

#904545

Hi, can you tell me some more information?
- Place the CRED edit User form shortcode somewhere else on the site, like a custom Page, where the User can access it. Is the form displayed as expected here?
- Are you using Access? If so, does the User have permission to submit this form and edit his own User profile?
- Are the 3 yellow background forms the same CRED form shown 3 times, with conditional logic, or different CRED forms?

#904577

Hi Christian-

It was Access! I haven't touched this site much since last year and forgot that I was using Access.

When I first was loading the page, I was getting a line just below the CRED User form that says "Form type and post type do not match" but then it went away.

So I think I'm good... I have more tinkering to do with the page, as I don't want the rest of the page to load unless they have indicated that that they are returning, but I'm pretty sure I can get that working.

Thanks for your help Christian.

#904602

A problem has cropped up with what happens after the form is submitted... I'm choosing "Display a message instead of the form..." with conditional statements -- I wanted to show different content depending on what they selected in the form..

[wpv-conditional if="( '[wpv-user field='wpcf-prsntr-participation-currrent-year']' eq 'Yes' )" ]
<section class="alert-box bottom-margin">
<p>We're happy to hear that you will be returning for the [current-year] ThesCon!</p>
<p>If you decide you need to change your choice, click the My Profile button at the top right.</p>
<p>Feel free to update your profile information by clicking the Edit My Profile button at the top right—being sure to save your changes by clicking the Update My Information button at the bottom of that page.</p>
</section>
[/wpv-conditional]

[wpv-conditional if="( '[wpv-user field='wpcf-prsntr-participation-currrent-year']' eq 'No' )" ]
<section class="alert-box bottom-margin">We're sorry to hear that you will not returning for the [current-year] ThesCon<br>
<br>
If you decide you need to change your choice, click the My Profile button at the top right.
</section>
[/wpv-conditional]

And that worked a couple times, but then it stopped working. I get nothing displayed after the form is submitted and I see the "being redirected" message. I tried making it just a simple "Thanks for letting us know." message and that also doesn't get displayed.

I reset the message to the content I show above and tried it on a test page where the CRED User form is not in the middle of a view (and within a conditional statement also) and it does work there, showing the different content depending on whether I select Yes or No in the form.

I'm stuck on what might be causing the form to display, but not the message after the form has been submitted.

Thanks for your help.

#904611

What is the AJAX submission setting for the CRED form? Does the behavior change if you switch to or from AJAX submission?

#904612

I have AJAX submission enabled, but tried it with and without that, and the same thing happened... it didn't display the message.

#904613

Try the types usermeta field syntax instead, and specify that you want the information for the current User like this:

[wpv-conditional if="( '[types usermeta='wpcf-prsntr-participation-currrent-year' user_current='true'][/types]' eq 'Yes' )" ]
<section class="alert-box bottom-margin">
<p>We're happy to hear that you will be returning for the [current-year] ThesCon!</p>
<p>If you decide you need to change your choice, click the My Profile button at the top right.</p>
<p>Feel free to update your profile information by clicking the Edit My Profile button at the top right—being sure to save your changes by clicking the Update My Information button at the bottom of that page.</p>
</section>
[/wpv-conditional]

[wpv-conditional if="( '[types usermeta='wpcf-prsntr-participation-currrent-year' user_current='true'][/types]' eq 'No' )" ]
<section class="alert-box bottom-margin">We're sorry to hear that you will not returning for the [current-year] ThesCon<br>
<br>
If you decide you need to change your choice, click the My Profile button at the top right.
</section>
[/wpv-conditional]

If this doesn't work as expected, then please add debug="true" to each conditional so we can get a better idea of what is going wrong.

#904622

Hi Christian-

I tried that with no success. It's also not working on the Test Page either.

I have to head out for a few hours, but will add the debug="true" to the conditionals and see what I get.

Thanks... will reply more later.

#904623

Okay thanks...I just noticed that there are 3 r's in "currrent" in the field slugs, so please doublecheck the spelling there.

wpcf-prsntr-participation-currrent-year

I'll stand by for your followup.

#904715

Hi Christan-

I've done the following things... I deleted the custom field that had the three "r"s in there, and created a new custom field, wpcf-prsntr-participation-this-year.

I updated that field name in the CRED User form, and that part is working -- the form updates the value for that field, but I'm still having problems with the message to be displayed after the form is submitted.

When I have the two conditional statements, it doesn't display on either the test page (where there's nothing other than this form), nor does it work on the page where the CRED User form is inserted within conditional statements in a view that displays multiple workshops presented by the user that's logged in.

I added debug="true" to both conditional statements, and still, nothing appears when I submit the form on the Test Page (the page with just the CRED user form on it. Here's what the message to display says:

[wpv-conditional debug="true" if="( '[types usermeta='wpcf-prsntr-participation-this-year' user_current='true'][/types]' eq 'Yes' )" ]
<section class="alert-box bottom-margin">
<p>We're happy to hear that you will be returning for the [current-year] ThesCon!</p>
<p>If you decide you need to change your choice, click the My Profile button at the top right.</p>
<p>Feel free to update your profile information by clicking the Edit My Profile button at the top right, being sure to save your changes by clicking the Update My Information button at the bottom of that page.</p>
</section>
[/wpv-conditional]

[wpv-conditional debut="true" if="( '[types usermeta='wpcf-prsntr-participation-this-year' user_current='true'][/types]' eq 'No' )" ]
<section class="alert-box bottom-margin">
<p>We're sorry to hear that you will not returning for the [current-year] ThesCon</p>
<p>If you decide you need to change your choice, click the My Profile button at the top right.</p>
</section>
[/wpv-conditional]

Just on a side note... there isn't an "else" option within the wpv-conditional shortcode, is there... I have to create two separate conditional tests to get different results, right?

Thanks again for your help.

#905203

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Carlos,

Christian has a national holiday today but will be here tomorrow to continue providing support on this one.

Thanks,
Shane

#905216

Thanks Shane... that's what I thought.

I will take advantage of this to update a couple of things for Christian.

I tried going back to using [wpv-user field='wpcf-prsntr-participation-this-year'] in the conditional statement, and now it works on the Test Page (where there's nothing else on the page), but still doesn't work as part of the view.

Thanks.

#905522

Okay thanks for the update. At this point, I think it is probably best for me to log in and create a clone of your site using the Duplicator plugin so I can run some additional tests. If that's okay with you, please provide login credentials in the private reply fields here.

#906141
Screen Shot 2018-05-30 at 7.54.48 AM.png

The conditionals in the View are the cause of the problem here. Look at the screenshot I have attached. You can see that the cred_user_form shortcode in this View is wrapped in two nested conditionals:
- field not equal to "Yes"
AND
- field equal to ""

In other words, the CRED user form is only rendered if the field value is not set to any value. When a User submits the form, the value becomes set to something (Yes or No), so the form is no longer shown because of the conditionals. This is why the message is not displayed after the form is submitted.

#906412

Hi Christian-

Thanks for the clarification on that. I moved the conditional statements out of the user form's "Message to display" and put them in the View after the form, and that is working the way I want.

But now, I'm trying to do something else, which is to not display the rest of the page (starting with My Workshops and going all the way down to the end) until the presenter has clicked Yes indicating that they will be participating in this year's conference.

I tried using the same nested conditionals wrapped around the

[wpv-layout-start] ... [wpv-layout-end]

and that seems to completely break the view.

That's how I have it set right now, if you're able to take a look at that page.

Thanks,