How to Show User Profile Number??

Permalink
I am running a contest which requires users to know their profile number.

Short of going tohttp://www.airsoftmanitoba.com/index.php/profile/... and clicking there own name to seehttp://www.airsoftmanitoba.com/index.php/profile/##/...
and viewing their number in the link?

Is it possible for me to show the person user number within text or in a block?

Any help, greatly appreciated. Would make this much easier for me.

Thank You!!

 
pmarques replied on at Permalink Reply
pmarques
Hello,

You can get and write user data programmatically. In you template or single page, you'll do something like this:

<?php
$u = new User();
echo $u->getUserID();
?>


You'll find full documentation, showing all available methods, here:
http://www.concrete5.org/documentation/developers/permissions/users...

Hope this helps!
stonereptiles replied on at Permalink Reply
Thank you for the reply.
Is there a way for me to display this within the HTML code of a "content" block?
I'm trying to have the number show as many times as possible i.e.
- Simply submit your user ID ## Over facebook to enter the contest

and other places.
I'm still new to coding and outputting attributes within Concrete.
pmarques replied on at Permalink Best Answer Reply
pmarques
I don't think it would be possible to display the user ID within the HTML block, but I can get you another really easy way to do it:

- Install the "Simple PHP Block" add-on:
http://www.concrete5.org/marketplace/addons/simple-php-block/...
- Add the block to an editable area
- Add the following code to the block:
$u = new User();
$ID = $u->getUserID();
if($ID!=null){
     echo "Your user ID is ".$ID;
}


Will this work for you?
stonereptiles replied on at Permalink Reply
That will work. and I can keep playing around with it.
Thank You :)
pmarques replied on at Permalink Reply
pmarques
Glad I could help!
Please don't forget to mark as best answer so the thread is closed and we get our sweet, sweet karma =)

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.