Skip to content

Hide list items that are not "logged in user" in backend list view #808

Answered by TLWebdesign
TLWebdesign asked this question in Q&A
Discussion options

You must be logged in to vote

Figured it out. I don't know if it's the best solution but it seems to work.
The below code checks for a groupID being set in the component configuration. Then checks if logged in user is an admin. If user belongs to the group and if he is not an admin it adds the query to limit the list view to "show own items only".

I already had a component configuration field where i had to set the user group of the one i want to limit my users to. (if you don't need this you can just remove the checks and only do the line with the "$query->where..."

ADD THIS CODE TO THE "Add PHP (getListQuery - JModelList)" field in the PHP TAB of your admin view.

// get group ID from component parameter $groupID = J…

Replies: 1 comment

Comment options

TLWebdesign
Sep 30, 2021
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by TLWebdesign
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant