-
Unfortunately, I cannot re-mark the answer, but I did find a way to do this, see my answer below. Is there any way to forcefully hide entries from users? I would like to show users only the entries they have created themself. I have successfully set up a filter that allows me to do just that, but users could still remove the filter and see entries created by other users. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
you can set permissions to allow users to only be able to access their own entries, but not hide from the listing. |
Beta Was this translation helpful? Give feedback.
-
While planning to submit a PR to implement this, I did eventually find a way to do this using Laravel's service container! You can extend Statamics use Statamic\Facades\User;
use Statamic\Http\Controllers\CP\Collections\EntriesController;
class FilteringAuthorEntriesController extends EntriesController
{
protected function indexQuery($collection)
{
return parent::indexQuery($collection)
->where('author', User::current()->id());
}
} After that, you need to replace the original public function register()
{
$this->app->bind(EntriesController::class, FilteringAuthorEntriesController::class);
} |
Beta Was this translation helpful? Give feedback.
While planning to submit a PR to implement this, I did eventually find a way to do this using Laravel's service container!
You can extend Statamics
EntriesController
and override theindexQuery
method. In there, you can add your own queries:After that, you need to replace the original
EntriesController
with your ownFilteringAuthorEntriesController
in a service provider:p…