godfathr
Posts: 2
|
Posted: 07/13/2013, 9:07 AM |
|
I've looked through the forums but can't find an answer that works for me.
I want to limit the results in a grid that displays user info to only the current user.
I've tried setting the default value of a label to CCGetUserID(). This didn't work.
I've tried using the CCDLookUp and assigning it to a php variable with a Before Show event for the page:
global $myID;
$myID = CCGetUserID();
$myConnection = new clsDBgodfathrweb();
$currentID = CCDLookUp("ID","user_main","ID=\"" .$userID . "\"", $myConnection);
echo $currentID;
$myConnection->close();
Still nothing... Ideas where I'm going wrong?
|
|
|
saseow
Posts: 744
|
Posted: 07/13/2013, 12:08 PM |
|
When you create your datasource for the grid, add a where condition by selecting the users field and making it equal to the global variable for logged in users which is defaulted to UserID. Make the type 'session' and the results will only be for the logged in user.
|
|
|
jekes
Posts: 36
|
Posted: 07/15/2013, 1:03 AM |
|
Follow saseow tips
Be careful to set the security options of your project, otherwise the functions CCGetUserLogin, CCGetSession("UserId") ... will not be add to the common file of your project.
|
|
|
|