Code Hacks: WordPress WP-Filebase Pro

I updated my WordPress installations to 3.7 “Basie” this weekend and found that the file download stopped working for all users except admins. The files affected are those for which permissions are required (Subscriber and above).

I made a workaround to get it working for my physics teachers resource site at http://sptr.net. In classes/Item.php, within function CurUserCanAccess($for_tpl=false, $user = null), above the loop that checks user roles, you have to populate the roles array by calling get_role_caps(), thus:

...
if(empty($frs)) return true; // item is for everyone!
$user->get_role_caps();
foreach($user->roles as $ur) { // check user roles against item roles
 if(in_array($ur, $frs))
 return true;
 }
...

It looks like it’s working for now. I’ve posted the fix to the Plugin support forum.

3 Replies to “Code Hacks: WordPress WP-Filebase Pro”

  1. Fabian Schlieper, the developer of the WP-filebase plugin, has tweeted that this fix will appear in the next update. I love it when that happens.

  2. Thanks for your post I found that free version of wp filebase has no access to the attachments file for custom users roles.
    In the same file I added more role names to let.

    Thank you! 🙂

Comments are closed.