Skip Navigation

[Résolu] Make CRED Form only available for Logged In users

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
I only want my CRED form to be available to Registered Users (i.e. logged in). How can I do that?

Solution:
1. You can do that with the

wpv-conditional

so you can hide the link and the form completely from given Roles, logged in status or even single users.

2. Or, you can do it with Access Plugin.
There, what you can do is not allow to edit, submit, and create things with the Form.

If you do it with Access, what happens when a Guest (not logged in user) visits the page and has no rights to submit the form, he / she will find an empty page (by default).
If you use the LINK to the CRED form, that Link will also not show up (by default).

Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://toolset.com/documentation/user-guides/access-control-for-cred-forms/

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.

This topic contains 6 réponses, has 2 voix.

Last updated by julieP Il y a 5 années et 2 mois.

Assigned support staff: Beda.

Auteur
Publications
#420266

I want show the log in page to users who don't have read permission for a page containing a CRED form. I can't use a content template because Layouts is active on my site.

In Access>Post Types, I've checked 'when disabled' but my only options are to return a 404 (not a good idea!) or a Page Template. The only values in the pick list for Page Template are 'None' and 'Media Template'. I've tried using it but the page is empty . What is this Media Template?

In this article:-

https://toolset.com/documentation/user-guides/limiting-read-access-specific-content/

it says I can use "a different PHP template". What does this mean? How do I create one?

Thanks

#420304

That setting relates to PHP templates.

You can create Custom PHP Template following this WordPress Codex:
https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

What do you mean, by "I can't use a content template because Layouts is active on my site."

Layouts has a Content Template Cell:
https://toolset.com/documentation/user-guides/content-template-cell/

In there you can easily use a Views ShortCode to check if the current user is logged in, and if yes present the CRED Form with it's ShortCode.
If not, present the Login form, also with it's ShortCode.
https://toolset.com/documentation/views-shortcodes/#wpv-current-user
https://toolset.com/documentation/views-shortcodes/#wpv-login-form

#420631

OK I understand about the PHP template now (sometimes it's not clear whether references are to WordPress stuff or Toolset stuff!).

I didn't think I could use the 'when disabled' feature with Layouts active because on

https://toolset.com/documentation/user-guides/limiting-read-access-specific-content/

I read this under point 3:-

"When you clear the read permission, you can choose what to output instead of the content. Your options are:

A 404 page, indicating that this content doesn’t exist (default option)
The current page, displayed using a different PHP template
The current page, displayed using a different Views Content Template (available if you are using Views plugin)

Please note that when Layouts plugin is active in your site, the Show Content Template option is not available."

I've now tried using the Views shortcodes but am having problems. I'm going to detail the issues in another thread entry so it doesn't get lost amongst my responses to your questions.

#420635

Before I detail my settings and what isn't displaying as expected, can I clarify something please?

I only want my CRED form to be available to Registered Users (i.e. logged in) so in Access Control, the CRED form is set to be readable by Registered Users only. However, the CRED form has been inserted into a Page using Layouts and I've realised I'm unclear about the required settings in Access Control for Pages. Can Registered Users be checked for just Read (given that permission for the form within the page is set under CRED forms) or do the permissions need to be extended to include Preview Any, Edit Own and Publish?

Thanks

#420818

Please put this thread on hold as I've discovered an issue that is likely to be affecting why I'm not seeing expected results for this exercise. I'll start a separate thread and come back to continue with or close this thread later.

Thanks

#420903

1. I only want my CRED form to be available to Registered Users (i.e. logged in)

You can do that with the wpv-conditional so you can hide the link and the form completely from given Roles, logged in status or even single users.

Or, you can do it with Access Plugin.

There, what you can do is not allow to edit, submit, and create things with the Form.

What happens when a Visitor (not logged in user) visits the page and has no rights to submit the form, he / she will find an empty page (by default).
If you use the LINK to the CRED form, that Link will also not show up (by default).

2. Of curse if you manage pages Post Type with Access, this wins the race.
Means, if you do not allow Role A to read pages, but have a CRED form in there that Role A should see, they will not see it, as the Page Post Type is actually not accessible by the Role A.

3. Preview Any, Edit Own and Publish in the case for Post types is related to the backend and has no influence on whether the Post Form is usable by the User.

#420973

Have to confess I've been finding Access plugin very complicated and confusing partly because of the mixture of built in WordPress functions and front end stuff provided by Access.

I think I'm getting to grips with it now though, thanks