Page 1 of 1

Error using field_UserName function.

PostPosted: Fri Aug 27, 2010 2:29 am
by jvinolas
Hi,

I'm using authentication with no problems at all. But, when a user edits their own profile, the field UserName appears blank, and I would like it to be the username by default. I know I can do it with this code:

Code: Select all
function field__UserName(&$record){
   $auth =& Dataface_AuthenticationTool::getInstance();
       $user =& $auth->getLoggedInUser();
       if ($user and $user->val('UserName')){
               return $user->val('UserName');}
}


But this error comes as I apply the code:

CREATE VIEW command denied to user 'lesmeves_oiko'@'localhost' for table 'dataface__view_users_d18a8d7ff3c4d268255d2ca340a227b5'


Also, it is not working the code to disallow editing of field UserName that I use in other fields with no problem. This is the code:

Code: Select all
function UserName__permissions(&$record){
   $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
         if ( !isset($user) ) {return Dataface_PermissionsTool::NO_ACCESS();
         $role = $user->val('Role');
         if ( $role!="ADMINISTRACIO"){
             return array('edit'=>0);   
         } else {
               return null;
         }
}


I would really appreciate any information about those problems.

Re: Error using field_UserName function.

PostPosted: Wed Sep 01, 2010 11:11 am
by shannah
Can you check your mysql permssions and make sure that the user that xataface is using to connect to the database (i.e. the username/pass in the conf.ini file) has permission to create views?