Hi,
I am trying to create a drop down list with the community builder user's connections.
So far I wrote the following code in the dropdown items which shows all CB users first name and last name and stores their user_id.
Code:
$items = "|Please Select[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT user_id,firstname, lastname FROM jos_comprofiler");
$result = $db->loadObjectList();
foreach ($result as $r)
$items .= $r->user_id. '|' . $r->firstname." " . $r-> lastname."\n";
return ($items);
Now I would like to add to the select query an additional criteria which would make the dropdown only return the users' CB connections. Something which would say this:
First get CB user ID (this part works OK):
$my = & JFactory::getUser();
$db = JFactory::getDBO();
$myid = $my->id;
Only select my CB connections (here I'm struggling):
SELECT user_id,firstname, lastname FROM jos_comprofiler
WHERE referenceid ='".$myid."' AND accepted = 1 (in the jos_comprofiler_member table)
The section where I'm stuck is the "WHERE" part...
I'm stuck for days on this so I'm desperately looking for help.
Thanks
Philippe
Joomla 1.5
CB 1.4