FileSets not displaying when logged out?
Permalink 1 user found helpful
I've created a plugin that pulls the first image from each fileset I have and displays a thumbnail of that file. When I am logged in, I see the list of thumbnails, however, if I log out the thumbnails are not displayed.
I am using
to grab the fileset list, which specifies that it will get all sets belonging to that user, or sets that are public & all of the sets for the site are public. Even if there is no one logged in, shouldn't it still display the public sets?
I am using
FileSet::getMySets($user = false);
to grab the fileset list, which specifies that it will get all sets belonging to that user, or sets that are public & all of the sets for the site are public. Even if there is no one logged in, shouldn't it still display the public sets?
Hi,
That also doesn't work,... on its own.
The sets need to be set with permission to search, or getFileSets returns an empty array... This in turn requires that each 'public' set must be given custom permissions to allow guests to search all files they contain... or that the global permissions under File Manager-> Access be set to allow guests to search all files.
At least, that's what worked for me after much head-scratching wondering why the documented solution wasn't working.
Cheers
FileSet::getMySets();
That also doesn't work,... on its own.
The sets need to be set with permission to search, or getFileSets returns an empty array... This in turn requires that each 'public' set must be given custom permissions to allow guests to search all files they contain... or that the global permissions under File Manager-> Access be set to allow guests to search all files.
At least, that's what worked for me after much head-scratching wondering why the documented solution wasn't working.
Cheers
Thanx a lot Rob that was really helpful.
Although for the latest version (5.5.2) it seems like the first statement is no longer needed:
"sets need to be set with permission to search"
as I couldn't find where to set that, however the global permission to allow guests to search made it visible.
Thanx again!
Although for the latest version (5.5.2) it seems like the first statement is no longer needed:
"sets need to be set with permission to search"
as I couldn't find where to set that, however the global permission to allow guests to search made it visible.
Thanx again!
A different issue is going to be how to get it to work to only show one user's filesets when they're logged in but show everyone else's when you're not logged in. For that, you'd need something like this:
Note that at no point should you pass in "$user = false" to the function -- this does not do what you think it does (it will always only pass false, and may mess up other code in your plugin if it relies on the $user variable being set to the current user).
If my suggestion doesn't work, can you post more of the code you're working with here so I can see some context?
EDIT: Fixed typo in code (added parentheses after $u->isLoggedIn)