Skip Navigation

[Resuelto] [wp-if] does not work with CRED

This support ticket is created hace 9 años. 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
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 respuestas, has 2 mensajes.

Last updated by jamesH-3 hace 8 años, 12 meses.

Assisted by: Waqas.

Autor
Mensajes
#268749

I am trying to ensure:
* admin can submit the form
* users with membership status "Pending" cannot see the submit button
* users with membership status "Confirmed" can see the submit button and submit the form

I used the codes below, however, only the first part for administrator works and second and the third part does not work at all. (they are the same codes I previously used in some of my other views and they are currently working fine. Somehow it does not work with CRED)

[wpv-if evaluate="'[wpv-current-user info="role"]'='administrator'"]

[cred_field field="form_submit" value="Submit" urlparam=""]

[/wpv-if]

[wpv-if membershipstatuscondition="wpcf-membership-status" evaluate="$membershipstatuscondition='Confirmed'"]

[cred_field field="form_submit" value="Submit" urlparam=""]

[/wpv-if]

[wpv-if membershipstatuscondition="wpcf-membership-status" evaluate="$membershipstatuscondition='Pending'"]

You are not allowed to change your business details because your membership is currently pending approval.

[/wpv-if]

Thanks

#269027

Waqas
Supporter

Languages: Inglés (English )

Timezone: Asia/Karachi (GMT+05:00)

You can use following alternative syntax also, using direct evaluation:

[wpv-if evaluate="'[types user_meta="membership-status"][/types]' = 'Confirmed'"]
	[cred_field field="form_submit" value="Submit" urlparam=""]
[/wpv-if]

if "membership-status" isn't attached with user account and is a custom field with a post, you can replace [types] short code as below:

[wpv-if evaluate="'[types field="membership-status"][/types]' = 'Confirmed'"]
	[cred_field field="form_submit" value="Submit" urlparam=""]
[/wpv-if]

Please notice the surrounding quotes around the left hand side of the expression, also. This is required when you want to match the string value of field with another string.

On the other hand, please read "Conditional Display for Form Inputs" at https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/ - that offers CRED's built-in feature around this.

#269283

Hi Waqas

"membership-status" is a custom field so I tried:

[wpv-if evaluate="'[wpv-current-user info="role"]'='administrator'"]

[cred_field field="form_submit" value="Submit" urlparam=""]

[/wpv-if]

[wpv-if evaluate="'[types field="membership-status"][/types]'='Confirmed'"]
[cred_field field="form_submit" value="Submit" urlparam=""]
[/wpv-if]

[wpv-if evaluate="'[types field="membership-status"][/types]'='Pending'"]
You are not allowed to change your business details because your membership is currently pending approval.
[/wpv-if]

It's still not working?

Thanks

#269609

Waqas
Supporter

Languages: Inglés (English )

Timezone: Asia/Karachi (GMT+05:00)

Can you please send me a temporary access to your website? So I can look into the matter and can try to fix it.

I have enabled the private area for your next reply, please input details in that area. Also remember to take a backup of your site.

#269695

Hi Waqas

I worked it out myself mate.

Thanks for your time

Zaf

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.