adding a variable where clause based on a user id
adding a variable where clause based on a user id
I have several Editor panels that I have been mandated to modify for one user (uid) to limit results only to where the country is ENG or WLS. The rest of the users need to see everything.
I thought I could do with something like the script below but apparently not. Can someone help me out and let me know the best way to accomplish this?
if($_SESSION['uid']=== 1983){
$uk_where = "->where( function ( $q ) {
$q
->where('crm.primary_profile.country', 'WLS', '=')
} ); ";
}else{
$uk_where = ' ';
}
and echoing out $uk_where after the joins but it doesn't work. Any help would be appreciated
Answers
Your
$uk_wherevariable there contains a string which some PHP code in it. You need to actually execute the code, not just make a strong out of it. You would do something like:If that doesn't help resolve the issue for you, can you show me your full script so I can help you insert the condition in the right place?
Allan
Thanks for the speedy response Allan the help is much appreciated.