I made another table called _user_students and followed the pattern of the user_addresses so a user can add more than 1 student to their account.
But with this they can only see thier own students too.
Now I'm trying to make a report (users_Report.php) and it it groups by user_id from the table users.
The report and query look good, but it shows everyones _user_students in the report. I only want to show the current users id. I have the permission in the PHPrunner set for users to only see thier own data, but I guess reports and especially my custom report isn't looking at this.
I tried to add a WHERE clause in the SQL designer but it doesn't let me go any further.
last part of my Query:
[codebox]`_user_students`.sign_medical,
`_user_students`.sign_name
FROM users
RIGHT OUTER JOIN `_user_students` ON `_user_students`.user_id = users.user_id
WHERE users.user_id = ".$_SESSION["UserID"]."
[/codebox]
Now I think it has to be done in users_reports_events.php
[codebox]
// Report page: Before SQL query
function BeforeQueryReport(&$strSQL,&$strWhereClause,&$strOrderBy)
{
WHERE users.user_id ".$_SESSION["UserID"]."
//** Custom code ****
// put your custom code here
} // function BeforeQueryReport[/codebox]
Do I add something here? Or is there another setting that I can do for this?
Thanks!
Bob