Problem with the function val()

Archived from the Xataface Users forum.

pyroboynroses — Sat Mar 20, 2010 2:22 am

Hi,

I’m putting a website on the internet and I have a problem.

When a user is connected in the xataface application, He can click on a button to make an action.

In this action, I want to put the user’s id in a variable.

So this the code in a class (class actions_paypal) :

Code: Select all
function handle($params) {          $auth =& Dataface_AuthenticationTool::getInstance();          $user =& $auth->getLoggedInUser();          $id = $user->val('id');

I’ve got this error :

Fatal error: Call to a member function val() on a non-object in /home/lepemcx/public_html/xatagestion/actions/paypal.php on line 12

The line 12 is the line of this action : $id = $user->val(‘id’);

Wether this code works well in local, it doesn’t on the internet.

Does anyone knows why and can help me ?

Thank you for your answers.


pyroboynroses — Sat Mar 20, 2010 2:40 am

Ok, so I tried this test :

Code: Select all
$auth =& Dataface_AuthenticationTool::getInstance(); $user =& $auth->getLoggedInUser(); if(isset($user)) $id = $user->val('id');

and the fonction is not executed that shows that the var $user is not set.

Why, the calls to $auth and $user are correct because i use the same functions in tables application delegate and it works.

So what’s the problem this this paypal.php file stored in the actions directory ???


pyroboynroses — Sat Mar 20, 2010 3:01 am

Ok i’ve found the error.

I call this action file with a form.

I put a wrong domain name in the form action= field.

So my problem is resolved !