Get Currently Viewed Profile User ID in module.

12 years 9 months ago #168330 by NicoFaaij
Hi,

Can't you just use the CB trigger:

global $_CB_framework;
$id = $_CB_framework->displayedUser();

This wil retun the id and with that you can get everything you want from je jos_comprofiler of jos_users tables.

You can also use the php way:

$id = $_GET["user"];
if ($iduser == "") //for example when user is logged-in on the site
{
$user =& JFactory::getUser();
$iduser = $user->get('id');
}

Hope this answers al you needs.

Kind regards,
Nico

Please Log in to join the conversation.

11 years 4 months ago #216629 by jason_ssba2
Replied by jason_ssba2 on topic Re: Get Currently Viewed Profile User ID in module.
Hi Nico

How do i access specific fields?

say i want to return the company name? field is called cb_companyname.
can i asses it like this?


$id = $_GET["user"];
if ($iduser == "") //for example when user is logged-in on the site
{
$user =& JFactory::getUser();
$iduser = $user->get('cb_companyname');
}

or what is the best way?

Please Log in to join the conversation.

11 years 4 months ago #216652 by NicoFaaij
Hi Jason,

This was the old fashion methode (this post is 1,5 years old). These days I use substitution for these kind of jobs. See www.allmysocials.com/directory/tutorials...3-substitution-usage for more information.

Kind regards,
Nico

Please Log in to join the conversation.

11 years 4 months ago #216653 by jason_ssba2
Replied by jason_ssba2 on topic Re: Get Currently Viewed Profile User ID in module.
Hi Nico
thanks for the reply.

Im looking at it now.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.224 seconds

Facebook Twitter LinkedIn