Skip to Content Skip to Menu

How to retrive fileds from #_comprofiler ?

  • applied
  • applied
  • OFFLINE
  • Posts: 10
  • Thanks: 0
  • Karma: 0
12 years 5 months ago #199961 by applied
Hello , I tried all below methods still I'm not able to retrieve the filed value from #_comprofiler .

Kindly I request to suggest me in this.

First method.

function funcasd($myId){
global $_CB_database;

$query="SELECT cb_customefldone"
. "\n FROM jos_comprofiler"
. "\n WHERE userid=" . $myId ;

$_CB_database->setQuery($query);
$result = $_CB_database->loadResult();
return ($result == NULL) ? 'Not success' : $result;
}

after this I called the function but no result.

Second method

$queryusrcat="SELECT cb_customefldone"
. "\n FROM jos_comprofiler"
. "\n WHERE userid=" . $myId ;

mysql_query($queryusrcat);
$usrcat = mysql_query($queryusrcat);


Thanks.

Please Log in or Create an account to join the conversation.

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
12 years 5 months ago #201160 by sfraise
If you're doing this outside of the cb framework you need to add the cb api first, then you would do something like:
Code:
$myfield = $cbUser->getField('cb_myfield', null, 'html', 'none', 'list' );

Krileon has a link to a good tutorial in his forum signature that goes into more detail on it.

Please Log in or Create an account to join the conversation.

12 years 4 months ago #201377 by amaster130
Replied by amaster130 on topic Re: How to retrive fileds from #_comprofiler ?
I have a similar problem:

$user = &JFactory::getUser(); $userid = $user->id; $db = &JFactory::getDBO(); $db->setQuery("SELECT `cb_profiletype` FROM #__comprofiler WHERE id =" . $user->id); $profiletype = $db->loadResult();
$db->setQuery("SELECT `name` FROM #__comprofiler WHERE id =" . $user->id); $name= $db->loadResult();

I'm using the above code.

The problem is that $profiletype works, but $name is blank.

I checked the underlying profile and the name field definately has the name in it.

Any ideas?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum