Skip Navigation

[Resolved] Check if user have right to access cred_form

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

Our next available supporter will start replying to tickets in about 0.73 hours from now. Thank you for your understanding.

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 3 replies, has 2 voices.

Last updated by Nigel 6 years, 10 months ago.

Assisted by: Nigel.

Author
Posts
#607871

Hello

I just wondering if it is possible to check if user have appropriate right to edit post content using particular CRED form.
If not, I would like to show some message or even redirect him
Please advice

Thank you

#607895

Nigel
Supporter

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

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

Hi there

If you add Access to your set-up then you can set rules for which roles have permission to use which CRED form (publish forms, edit forms, for either post or user forms).

The details are described here: https://toolset.com/documentation/user-guides/access-control-for-cred-forms/

Let me know if you have any problems setting it up.

#607907

Hello

I am ok with the access control, but I meant that I would like to check it before I try to show the form
somethink like

if ( cred_form_id_allow_for ($userID) {
 do_shortcode([cred_form form="..."])  } else {
  echo "Access restricted!";
}

or kind of shortcode/conditional output approach

#607926

Nigel
Supporter

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

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

Is this based on user roles?

If so then you can just use the toolset_access shortcode to wrap where you insert the CRED form.

You'll need to insert that twice, one to handle the case where they are allowed to use the form (insert the form), the other for when they are not (display a message instead).

See https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/