solved Currently Viewed ProfileID

SoftDesigns
SoftDesigns
@softdesigns
7 years ago
242 posts
This custom module is logging correctly, after user hits any profile.
However $_nProfileID in the code below logs empty
function sdProfileRoute_init(){
	jrCore_register_event_listener('jrCore', 'profile_template', 'sdProfileRoute_profile_template_listener');
	return true;
}

function sdProfileRoute_profile_template_listener($_data, $_user, $_conf, $_args, $event)
{ $_sModule = "sdProfileRoute"; $_nProfileID = $_data['profile_id']; //2017.03.11-14:00-CT: How to get the ProfileID currently being viewed? jrCore_logger("INF", $_sModule.":DEBUG:JS:2017.03.11-14:00:".$_nProfileID, $_sModule); }

How to get the ProfileID currently being viewed?
updated by @softdesigns: 06/17/17 08:48:32AM
michael
@michael
7 years ago
7,714 posts
At that point coming in on $_data you have the url of the profile. (if it wasn't on $_data you could get it from post anyhow)

So use the profile_url that you know from the url to retrieve the profile info
$_profile = jrCore_db_get_item_by_key('jrProfile','profile_url', $_data['module_url']);
That will get the FULL profile along with quota info too, if you just want the profile_????? stuff skip the triggers
$_profile = jrCore_db_get_item_by_key('jrProfile','profile_url', $_data['module_url'], true);
michael
@michael
7 years ago
7,714 posts
That will give you all the profile info in an array (screenshot of a paused debugger in phpstorm)
profile.jpg
profile.jpg  •  501KB

Tags