1
-FireHorse-
Accessing Profile fields

Sorry if this sounds like a silly question as I am very new to php and am struggling understanding the basics. I am running 2.2.3 and have made a very basic chat module but I need to access a custom field called user_gender under prefix_user_profile and I cant seem to work it out

I have tried a few things, hopefully this code snippet will show what I am trying to achieve.

include("../../mainfile.php");
include (
$xoopsConfig['root_path']."header.php");

global 
$xoopsUser$yourGender$ProMode;

if(
$xoopsUser){
    
$thisUser $xoopsUser->uname();
} else {
    
$thisUser "Guest_null";
}
if ( 
file_exists("./language/".$xoopsConfig['language']."/index.php") ) {
    
$ircmotorlng $xoopsConfig['language'];
} else {
    
$ircmotorlng english;
}
if (
$xoopsUser) {
        
$yourGender $xoopsprofile->getVar("user_gender");
}


if(
$YourGender == male) {
        
$ProMode PROFILMODE1;
} elseif (
$yourGender == female) {
        
$ProMode PROFILMODE2;
} else {
        
$ProMode PROFILMODE0;
}


can anyone point out where I am going wrong and what I need to change to fetch user_gender as a variable for use in this page?

many thanks
FireHorse

2
chippyash
Re: Accessing Profile fields
  • 2007/2/21 7:17

  • chippyash

  • Friend of XOOPS

  • Posts: 501

  • Since: 2004/1/29


A cursory inspection shows that you do't appear to be instantiating teh xoopsprofile (or should that be xoopsProfile) object. Either this is global (and needs declaring as such) or it needs creating prior to use.

I don't know 2.2.3 as it is not the main XOOPS branch, but I hope this helps.

3
vaughan
Re: Accessing Profile fields
  • 2007/2/21 11:27

  • vaughan

  • Friend of XOOPS

  • Posts: 680

  • Since: 2005/11/26


well for 1 >

if($YourGender == male) {
        
$ProMode PROFILMODE1;


$YourGender should be $yourGender going on the rest of the script. (watch your upper/lower cases) ;)

Login

Who's Online

297 user(s) are online (208 user(s) are browsing Support Forums)


Members: 0


Guests: 297


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits