Groups File Access

Groups File Access is a WordPress plugin that allows to provide file download links for authorized users. Access to files is restricted to users by their group membership.

Among the many possible use cases covered by this plugin, the most prominent are:

  • Provide file downloads for Premium Members.
  • Allow registered users to download files from your site.


Features

  • Restrict access to downloads to authorized user groups
  • Full multisite support (WordPress network installations)
  • File management area
  • Upload files via FTP and bulk import
  • File access notifications (customizable)
  • Flexible shortcodes: [groups_can_access_file], [groups_can_not_access_file], [groups_file_info], [groups_file_url], [groups_file_link], [groups_file_visibility], [groups_file_access_service_key]
  • Limited or unlimited number of downloads per user
  • Key authentication file access


Access to files is restricted by group membership. To be able to download a file, a user must be a member of a group that is assigned to the file. If an access limit has been set for the file, the user must also have accessed (downloaded) the file fewer times than the file’s access limit.

If you want to restrict access to a file to users that belong to a certain group, create the group, add the desired users to the group and assign the group to the files that the group should be able to access. More than one group can be assigned to a file.

Shortcodes are used on posts or pages to render links to files, provide information about files and conditionally show content to users depending on whether they are allowed to access a file.

For example, the [groups_file_link group="Premium"] shortcode renders links to files that members of the Premium group can click to download the files.

Download

Get the plugin here: Groups File Access

Documentation


Online Demo

296 comments

  • Hello

    Great plugin it works as expected, I only need to let certain group or groups upload files. There is a capabilitie groups_admin_groups which does that bit it gives to much priviliges. I just want certain users to be able to upload to groups I allow.

    As I see it it would require a new capabilite for example: groups_allow_file_management.

    Ziga

  • With groups_admin_options the user can see the Groups menu and he can see Files option but the File option says access denied.

    With this capabilite user can als access Groups/Options, wich I don’t want!

    Ziga

  • Shortcode is not working for me. Tell me if i am doing anything wrong. First the files are uploaded as access to “Premium” group in the way written in support document then tried to add it to my page with the ID using the shortcode
    [groups_can_access_file file_id="6"]This is an example[/groups_can_access_file].
    I was expecting that this should be visible to admin as well as premium but is not the case. Codes used for non registered are working fine

  • It is not working on woo theme “canvas”. I have tried it on another site on same server with rocket theme gantry default, there it worked correctly.

  • I want to allow some documents to be available publicly while restricting others to various groups.
    Restricting documents works as described but how do you recommend managing public documents? I have not found the information yet.

    Thanks

  • Moonworks

    Is there a way to automatically add a user to a group after filling ion a Gravity form?

    I have a form where bloggers sign up to post on a specific date for a book tour, and I’m wanting to add a new section where they can automatically download the files they need from the site.

    Each book tour is on a separate form, and the additional section is a drop-down menu where they select the post type (guest post, interview or book excerpt). What I need to do, is if they sign up for a guest post on a specific book tour, they will then be added to a group for that, and will get to see the downloads which are available to them for the guest post, and the same for each of the other options.

    You can see an example of the form here:

    http://darkscreambooktours.com/seacrest

    Thanks :)

    • Almost perfect timing since I’m working on an integration for Groups and Gravity Forms :) Hope to have it out around next week. If you’d like to try it out let me know and I’ll give you access to the plugin after the most important tests have been done.

      • Moonworks

        That sounds perfect.

        I’m working on a dev site redesigning my site, so would be happy to use it to beta test if you would like me to.

        As soon as we can get this working, we can make it easier for our bloggers :)

  • Clayton

    Is there a way to view a protected pdf or jpg in the browser rather than forcing a download?

    • The current implementation uses the header Content-Type: application/octet-stream. Quoting from RFC 1341 (see also RFC 1521) :

      … The primary subtype, “octet-stream”, is to be used in the case of uninterpreted binary data, in which case the simplest recommended action is to offer to write the information into a file for the user. …

      I think it would be a good idea to allow to determine which content type is to be indicated in the header, so that a more flexible behavior is allowed based on the file’s content type. Note that how the file is treated at the receiving end is still the downloading user’s decision based on preferences set in the browser.

      Long story short … expect an update for GFA where you can choose the content type :)

  • Pam

    We have a list of pdfs that should be restricted to a particular group. When I am uploading the file, “enforce access” in the media library, only provides the “groups_read_post” option. Other access options are not provided.
    With the “groups_read_post” option selected for a pdf, non-group members with the url are able to view the pdf.
    Questions:
    – Is there another way to restrict url access to the pdfs? or am I doing something wrong during the upload.
    – How can I get other options to appear in the “enforce access” area?
    Thank you.

    • If you are using GFA, you will find a dedicated section to files that are protected by the plugin: Groups > Files.

      For your PDF files, you would create a Group, let’s call it PDF. Then upload the files under Groups > Files and assign each file to the PDF group.

      Only users in the PDF group will be able to download the files, even if someone knows the URL to a file, it must still be accessed while being logged in as a user that belongs to the PDF group.

      Note that this is different from the files that you upload through WordPress’ normal Media section.

  • Pam

    I think that I have had an “Oh, That’s What They Meant” epiphany.
    – In Groups/Capabilities I have created a category for each group. i.e. group1_download, group2_download
    – In Groups/Options, added the new categories as category options for media
    – Assigned the capabilities to specific groups in Groups/Groups
    – Assigned users and capabilities to Groups in Users/Roles
    – Assigned the group capabilities (i.e. group1_download) in the access_restrictions section of files in the media library

    Server thinks that I am still logged in, so can’t test that this worked (yet)

    Is there anything that I should be adding to this process in order to restrict media urls to specific user access?

    • Yes that would allow to hide the attachment pages for the files, but if someone knows the file’s URL, the file would still be accessible. In many cases the approach you have explained would be ok, but if you really need to protect access to the URLs, then you should rather use the protection through Groups > Files.

  • I am building a new WordPress site using Groups and Groups File Access. My primary issue is that if I attempt to use the File Import features to bulk update the files names, descriptions and groups for the 800 files I have, it always fails.

    The initial FTP upload of the files and the export/import process to recognize them worked fine.
    Then I edited a new export file in a spreadsheet and saved it as tab delimited text file and tried to import it again, with my new descriptions.

    The message I always get is something like:

    1 file updated
    82 lines skipped

    I thought maybe a bad character could be blocking the import like a quote mark, so I find/replaced any quotes to remove them.

    If I use the manual add and edit features in Groups File Access it works fine. But I cannot manually edit that many files, so I really hope this will work.

    Advice or known issues?

  • groups-file-access plugin issue

    after all installation, I click on “Files” and submit the first document, afterwards it shows nothing inside the files tab, tried deactivate and reactive groups-file-access and click on “Files” tab again, still blank. WordPress version3.5.2

    thanks!

    • This sounds like something’s going wrong during the upload process. Can you please activate debugging (with at least WP_DEBUG and WP_DEBUG_LOG set to true) and try to upload it again, then check the contents of wp-content/debug.log and post here if there are any errors displayed. Please use Pastebin if the content of the file is large.

  • alex

    Hi Kento

    Your plugins look great – I wasn’t sure if GFA will quite do what I need though, so I thought I ask you here and on Code Canyon.

    I use Download Monitor (1) and it’s companion plugin, Page Add On (2), to easily create a series of download pages (3), each of which link to a download file (4) and list stats such as links to previous file versions and number of times downloaded. These pages use the custom post type dlm_download.

    I would like to restrict access to download pages (e.g. 3) and download file URLs (e.g. 4). I would like to do this by specifying groups users with different levels of access.

    Is this possible with Groups and Groups File Access? If not is it possible with some modifications by you? If so could you put together a quote for such modifications?

    I use the webserver nginx – does your plugin require apache?

    Thanks very much and apologies for the long comment.

    (1)
    http://wordpress.org/support/plugin/download-monitor
    https://github.com/mikejolley/download-monitor

    (2)
    https://github.com/mikejolley/download-monitor/wiki/Page-addon

    (3)
    http://vps01.gunyon.co.uk/downloads-area/download-info/pig/

    (4)
    http://vps01.gunyon.co.uk/download/pig/

  • Martin

    Hi,
    I have created an e-learning package using Articulate Storyline and I’d like to manage access to the course (stored on my WordPress site) using the plugins Groups and GFA. The whole course package consists of about 650 files in four folders and total size is about 20 MB. The course is launched when the user clicks a file in the package called “story.html”. Can I use GFA to launch the course and protect the material? Thanks.

    • Basically yes but note that there are a couple of important points to take into account:
      – GFA uses a single directory to store all files it protects. The files you have in different folders must be located in GFA’s folder, even if you upload the folder structure via FTP, it will only use the ones directly within its folder. If there are any duplicate filenames in the folders, you’ll need to rename them.
      – The links in your story.html must be the links that GFA produces for each file, you will have to edit the links for each file in the course so that it points to the right file handled by GFA.

      • Martin

        Hi Kento,
        Many thanks for your quick response. I’d like to try your suggestion but I don’t seem to have access to the GFA folder using my FTP software. I am using FireFTP and my site is hosted by WP Engine. Do you have any idea what the problem could be?

        • Hi Martin,

          The folder where the files are stored should appear in Groups > File Access under “Uploads” … “Files are uploaded to the …”

          That’s the directory where you should upload the files to, maybe you need to get specific credentials from WP Engine to access the folder via FTP?

  • Kento/Itthinx,

    I’m a developer working on a pro-bono website for a Scout Troop based in the Midwest. They want a file share/downloads system that allows them to control who can upload and download files based on groups. So far the free Groups plugin has been very helpful in allowing me to delegate permissions and control over various parts of their WP site. I had though the Groups File Access plugin would fit for their document management needs. However, your document, website, nor settings (that I can figure out) allows me to set what groups can upload files and which can’t.

    How do I go about restricting or adding a capability to allow different groups to upload files? Is it possible to set up a moderated upload queue for certain groups?

  • Jay

    Hi, I’m just setting up and using the shortcode [groups_file_link file_id="2"] and do not have anything showing up on my page. It may be a simple error but I’m having great difficulty figuring it out. Please help.

  • Hey Kento,

    I’m currently running a membership website using s2member and in the process of switching over to woocommerce with the groups and subscriptions plugins along with your groups and groups file access plugins. I seem to be up against a wall with an option I wish to continue offering that I can’t figure out how to do with your software…

    S2member allows me to grant access to specific files a specific number of times in a specified amount of time. In my case that means that my free registered members can download 1 item from my site per day (any item), 1st level paid memberships can download 25 items (again, any item–video, pdf, etc.), 2nd level paid = 25 items/day, and 3rd paid level = 50/day.

    I need a solution that can grant access to all items in my site, but at different volume levels per day based on membership level. What do I need to do or what script do I need to write to tell Groups/GFA to do this?

    Thanks for your help.

    • Hi there,

      So basically we’re looking at something that allows you to say, for example:

      Silver group – 25 downloads max
      Gold group – 25 downloads per day max
      Platinum group – 50 downloads per day max

      That can be done with a slight extension of the GFA plugin. We already have the possibility to limit the number of downloads per file, we just need to extend the entity that controls the downloads so that it takes into account per user and per period limits.

      I can see two options for you here, #1 is that we add this to the plugin, I can’t promise an exact schedule for that but I think this is a very worthy addition to the plugin and that it should be added, #2 is you hire someone to implement it and we provide an extension hook within GFA which can be used to control download access.

      Let me know what you think would be best for your case, I’m very happy to help with that.

  • Hi, bought this plugin, been using it with woocommerce subscriptions to get access to a subscribers page to download PDF newspapers.
    I would like to as well on the page be able to display the pdf in a viewer so they can read on the webpage as well as download. Have google docs viewer installed. It however cannot seem to get access to the file to display. Tried a few codes..

    [gview file=”[groups_file_link file_id="69"]” width=”600px” save=”1″]
    [gview file=”[groups_file_url file_id="69"]” width=”600px” save=”1″]

    Tried a link direct to the file, nothing displays, it says it cannot find source. Any help?

    • Hi Trevor, what markup do the shortcodes that you have mentioned produce please? Can you provide a link?

      • Not exactly sure what you mean by markup. The gviewer displays an empty box saying it cannot find the pdf, ” Sorry, we were unable to find the document at the original source. Verify that the document still exists.
        You can also try to download the original document by clicking here.” The download link provided from the gviewer cannot find the file either.

        Can’t really provide link directly to it, the page is behind our subscribers pay-wall.

        Perhaps the plugin is just not able to display the protected content? Are there any pdf viewers that are able to display the group protected files on a page?

        Sorry for the double post question.

      • “The file to embed must first be publicly available somewhere on the internet, in order for Google to retrieve the document for conversion”

        Hmmm, ok seems that this will not work since google does not have access to file behind the group file access.

  • Ok, second attempt at this post. Not sure why my first didn’t get an answer. We have bought the plugin, and would like to use to to display PDF files on a subscriber page using google pdf viewer. But the short codes do not seem to be working. How do I get the file to display in gview?

  • Just a possible bug report – plug in is working fine, but was preventing me from deleting a sub-site until I deactivated this plug in.

    Error log entry:

    `PHP message: PHP Fatal error: Call to undefined method Groups_File_Access::cleanup() in /var/www/wordpress/wp-content/plugins/groups-file-access/lib/core/class-groups-file-access.php on line 99″ while reading response header from upstream, client: 131.96.186.205, server: insidelaw.gsu.edu, request: “POST /wp-admin/network/sites.php?action=deleteblog HTTP/1.1″, upstream: “fastcgi://127.0.0.1:9000″, host: “insidelaw.gsu.edu”, referrer: “https://insidelaw.gsu.edu/wp-admin/network/sites.php?action=confirm&action2=deleteblog&id=2&msg=You+are+about+to+delete+the+site+%2Ftechnology%2F.&_wpnonce=1a13f150c8″
    `

  • Chris

    I can upload files through the wp-admin and confirmed that they are actually on the server through ftp.
    somehow nothing shows up in the files page.

  • Chie

    I sent a message last weekend about Groups File access not working on my client’s site. Somehow, it didn’t post on this comments page.

    When users click on the file id, instead of automatically downloading, it just open a new blank window but nothing happens.

    What could be the problem.

    • Hi Chie, please enable debugging in WordPress and try to access a file. If there are any errors in wp-content/debug.log we can check if you need to adjust your setup or if there is any conflict with another plugin.

  • sarah

    Hi, does 404 Redirect work with this plugin? I’d like customers to see the same page whether being blocked from a pdf protected by groups file access or a post protected by groups/subscriptions. I don’t want them directed to a word press login under any circumstances – i have woocommerce so prefer they login using “my account” page.

    thanks

    • Hi Sarah,

      If access is denied to a file protected by GFA, it will result in a 403 Forbidden and the Groups 404 Redirect plugin does not get involved.

      If you place the link to a resource protected by GFA on a protected page, then you could achieve the result of getting a redirect when they try to access that page, but not to the resource itself as it’s a different case.

  • Rose

    We’ve found a bug in this plugin when it is used with MP3s in iOS devices. We have a large (20+ minute) mp3 file. If we bi-pass the plugin and put it directly in the upload directory and link to it then it works fine. The mp3 player starts on the iOS device, after a small download delay it shows how much total time there is and you can play the file to completion.

    On the other hand if you link to the same file with this plugin then the mp3 player starts but the total time never shows up on the player. Also, it only plays a few minutes before it resets to the beginning and starts all over again missing most of the content.

    I did a little poking at HTTP headers. It looks like when a direct (not plugin) link is made the server sends first a 206 partial content followed by a 304 that streams the data. On the other hand with the plugin you send a 200 OK. The other thing I noticed is that some size data shows up in the chrome network browser with out the plugin… but with the plugin the network browser shows a size of 0.

    This is a rather critical bug for my customer since he has a live site and some angry customers who can not access their mp3 subscriptions via their idevices.

    Thank you, Rose

    • Hi Rose,

      Can you please send access for a test account to support at itthinx dot com so we can have a look and give it a try? Please add a link to one of the files and a page where the player is embedded. Can you also send admin access there please to have a look at how you have things set up?

      Anyhow, one important thing to note here, if you use a link to a file that is protected by GFA then access is only granted if the user is logged in and belongs to the right group. If you want to access the file without the user being logged in, for example using an embedded player, then you can use links that include the service key. What makes me wonder though is that you seam to have it working for some cases and for others not.

  • Peter

    Is it possible to use Groups file plugin with WPML plugin?

    When a user is inside a page and tries to downloada a file, it would be served him the a.pdf if the user is browsing the page on the website’s default language and the file a-en.pdf in the english version.

    Thanks.

    • There is a possible solution which can be done using a conditional shortcode available through the WPML Shortcode Translator plugin (I’ve just found it, haven’t checked if it works but it looks like it should) and using different files depending on language or defining language-specific groups.

      Something like this should work, for example providing two different files, one for English and the other for German :

      [wpml_language language="en"]
      [groups_file_link file_id="123"]
      [/wpml_language]
      [wpml_language language="de"]
      [groups_file_link file_id="124"]
      [/wpml_language]

  • Ideahost

    Just a question before purchase: Can I (with a different plugin) create a new WP User Role, for example, “MyPeeps” and assign that role automatically to anyone who enters or is enrolled in a group? Not sure from your documentation if the default is “subscriber” or if selectable. I know you don’t control access via that means, but I really need a custom user to hook. Please let me know soon, thanks a ton.

  • ok, is there still no way to display a group file access protected PDF?

    Our subscribers can access the protected page, download the protected file, but some older users do not like downloading to view the file and want to view it online, full screen in their browser. This works when i link a pdf on that page that was uploaded to that page, but the link is not secure and can be passed to anyone to click on and read. When i enter the gfid=91 link or whatever it prompts the browser to start a download instead of opening an new window to view pdf. Anyway of displaying the protected file on a page in wordpress wihtout downloading?

    • The service key can be used for that. See the description of the [groups_file_access_service_key] shortcode in the Shortcodes section of the plugin’s documentation please. It can be used to construct the URL used by the PDF viewer.

  • For some reason this isn’t working for me…

    I have created 3 groups: Internal, Partner, Customer

    ThenI created files and assigned them to specific groups, some to multiple groups.

    Then I assigned users to just one group

    Then I placed these shortcodes on the page thinking that the user would only be able to see the files assigned to their group:
    [groups_file_link group="Internal Documents" description="yes"]
    [groups_file_link group="Partner Documents" description="yes"]
    [groups_file_link group="Customer Documents" description="yes"]

    My problem is that if a file is assigned to 2 groups (Internal and Customer), then the files appear twice on the page (under (Internal and Customer), even though the user is only assigned to “Internal.”

    Please help! This is very time-sensitive.

    • antonio

      Hi,
      the file appears twice because file is in Internal and Customer, so:
      – Appears in “Internal” because file is in this group and userCustomerA can see this file (because user is in this group).
      – Appears in “Customer” because file is in this group and userCustomerA can see this file (because user is in group Internal and the file is in Internal).
      You could use [groups_member] shortcode. E.g.

      [groups_member group="Internal Documents"]
      [groups_file_link group="Internal Documents" description="yes"]
      [/groups_member]
      [groups_member group="Partner Documents"]
      [groups_file_link group="Partner Documents" description="yes"]
      [/groups_member]
      [groups_member group="Customer Documents"]
      [groups_file_link group="Customer Documents" description="yes"]
      [/groups_member]

      cheers

  • Samatva

    Plug-in is working great, but have found a minor bug. If it is network activated, and one site on the network is deleted, the following error occurs:

    Fatal error: Call to undefined method Groups_File_Access::cleanup() in /var/www/wordpress/wp-content/plugins/groups-file-access/lib/core/class-groups-file-access.php on line 99

    Doing a network disable eliminates the message. The site being deleted has no protected documents….

    Thank you for your great plugins…

  • Greg

    Hi Kento,
    Well done with this plugin.
    I’ve just about finished all configurations on our site bar one thing.
    Reading through previous comments there’s one with a similar request to what I’m trying to implement and that is when a GFA document link is clicked it opens in the browser’s pdf viewer for viewing online so that it does not have to be down loaded.(i.e. accessing from a mobile device)
    I’ve added and changed the shortcode from [group_file_link] to [group_file_access_service_key] which renders the user’s unique service key.
    How do I apply a shortcode on all GFA document links so that it uses the browser’s default pdf viewer?
    Any pdf’s I have on the site outside of GFA behave this way i.e. opens in a new tab in the browser using what I assume is the browser’s default functionality, tried this with Chrome, firefox and IE all behave the same.

    • Hi Greg,

      Are you using the latest version? You should have version 1.5.0 installed – please check the MIME types of the files under Groups > Files and make sure that these are reflecting the correct type. That will give the receiving browser the right ‘hint’ so it can treat the files according to the user’s preferences.

      • Abimar

        How can I set the Mime Types? I have used FTP to upload a lot of PDF files –and then the scan function to create an import file — and they are all showing as “MIME Type: unknown” — I want to change that to application/PDF but I cannot find any way to edit or correct the MIME type.

        • The application/pdf should be recognized automatically. What does $ file -bi example.pdf produce on your server?

          • Abimar

            I’m confused — where would I enter that code to test?

            My main concern is that I would like users to be able to view PDF’s online. Under “Groups File Access” I enabled Content Dispositon – inline-displayed automatically — but still when a link is clicked, the file is downloaded rather than opened.

            All of the files that are uploaded via GFA show MIME Type: Unknown.

            I can upload & link to files via the WordPress Media library without a problem – so it’s not a problem with the wordpress installation — it seems to be restricted to the GFA action.

            • You would use that in a shell connected to your server (via ssh) – by the way, rather use file -b --mime-type example.pdf to see the MIME type is recognized.

              Regarding the behavior you describe, it depends on the client’s browser settings, i.e. you cannot control whether a file is downloaded or viewed at the client’s end because that is determined via its browser settings. But what should work is that the system recognizes the MIME type because that precisely determines what will happen on the client’s end (open or download).

              As you have Unknown for all files, the system serves it as application/octet-stream which would browsers would most likely download instead of opening by default.

              So what we need to do is find out why you get Unknown instead of the actual MIME type.

              • Abimar

                Hi, I have responded before 10 days ago but my post hasn’t shown up.

                I did what you suggested and the shell commands show correct filetype:

                file.pdf = application/pdf

                file.doc = application/msword

                file.zip = application/zip

                But they all show up as “MIME Type: unknown” within the Groups File Access file list.

                Do you have any suggestion as to how I can address this?

                • Hi Abimar,

                  Thanks for checking that, can you please enable debugging and provide admin access to the site – please send credentials to support at itthinx dot com and make sure to include a link to this comment.

                  Cheers

  • Tamara

    Hi Kento,

    First of all: I really like your plugin. But I have one question: I want to display all the groups of a user by name in PHP with the files of that group. So far it’s working, but I can’t figure out how I should display subgroups in the right parent group. The result I try to achieve is the following:

    Parent group
    — Subgroup 1
    — (All the files of Subgroup 1)
    — Subgroup 2
    — (All the files of Subgroup 2)
    Parent group 2
    — Subgroup x
    — (All the files of Subgroup x)
    — Subgroup y
    — (All the files of Subgroup y)
    etc.

    Now it shows up like a mess (as in: all groups display by it’s name and there are no subgroups in the right parent). I filter the groups with the Groups_User class. What would be the easiest way to get the right result?

    Thanks,

    Tamara

    • Hi Tamara,

      Can you please share the code you are currently using? I might be able to give hints on corrections.

      Cheers

      • Tamara

        Hi Kento!

        I managed to figure it out already :D What I did is the following: First I used Groups_User to get all the groups of the user. Then, I made a function with a loop in it to search for matching parents (by the group id). The function puts the results in a new multidimensional array and returns that. After that I made a function that searches for the right names for the groups by the group id and I used ksort to sort the names of the groups in alphabetic order. And at last I used a loop to get all the files that belong to the group with do_shortcode and the shortcode for groups_file_link.

        I hope that this helps others who are facing the same thing!

  • Is there a way to restrict access unless a visitor is the member of two groups? In other words, one group won’t be enough… they have to have two groups to access content. Possible?

    • Hi Robyn,

      The restrictions allow access to members of the groups that are related to a file, not the opposite. I would recommend to consider creating a specific group for those members that must be in two or more groups to have access to a file.

      Cheers

  • I have been using your groups plugin and it has been working great! Just purchased your groups file access and here is my scenario and question. We sell a custom Android TV box. We already control access to our IPTV stream by unique key. Each box has an unique key for stream access. The reason why I purchased the file access is to control access to a system recovery file. We are currently developing an Android application that would perform a system restore in the event necessary. We obviously want to control access to our system image. The user already has been provided the stream access key. I see in your documentation that a file can be accessed without logging in by Service key. What would be required to use our access key in substitution of the service key? What I am envisioning is the application prompting the user to input their access key and it is appended on the link providing access to our system image for download. Best wishes, David

    • Hi David,

      For the scenario that you explain, one solution would be to map the access key to the service key through rewrite rules. I assume that you consider using the access key to make it easier for the users so that they only need to use one of them. The Service Key is stored as user meta (meta key gfa_service_key). See also the method GFA_Shortcodes::groups_file_access_service_key() which is used to render the Service Key for the current user where you can see how the key is retrieved from the user meta given the user ID. This method also creates the key if it’s missing.

      You would have to create rewrite rules based on that, so that an incoming URL which carries a valid stream access key to append the Service Key as the service_key=... URL parameter.

      I hope that helps, let me know if you have any questions on that please.

  • I’m stuck on how this works.
    I am logged in with a user with the correct role/group assigned.
    When I attempt to open the http://freenetcable.com?gfid=1 link I get a 403 forbidden error.

    • This would happen because the user isn’t in a group that the file is assigned to, the file doesn’t have any group assigned or because the service key used to access it is incorrect.

      • David

        Just confirmed User is assigned Customer Role
        File is assigned to customer group
        Customer is assigned under Groups to read_private_forums I did not find a capabilities for file access?

        Any further ideas?

        • Thanks David,

          Customer role and group are not the same thing, I think that’s what’s missing. Also there is no relation to the capability you mention with respect to files. I’ll use another group name to give a clearer example.

          Let’s assume you have a group named Platinum and all members of that group should have access to a bunch of files. Note that I do not refer to a role but to a group. You must assign the files they should be able to access to the Platinum group.

  • sarah

    Hi, my files have all been working perfectly (thank you) until now – suddenly every file has an error and the absolute address of the file is incorrect.

    A similar thing happened yesterday when my backup plugin stopped working and the solution was to change the first part of the address from /hermes/bosweb26a/b1808/ipg.mywebsite to /home/users/web/b1808/ipg.mywebsite. (So i suspect my server has changed their address but i’m not certain.)

    Is there any way to change the file locations of these files? So from
    /hermes/bosweb26a/b1808/ipg.mywebsite/wp-content/uploads/groups-file-access/filename.pdf
    to
    /home/users/web/b1808/ipg.mywebsite/wp-content/uploads/groups-file-access/filename.pdf

    If not, and I have to reimport every file, can i import them over top or do i have to start from scratch? There are at least 80 files and i would have to redo the link for each one throughout my site. I’ve looked at the export function to modify existing entries in bulk but it doesn’t seem to address this issue.
    many thanks,

    • Hi Sarah,

      It seems that your whole site (site’s files) has been relocated. You should be able to follow this process to have the relocated files properly recognized:

      1. Go to Groups > File Import and under Export Files click the Export button to obtain the text file that contains the current data for the files.
      2. Replace the path prefixes in the file obtained with the new ones.
      3. At Groups > File Import use the Import Files section to import the modified file.

      The files should now be recognized at their new location.

      • sarah

        thanks – it’s very odd, they claim nothing has changed at their end but clearly something has!
        I did try exporting that file before posting but there doesn’t appear to be a path prefix – just the filename. So line 1 looks like this:
        A-Frogs-Life-Worksheet.pdf 1 A Frogs Life Worksheet 0 Registered,samples
        There’s also a comment on the import page that specifically says don’t include the full path. Should i add it in?

        • Thanks Sarah, no then it’s better to leave it like it appears in the exported file. Have you tried re-importing the files based on it? You can test it with one file only so you don’t ‘crush’ all the files in case it doesn’t yield the expected result. If you take the exported file, remove all lines except for one entry and give the import a try so it can recognize it.

  • sarah

    Hi, I’ve tried deleting all but the first line and reimporting and got the error – registered is not a valid group. I’ve made no other changes – it’s exactly as exported.

    Results after importing (test only) from groups-file-access-export-2014-11-13-03-16-57.txt :
    0 files would have been imported
    1 invalid line was detected
    Invalid lines: 1
    1 : Invalid group name “Registered

    Also, i’ve tried simply loading a new pdf to that record in the edit function and get this error:
    The file /hermes/bosweb26b/b1808/ipg.flyingstartbooks/wp-content/uploads/groups-file-access/A-Frogs-Life-Worksheet.pdf already exists but it is not related to this entry. The existing file is not replaced and the current file for this entry is maintained.

    thanks again

    • Hi Sarah,

      It looks like there’s a " in front of the Registered group name which shouldn’t be there. Can you please check the file you’re using and try again?

  • Hi,
    I have installed and activated the plugin but I get a “permission denied” if I try to upload any file by FTP. What’s up?

    • Also, when I try to upload a small file using Groups > File I get this error:
      Fatal error: Call to undefined function mb_strlen() in /home/dreambit/public_html/wp-content/plugins/groups-file-access/lib/admin/files.php on line 580

      • Which PHP version is your web server using? The plugin checks if the mb_substr function exists before using it and the mb_strlen must also be present in that case. The error you get would only occur if the first function is defined but the second isn’t and that shouldn’t happen as they are both in the same package.

    • Sorry, the error on an ftp uload is:

      Server said: Can’t open that file: Permission denied

      Error -160: could not start data transfer

      What could be wrong? I installed the plugin through upload of the zip. The owner of the dir. is the same as other directories. Changing permissions is also not possible.

      • If you can’t upload via FTP you need to log in as the user who is allowed to upload files or change the ownership or permissions on the folder where you want to upload to. This isn’t related to the plugin itself but to folder permissions and I would recommend to get in touch with your hosting provider in case you don’t know how to do this as they can help you on your particular server.

    • Hi Edwin,

      You should check that the folder wp-content/uploads/groups-file-access is writeable.

  • sarah

    Thanks for your help. I wanted to let you know that it worked perfectly second time. I had previously opened the file in excel and i guess that added some code in somewhere that i hadn’t noticed. All fixed now.

  • Hi,

    I am not sure if this plugin serves the purposes I intend:

    I am using Groups and Groups for WooCommerce with Woothemes Sensei to offer online courses by a “Tiered Membership” as outlined by Dan of Woothemes (see http://nicole-schaller.eu/wp-content/uploads/2014/07/OB-EU-6-motivation-960×540.png)

    How can I also restrict the access to images and media attachments in the Sensei lessons (or in the WordPress blog in general), namely the access to the links in the /wp-content/uploads folder?

    Second application would be to protect the links to the wp-content/uploads folder in a private WordPress blog, but in a way that allows to embed images and file links into posts.

    It is my understanding that this is a known leak in WordPress.

    Thanks a lot.

    • Hi Nicole,

      One way to restrict access is to use Groups File Access but note that it uses its own folder to store files that should be protected and it does not prevent to access the files that are uploaded via WordPress’ Media section (yet).

      You can see details on its usage on its Documentation pages.

      Cheers

  • Shaun

    Hi – I’ve just purchased GFA, and I’m looking for a shortcode (or other method) for listing ALL the documents that are available to a user. I’ve looked at the documentation and couldn’t see this.

    Many thanks for any help you can provide,
    Shaun

  • Greg

    Hi Kento, I’ve moved a site from the dev environment to the live hosting. I only have 5 documents currently uploaded which was for testing purpose and it would be easier to upload them again than to try run the SQL script.
    My question is, would it be ok to simply remove the documents from Files menu and upload them again? or Do I have to run the SQL script?
    I’ve check the upload location url in File Access and it looks correct for new uploads.
    Cheers

    • Hi Greg,

      In that case you should be able to just upload them again, I would recommend to double-check that the group assignments are correctly made also on the production site by using an appropriate test user account.

  • Didi

    Hello,

    Which is the new link for the demo? This http://itthinx.org/gfademo does not work :(

    Thanks a lot!

  • Hello,
    I have a client that wants to use their ldap authentication for file serving. Is that possible with your plugin. The wordpress install and the ldap is on the same server.

    • Hi Kenny, thanks for asking but that’s not possible, the plugin serves files based on group membership or using a service key in the URL that authorizes access to a file.

  • Jeroen

    Hi

    Bought GFA and it works as expected. :-) One question though.

    I haven’t found an option in GFA to create categories of files (and a way to couple such a category to a group of users). Am i right?

    I’ve figured out a possible alternative. I could filter (select…where) files in a group on a specific piece of text in (a part of) the description. Something like this:
    [groups_file_link group="KR" desc_content="*MEETINGS*"]

    or perhaps
    [groups_file_link group="KR" name_content="2014*.doc"]
    (the filename contains a categoryname)

    Is there a way to filter within a group?
    Perhaps there is a better way to simulate “categories”?

    Thanks!

    • Hi Jeroen,

      Rather than categories of files, I would use groups. If you create as many groups as ‘categories’ you think of, you would have the same classification but using the plugin’s concept of groups instead.

      That also allows to differentiate so that users have access to files based on their group membership (which is the intended way for this plugin).

      Cheers

      • Jeroen

        IMHO a good solution would be the introduction of a second type of group, i.e.an authorization group besides the current usergroup. That way I can arrange my auth. Structure as follows: user usergroup auth.group document. That structure has two major benefits: 1. I can bundle my documents in auth groups and all I need to do to authorize a group of users is couple them to the auth. Group. 2. I could use the auth group to filter on groups of documents. This is what Abimar requests if I’m not mistaken.

  • abimar

    Hi, I have a similar concern as Jeroen’s — I’m not sure I understand your response. I have a large number of files to manage — so it would be easier if they could be assigned tags or categories. I want all members of the group to be able to access all files –but I’m looking for a way to keep those files organized to make it easier for the group member to find them.

    For example, lets say I have a group called Readers — and 150 files, with 3 different types: Fiction, Nonfiction, & Poetry. I want all Readers to have access to all types but I would like them to be able to get a separate listing on different pages – so, for example, they can easily get a list of links to Poetry files only.

    It seems to me your suggestion of additional groups would require that all Readers be a member of 3 additional groups. If, later on, I were to add a 4th set of documents, or try to break a large set of documents into smaller subsets (such as Haiku (a subset of Poetry) — I would then have to create a new group and reassign all Readers to the new group. Is that right?

    I hope you can clarify this.

    • For your example, you can assign all files to the Readers group and assign the relevant files also to the groups Fiction, Nonficition and Poetry. When you want to produce a listing of only files in the Fiction group, you would use that group only with the shortcode: [groups_file_link group="Fiction"] – the members of the Readers group will have access to those files if the files are related to the Readers group and the files that also are related to the Fiction group will appear in the listing.

  • Irati

    Hi there,
    Sorry for the dumb question, (I have searched for an answer before posting it) but how do I add the desired users to the group?
    I have created the users (with the WordPress functionality) and also the groups (through the Groups File Access plugin).
    Thanks!
    Irati

    • Hi Irati,

      You can add users to groups by going to the Users section where you will find a field to choose the groups that you would like to add the users to and a select box where you can choose between adding or removing users from those groups. On the Users page in the documentation you will find some additional info on that. I hope that helps, please feel free to ask if you need further help.

      Cheers

      • Irati

        Hi,
        Thanks, for your prompt response! I missed Groups section of the top of the Users page, I expected to find it in the user editing page.

        Now I have another question: is there a way with this plugin to force login when entering the page where the files are published? Or do I need to use another plugin? In the second case, any recommendations?

        Thanks and regards,
        Irati

  • Abimar

    Problem with bulk upload.

    Getting this error:
    Fatal error: Call to undefined function mb_strlen() in /[my system path]/wp-content/plugins/groups-file-access/lib/admin/files.php on line 580

    I used FTP to upload 11 files to the /uploads/groups-file-access directory

    I then used the scan function to generate an import file, and uploaded the import file.

    I got the message:

    Results after importing from groups-file-access-scan-2015-01-31-09-44-17.txt :

    11 files have been imported

    However, when I click the link to “Files” – I get the error message as shown above.

    Changing directory permissions does not resolve the error.

    Running PHP 5.4.36, CentOS Linux

  • Abimar

    I have resolved the problem I posted about – mb_strlen() error —

    I think this should be better documented in the plugin instructions. From a Google search this seems to be common issue – unfortunately it was easier for me to find post from people with the problem than to find the solution.

    The solution is that the PHP Mbstring extension needs to be enabled; apparently this is not enabled by default on many servers. This generally requires root access.

    • Hi,

      Thanks for the update on that, in fact it should use an alternative function if that one isn’t available so this might be a bug. I’ll look into it …

      Cheers

  • voltima

    Your docs state “limited or unlimited number of downloads per user”. Does this mean that I can accomplish this [below]?
    Example: Limit Group A to a total download limit of 20 digital downloads for $20. Limit Group B to a total of 40 digital downloads for $35.
    Thanks in advance.

Leave a comment

Your email address will not be published. Required fields are marked *

*

Please follow the Support guidelines.

Premium Support is available for customers in the Forums.