Dear Friends,
I have two modules with many to many relationship modules name are Accounts and Users.
Now, what I want to apply is,
Logged in user can only be able to see those accounts, which have many to many relationship with current logged in user.
Means, If I select user A and B from user subpanel from Account record, then this record should be visible to only user A and B.
Please feel free to ask me if you have any doubts.
Thanks in advance,
Prafull
Hello Prafull,
I currently have a similar case and I have solved it temporarily like this:
In the file “/custom/modules/MODULE/metadata/popupdefs.php” I get the ID of the elements that I do not want to list and assign them to the “$ popupMeta” varibale.
global $ current_user;
$ ignoreId = $ current_user-> id;
$ popupMeta = array (
'ignoreIds' => $ ignoreIds,
...
“/include/Popups/PopupSmarty.php”
In the “_get_where_clause” function, before the return I write the filter that I need:
function _get_where_clause ()
{
...
if (isset ($ this -> _ popupMeta ['ignoreIds'])) {
if (! empty ($ where)) $ where. = 'AND';
$ where. = 'assigned_user_id! = "'. $ this -> _ popupMeta ['ignoreIds'] '"';
}
return $ where;
I hope this is useful for you.
A greeting.