latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Restriction to file downloads by Username

Home Forums Community Forum Restriction to file downloads by Username

This topic contains 17 replies, has 3 voices. Last updated by  Narek Ambar 3 years ago.

Topic Author Topic
Posted: Tuesday Dec 10th, 2013 at 2:39 pm #61797

Hello,

I’ve watched the full file download video and have searched the forums and I can’t seem to find the answer to this.

I am an audio engineer and I want each of my clients to have access to only their own songs (which I will upload.)

When a client makes an account and has their own page, how can they only see THEIR files to download. How can I put some kind of tag or something on the file to make ONLY available to a certain username and automatically have it show up on their page when they log in?

Any help would be greatly appreciated. Thanks!

List Of Topic Replies

Viewing 17 replies - 1 through 17 (of 17 total)
Author Replies
Author Replies
Posted: Tuesday Dec 10th, 2013 at 10:08 pm #61806
David Welch
Username: dwbiz05

My understanding is that this is not a normal function of the downloads option.

How are you storing/uploading your files and how are you setting up your download links?

Dave

Posted: Wednesday Dec 11th, 2013 at 3:35 pm #61825

Dave,

Thank you very much for your reply.

I watched the videos so I do have an understanding of how to set things up, but it only has the levels, which wouldn’t work in my situation.

Here is the situation: I am an audio engineer and would like each of my clients to have access to only their files when it’s done being mixed. I want them to be able to download only their songs, once they log in to their account.

Here is what I want to do:
I will personally be making accounts for my clients, and I will be giving them their username/passwords. I can upload the files wherever they need to be with any hierarchy (I’m open to uploading them anywhere safe/secure, I do need guidance on this). Once they log in, I want s2member to somehow filter through all the files that are uploaded and ONLY show the user their files.

For example: I create a user called “Dave” with a password I select and give to you as the client. Once you login, I want s2member to understand that “Since Dave logged in, I should only show Dave.mp3 and not Jon.mp3, or Mike.mp3, etc…” How can I make s2member understand which files to show based on Username (or any other tagging/filtering method?)

Is there a way I can do all this?

Thank you for your time, I do appreciate the help.

-Narek

Posted: Wednesday Dec 11th, 2013 at 6:29 pm #61834
cassel
Username: cassel

Since you create the accounts manually, maybe you can use ccaps and limit the “Dave” user to any content with “Dave” as ccaps. This content can then be the link to Dave.mp3
Then, you just use a conditional so that this person can only see the content assigned to their own ccaps.

Something like this:

[s2If current_user_can(access_s2member_ccap_Mike)]
Display all of Mike’s files
[/s2If]
[s2If current_user_can(access_s2member_ccap_Jon)]
Display all of Jon’s files
[/s2If]
[s2If current_user_can(access_s2member_ccap_Dave)]
Display all of Dave’s files
[/s2If]
[s2If current_user_can(access_s2member_ccap_Frank)]
Display all of Frank’s files
[/s2If]

Would that work?

Posted: Wednesday Dec 11th, 2013 at 7:51 pm #61837
David Welch
Username: dwbiz05

The “simplest” way I can think to do this is use the custom capabilities option.

S2member doesn’t iterate through a downloads folder. You have to actually create each download link yourself.

I would suggest giving each client user a specific custom capability like “dave”, “mike”, etc.

Then put all the download links on one page with the CC shortcodes like this:

[s2If current_user_can(access_s2member_ccap_dave)]
	[s2File download="dave.mp3" download_key="true"]
[/s2If]

[s2If current_user_can(access_s2member_ccap_mike)]
	[s2File download="mike.mp3" download_key="true"]
[/s2If]

[s2If current_user_can(access_s2member_ccap_frank)]
	[s2File download="frank.mp3" download_key="true"]
[/s2If]

This way, you only create one download page, placing all the file download links on one page but they are protected by custom capabilities of the user.

Does that make sense?

Dave

Posted: Wednesday Dec 11th, 2013 at 7:52 pm #61838
David Welch
Username: dwbiz05

HAHA! I should have refreshed the page… all that work for nothin. lol

Dave

Posted: Wednesday Dec 11th, 2013 at 8:05 pm #61842
cassel
Username: cassel

Funny how we both added Frank as another name!

Posted: Wednesday Dec 11th, 2013 at 8:09 pm #61843
David Welch
Username: dwbiz05

ha! didn’t notice that. nice. lol!

Posted: Wednesday Dec 11th, 2013 at 8:10 pm #61844

Hey Cassel,

Thank you for the reply, I created a two accounts just to try this method out.

I created “Dave” and “Mike” filling out standard wordpress stuff and ONLY the custom capabilities field in the s2member section. For Dave I put “dave” and “mike” for Mike.

I made 2 folders inside the “s2member-files” called “access-s2member-ccap-dave” and “access-s2member-ccap-mike”

I uploaded each persons files (for mike I uploaded 2 files and for dave I uploaded 1 file)

I copied the code that you mentioned and it worked when I logged in with each member. (It displayed the text for each member accordingly.)

I changed the text to a link…

http://www.mydomainname.com/?s2member_file_download=access-s2member-ccap-mike/exact_file_name.mp3”

…and its not loading when I press play. What kind of link can I put for it to not be a player and just a download link. I tried creating a regular “a href=” link with the above link inside it saying “Song Name Download Click Here” for example and when I log in, there is no text. It’s completely blank.

Also, in my admin account on the “My Account” page (the only page that belongs to each particular member) do I have to put everyones accounts’ IF statements and files? Does

[s2If current_user_can(access_s2member_ccap_mike)]
http://www.mydomainname.com/?s2member_file_download=access-s2member-ccap-mike/exact_file_name.mp3
http://www.mydomainname.com/?s2member_file_download=access-s2member-ccap-mike/exact_file_name.mp3
[/s2If]
[s2If current_user_can(access_s2member_ccap_dave)]
http://www.mydomainname.com/?s2member_file_download=access-s2member-ccap-mike/exact_file_name.mp3
[/s2If]
[s2If current_user_can(access_s2member_ccap_frank)]
http://www.mydomainname.com/?s2member_file_download=access-s2member-ccap-frank/exact_file_name.mp3
[/s2If]
[s2If current_user_can(access_s2member_ccap_chris)]
http://www.mydomainname.com/?s2member_file_download=access-s2member-ccap-chris/exact_file_name.mp3
[/s2If]

So on and so forth?

Posted: Wednesday Dec 11th, 2013 at 8:21 pm #61846

Lol I should have refreshed the page, okay okay, let me try David’s method. The frank thing was pretty funny though.

Please disregard my last message. I will get back very shortly.

Again I really appreciate the help fellas!

Posted: Wednesday Dec 11th, 2013 at 8:27 pm #61848

Ya I just tried David’s method, and double checked to make sure it’s all correct and matching, but when I log in with a user to download their song, it doesn’t show anything. All white, just blank…

I’m confused. Everything makes sense, but I can’t see anything at all. I even logged in with my admin account and the white space is bigger. So there’s something there, but it doesn’t show.

I tried using the Chrome Inspect tool to change the color via CSS but no luck. you can highlight the lines as if something is there, but nothing is there.

  • This reply was modified 3 years ago by  Narek Ambar.
Posted: Wednesday Dec 11th, 2013 at 8:28 pm #61849
David Welch
Username: dwbiz05

NOTE: if you are trying to play the file right there instead of downloading it, you might have to add inline=”yes” to get it to work like this:

[s2File download="mike.mp3" download_key="true" inline="yes" /]

I don’t use downloads much so I’m not 100% sure how this works. lol :)

Dave

Posted: Wednesday Dec 11th, 2013 at 8:30 pm #61850
David Welch
Username: dwbiz05

What does your code look like?

Posted: Wednesday Dec 11th, 2013 at 8:50 pm #61855

I don’t necessarily need it to play right there, just a download link saying “song name download” is fine.

Here’s my whole “My Account” page copy pasted.

Welcome to your account, [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /]

You can download your files below:
[s2If current_user_can(access_s2member_ccap_mike)]
	[s2File download="Do_The_Math.mp3" download_key="true"]
  [s2File download="I_Own_It.mp3" download_key="true"]
[/s2If]

[s2If current_user_can(access_s2member_ccap_omar)]
	[s2File download="Feel-Real.mp3" download_key="true"]
[/s2If]

[s2If current_user_can(access_s2member_ccap_em)]
	[s2File download="mike.mp3" download_key="true"]
[/s2If]

[s2If current_user_can(access_s2member_ccap_jon)]
	[s2File download="frank.mp3" download_key="true"]
[/s2If]

[s2If current_user_can(access_s2member_ccap_chris)]
	[s2File download="dave.mp3" download_key="true"]
[/s2If]

[s2If current_user_can(access_s2member_ccap_champ)]
	[s2File download="mike.mp3" download_key="true"]
[/s2If]

[s2If current_user_can(access_s2member_ccap_brandon)]
	[s2File download="frank.mp3" download_key="true"]
[/s2If]

<hr noshade="noshade" width="100%" />

You can update your profile below:
[s2Member-Profile /]
Posted: Wednesday Dec 11th, 2013 at 8:56 pm #61856
David Welch
Username: dwbiz05

What is the direct url to those files? Where do you have them stored?

Posted: Wednesday Dec 11th, 2013 at 9:36 pm #61860

For example one of them in Mike’s folder is at

http://mydomainname.com/wp-content/plugins/s2member-files/access-s2member-ccap-mike/Do_The_Math.mp3

and I upload these files via FileZilla and I made the directories by copy pasting the exact names from the s2member account settings pages/guides. So I don’t understand why it’s all blank and nothing shows.

In fact, when I put http://mydomainname.com/wp-content/plugins/s2member-files/access-s2member-ccap-mike/Do_The_Math.mp3 in the URL field of chrome, and I’m logged in, it automatically starts downloading the file…

  • This reply was modified 3 years ago by  Narek Ambar.
Posted: Wednesday Dec 11th, 2013 at 11:12 pm #61864
David Welch
Username: dwbiz05

Try including the sub directory like this:

[s2File download="access-s2member-ccap-mike/Do_The_Math.mp3" download_key="true" /]

Dave

  • This reply was modified 3 years ago by  David Welch.
Posted: Thursday Dec 12th, 2013 at 12:37 am #61868

I just tried that and it shows the whole entire link

http://domain.com/?s2member_file_download_key=43d8de9c12bh5e7513928628368v9767&s2member_file_download=/access-s2member-ccap-mike/Do_The_Math.mp3&#8221;

So I tried to hit “Link” and put the whole shortcode in the place of the URL and leave the text empty so it creates a standard “a” tag. Wrote “download here” between the “” of the a tag and BOOM! Got myself a download link!

Thanks a million!

I started expanding and logging in to each persons account and everything’s working great. I tried the inline thing and it didn’t play. That’s not a big issue at all. The main thing I’m a little confused about is why it doesn’t download or play on my iPhone…

Btw, how can I hide a Nav Bar page once someone’s logged in (for example the Log In page) or even the opposite. How can I only have a Nav Bar page show when someone (anyone) is logged in (for example the account settings page)?

Viewing 17 replies - 1 through 17 (of 17 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.