How to get uID from Profile page?

Permalink
I'm making a block to go on a profile page, and need to get the uID of the profile page I'm on. Is there an easy way?

WebSolutions
 
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
From "Search Users" in the dashboard
Right click the username and inspect the element, it should display the UserID
WebSolutions replied on at Permalink Reply
WebSolutions
Thanks but I'm referring to building a block.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Are you sure its uID you need or is it cID?
WebSolutions replied on at Permalink Reply
WebSolutions
I need the uID. It is passed to the view() via /profile/ID. The cID will always be the same.
enlil replied on at Permalink Reply
enlil
I think the answer in this thread is what you are looking for...

http://www.concrete5.org/community/forums/customizing_c5/content-ba...
WebSolutions replied on at Permalink Reply
WebSolutions
Thank you for that. I did try the $profile object first to try to grab the uID but $profile is not already defined by my block controller. Do you know how to define it, or grab it somehow?
enlil replied on at Permalink Reply
enlil
Digging through /concrete/core/controllers/single_pages/profile.php I see around line 24 in the on_view:
$profile = UserInfo::getByID($userID);


So... I would think adding this to your block controller *should* solve the problem ?!

I'm not positive about this though. To my understanding $profile should be available already in that case ?!
WebSolutions replied on at Permalink Reply
WebSolutions
I need the uID, so if I had profile, I could get uID; if I had uID I could create profile, but it's a catch 22 :)

I still need to get the uID of the profile that I'm viewing. There's probably a million ways to get it, I just need one! :)
adajad replied on at Permalink Reply
adajad
nevermind...

I didn't read through the whole thread
JohntheFish replied on at Permalink Reply
JohntheFish
Profile is a single page that switches what it shows based on a uid extracted from the page url. The only way to get the uid for the currently showing profile is to extract it from the current url.

If you are on a profile page and there is no such url, then you can only be on your own profile page or editing the overall profile page, in which case you can use the current uID.

So for your block, you need to read the pages url and parse it.

Rather than mess about creating a block, you may well be able to achieve all you need using Magic Data. Magic Data includes symbols specifically for use on profile pages. http://www.concrete5.org/marketplace/addons/magic-data/...
WebSolutions replied on at Permalink Reply
WebSolutions
Thanks for the suggestion John. I had decided to grab the URL and parse the ID from there with string manipulation - not the way I had wanted to go but couldn't see another way without setting up an override of the profile.php page, and passing the $profile object (or at least the $uID) to a custom element. I always want to minimize my reliance on override files, so meh, went with this method.