Skip Navigation

[Gelöst] Displaying link to PDF while restricting access only to logged in users

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 5 Jahre, 4 Monate. 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 11 Antworten, has 2 Stimmen.

Last updated by Jas vor 5 Jahre, 4 Monate.

Assisted by: Shane.

Author
Artikel
#1141064

Jas

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.

I am following your documentation:
https://toolset.com/learn/create-membership-site-wordpress-using-toolset-plugins/restricting-access-downloadable-files/
Perhaps this is all I need, however I i'm finding the last step, Step 4 unclear as to how to actually implement it. Step 4 says:
"There are two ways you can handle this

Use the same conditional-text feature of Toolset Access you used previously, in Step 4, but this time with the deny operator:

[toolset_access role=”Administrator,Premium member,VIP member” operator=”deny”]
[wpv-post-body view_template=”members-only”]
[/toolset_access]
"

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:
hidden link (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)

#1141497

Shane
Supporter

Languages: Englisch (English )

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

Hi Jas,

What you can do is to write the oppose of this.

Example
[toolset_access role=”guest” operator=”allow”]

<a href='#'>Download</a>
[/toolset_access]

Instead of having an automatic link you will build a manual one and when they click the link they will get nothing at all.

Thanks,
Shane

#1143603

Jas

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.

#1143965

Shane
Supporter

Languages: Englisch (English )

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

Hi Jas,

Before I can suggest a solution.

You would like them to get redirected to this page after logging in ?
hidden link

Please let me know.

Thanks,
Shane

#1145162

Jas
pdf download page.png
view for downloadable pdf for members.png

No Shane, when they are already on that page (hidden link), 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)

#1145222

Shane
Supporter

Languages: Englisch (English )

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

Hi Jas,

Thank you for the clarity.

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'

Please let me know if this helps.

Thanks,
Shane

#1145517

Jas
page for view.png
downloads cpt.png

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:)

#1146069

Shane
Supporter

Languages: Englisch (English )

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

Hi Jas,

What I recommend that you do is to add a custom field or taxonomy to mark which PDF is English and which one is in Thai.

This way we can filter them using views and only display the one you want.

Yes please provide admin access to the website as well as a link to the page where you are using the access shortcode for the pdf display.

Thanks,
Shane

#1146602

Shane
Supporter

Languages: Englisch (English )

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

Screenshot 2018-11-14 at 10.31.01 AM.png
Screenshot 2018-11-14 at 10.31.08 AM.png

Hi Jas,

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 hidden link

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 hidden link

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.

Thanks,
Shane

#1147272

Jas
screenshot categories 02.png

Sorry, at the hidden link, 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?

thanks!

#1147364

Shane
Supporter

Languages: Englisch (English )

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

Hi Jas,

This is what I mean.

Now that you have something that marks the language, you can use views to filter between which one you want to display.

Thanks,
Shane

#1148948

Jas

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.

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