CurrentUserID() does not function on Linux/Apache?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
YogiYang
User
Posts: 101

CurrentUserID() does not function on Linux/Apache?

Post by YogiYang »

Hello,

The function ( CurrentUserID() ) available in Auto-Update Value property for fields when used does not yield expected value if the php code is executed on Linux/Apache. I am using Ubuntu in this particular case.

I have configured the Security to use Existing Table and in Advanced Security I have configured the UserID field to be BranchID which is not the user tables primary and index field the primary indexed field is UserID.

So using CurrentUserID() function returns the value of the field BranchID. This works perfectly on windows in XAMPP configuration but if the code is transferred to Ubuntu and executed there (again I am using XAMPP here also), it returns -1.

What must be the problem?

TIA

Yogi Yang


kirondedshem
User
Posts: 642

Post by kirondedshem »

I dont know why its not working on linux BUT I feel you are killing alot by trying to get branchId the wrong way so lets fix that first.

I have configured the UserID field to be BranchID which is not the user tables primary and index field the primary indexed field is UserID.

NOTE: If you mean you know that the user is actually supposed to be UserID, then I sugegst you leave it that way since phpmaker looks for uniqueness of the user, its only loggical that you use the primary key filed in advanced setyings tahta way you are sure every user id will always be unique, which is not the case if you use BranchId for userID as am sure many user's can belong to the same branch.
So I assume setiing user id to BranchID in advanced settings you wanted to return the branchID of a user so you can use it somewhere.
You can easily get any field vlaue from the user's table for the current user by using CurrentUserInfo("filed_name"), forexample to get the current branchID of looged in user createa function in globals.the add it to autoupdate list in advanced settinsg such that its available for use in autoupdate filed settings.
function CurrentBranchId()
{
return CurrentUserInfo("BranchID");
}

NOTE:this will not work for hardcoded user since he is not in the user's table so put consideration for that

HInt:
1.ensure the user exists in user's table ie not hardcoded user
2.Ensure every user has a value for branchID field, unless you have a reason to not set the branchId of some users tan put consideration for that as well.
3.you can try to call this fucntion in vardump somewhere for every user to test its working as expected.


YogiYang
User
Posts: 101

Post by YogiYang »

kirondedshem,

Thanks for your inputs. I have changed my setting. Will test it first thing tomorrow morning.


Post Reply