We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Get the id of the profile visited | Forum

Damien
Damien Sep 11 '13

How to get the id of the profile displayed by the connected user ?


If "user 1" viewing profile "user 2" I would like to retrieve the id of "user 2".

Sean
Sean Sep 14 '13
I had to do this the other day:


function ownerbadges_members_action_tool( BASE_CLASS_EventCollector $event )

{    


$params = $event->getParams();

$targetUserID = $params['userId'];

}


Or, if you want to find out what user a widget is currently being displayed on use this:


public function __construct( BASE_CLASS_WidgetParameter $params )

{

parent::__construct();

//Get current user profile

$targetId = $params->additionalParamList['entityId'];

}

The Forum post is edited by Sean Sep 14 '13
Damien
Damien Sep 14 '13

Thank you very much for your help.


I found a solution, but it was not great.

Yours is better now. thk

Damien
Damien Sep 14 '13

I can not seem to use your method.I joined the "function" in my "public function" but my variante gives me no result?Here's how I do:


public function __construct( BASE_CLASS_WidgetParameter $paramObj )

{

parent::__construct();

function ownerbadges_members_action_tool( BASE_CLASS_EventCollector $event )

{    

$params = $event->getParams();

$targetUserID= $params['userId'];

....

}

}


Can you help me?

Sean
Sean Sep 14 '13
If you're using it in a widget you need to use 


$params->additionalParamList['entityId'];


Not $params['userId'];

Damien
Damien Sep 14 '13

Ok, thank you.

I need a communication between two different widgets.

But I'll do a search on the database to find the id of the profile with EntityID

Thank you very much for your help

Daisy Team
Daisy Sep 19 '13
Damien, you can also check the Who viewed me plugin to see how it works: http://www.oxwall.org/store/item/166
The Forum post is edited by Daisy Sep 19 '13
Damien
Damien Sep 19 '13

Thank you, but I made ​​uses the database and it works very well.

Thank you very much.