[Résolu] Displaying link to PDF while restricting access only to logged in users
Ce fil est résolu. Voici une description du problème et la solution proposée.
Problem:
The issue here is that the user wanted to hide particular contents from their guest users.
Solution:
This can be done by using our access plugin. I would recommend that you have a look at our access documentation for a guide as there are multiple way to hide contents from a guest. https://toolset.com/documentation/user-guides/access/
This support ticket is created Il y a 6 années. 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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
I'd like to restrict access to PDFs file downloads, BUT I still want all users to be able to view the link/buttons and only when they attempt to select it, for a box message to appear stating that the content is available only to logged in users, please register/login.
Is this assuming i've already created another view for members only? and is the next instruction:
"Inside your [toolset_access] shortcode you can include your message directly or insert a Content Template." Assuming I remove the "[wpv-post-body view_template=”members-only”]" bit, to insert the content template? or what exactly does this look like to insert the template?
For example of my site page in question, See: lien caché (and scroll down to bottom of "you've hired" section). I would like a PREVIEW image/link of these documents to show to EVERYONE, whether logged in or not, however upon clicking, I'd like them to be available FOR DOWNLOAD only to logged in members (any role with exception of guest)
Shane, sorry, you are not understanding me somehow. you are correct, they get nothing when I do it that way. But I DON"T WANT them to get nothing. I need for them to get the login page with a message;) And then after login, for them to immediately see the document they were trying to access
Currently, when I'm logged in, I can then access this document, so I know the link will work for logged in users already.
No Shane, when they are already on that page (lien caché), under the inteview section of that post for this example, there are two PDF link buttons. (please look) Users need to be able to click on either PDF preview (at the end of that section) and, if they are already logged in, it should go right to the download page/list, and if they aren't, it should prompt them to login (with a message saying this access is available to logged in members etc....) and then immediately after logging in, it should show/redirect the PDF dowload list for logged in members. 1) (is there an easy way to skip the list page and go directly downloading an individual download associated with a specific link?)
So far I can get the login page to appear. Current problems are:
2) now the downloads list is showing the same English version file twice, opposed to one english and one Thai (even though in the list one of the files says Thai, but it opens to the english. So I assume the view I have created is incorrect as I don't really understand what it should look like. Please see my screenshot for what I have and please let me know how to fix it. Ideally I'd prefer not showing the entire list, but one individual file only each time. Post level control opposed to Category level? But I'd like to understand how to do either. Surely I don't need a separate view for every since individual PDF download (in order to add id)? Please see image of my view. I'm not sure also how to add a message inside shortcode regarding access permissions for non-logged in users. (see screenshot #1)
In your case there is no way of us knowing atleast not easily which pdf file the user clicked on 🙁 so we wouldn't be able to redirect them to that exact download that they want.
I'm assuming the pdf is stored on the CPT ? we may be able to redirect to the post itself where they can download the file.
Next from what I see i'm seeing both files, is this a translated file ? Are both files uploaded to the same post ? You say you are using a view to display the file.
However are there any markings that can let view know which file it should display instead of both ? Unless I know how the file itself is stored then i'm not able to suggest an accurate answer.
Finally for you second shortcode in the image. Instead of having your user roles, set it role ='Guest' only and then set the operator = 'allow'
1) Correct,both PDFs are stored in the CPT. If it's far easier just to do a list, I'm ok with that I guess.
2) Yes, one file is a translation of the other (two individual files)
3) Yes, following the documentaion I am using a view to display the files, but this is the main thing I don't understand, I don't know what should be in the view to display various files, do I have to update the view each time with a new page id. that doesn't seem efficient. And the documentation isn't clear on how to do this. Please see the screenshot of the View I sent you last time. Is there another way I should be displaying the file? No, from my very limited beginner knowledge, it seems like the post ids for every post would have to show up in the view as per the documentaion, but there must be another way to distinguish between files? (surely I don't need a separate view per each file?)
4) When you say "instead of having your user roles" do you mean within Toolset Accer>custom roles, I need to not use Logged in user permissions for this, or do you mean as I've done in the other screenshot below? (just removing all the admin, editors etc.?)
I'm happy to give you access to my dashboard if that helps:)
Lets try to tackle one issue at a time because i'm concerned that information can be lost due to miscommunication or misinterpretations.
So first I noticed this page lien caché
It's not available for users who are logged out. From what I see you've already added it to a post group which takes care of the page not being able to be viewed by guests, so no issue to fix here.
Secondly on this page lien caché
I checked and see that you are using divi elements and manually linking them to their files. Unfortunately with a setup like this we aren't able to conditional it, unless divi itself has a way to this.
Sorry, at the lien caché, your right, I had initially set those links manually, and just hadn't changed them, as I wasn't sure what making them conditional links actually looks like. I changed the ones in the interview section as a test, but wasn't sure if I had done that right.
From your response the time before last, you said you "recommend that you do is to add a custom field or taxonomy to mark which PDF is English and which one is in Thai." Please see screenshot. Is this what you mean? With in the CTP for Downloads?
I had to hire a contractor to help me, because after 10 days of back and forth, I still didn't get my main question answered (I believe I was quite clear in what I needed answered) of what is the view actually supposed to look like for my needs? (i.e. what's wrong with the view I've created). The documentation is not clear/doesn't give good examples for this step, so I was basically able to figure out basically everything else but got stuck and unable to finish based on this one step remaining unanswered.