Page 1 of 1

problem with firstname and lastname !!!

Posted: Thu Mar 01, 2007 4:15 pm
by vireden
hello,

i use feu and custom content but i dont know how use firstname and lastname with uusername -->{username}

i give my program:
----------------------------------------------
global $gCms;
$feusers =& $gCms->modules['FrontEndUsers']['object'];
$userid = $feusers->LoggedInName();
$pass = $feusers->GetUserProperty($userid);

echo "a$userid
";
echo "b$feusers
";
echo "c$pass
";

$prenom = $name;

      $user="root";
      $host="Localhost";
      $password="";
      $database="cms";
             
      $connexion = mysql_connect($host, $user, $password) or die ("Connect impossible");
      $db = mysql_select_db($database, $connexion) or die ("database impossible");

      $rq = "SELECT first_name FROM cms_users WHERE username= '$userid'";
      $result = mysql_query($rq) or die ("Request impossible");
 
echo "hello $result";

-------------------------------------------------------

For echo "a$userid
"; --> it is good but,
For echo "hello $result"; --> it is bad (Hello resource id #258)

do you help me to find a answer? thanks.

Re: problem with firstname and lastname !!!

Posted: Thu Mar 01, 2007 4:20 pm
by calguy1000
The way to interact with the FrontEndUsers module is via the api, as described in FrontEndUsers.api.php

Try this:

Code: Select all

global $gCms;
$feusers = $gCms->modules['FrontEndUsers']['object'];
if( $feusers )
  {
      $uid = $feusers->LoggedInId();
      $properties = $feusers->GetUserProperties($uid);
      print_r( $properties );
  }