Current status of the Ning Platform is always available on the Ning Status Blog.


NC for Hire

Hi there,

Yep, I've been M.I.A from some time now, yet again, due to my work and college stuff. So, today, I will be sharing on how can we use the ning.CurrenProfile variable.

The Wonders of User Profile Variable

You can see these variables popping out here and there in scripts made by others. But what exactly are they and how can we utilize it?

They are what we called Javascript associative array which holds information of  a user, they store:

Your Ning ID, name, gender, location, country, profile photo, profile url and age.

For example, this is mine:

"CurrentProfile":{"id":"18abpibelhnjw","profileUrl":"http:\/\/\/profile\/ElsonTan","location":"","age":17,"gender":"m","fullName":"Elson Tan","photoUrl":"http:\/\/\/topology\/rest\/1.0\/file\/get\/963872840?profile=original%3A1","country":"MY"}

You can see yours by view sourcing any page on Ning network, and search for "CurrentProfile".

How do we use this?

We can access it using javascript for example:


alert("This is my name! " + ning.CurrentProfile.fullName);


Here's the list of the variables we can access to:

Full Name : ning.CurrentProfile.fullName

Ning ID :

Profile URL: ning.CurrentProfile.profileUrl

Location(state, if provided): ning.CurrentProfile.location


Age: ning.CurrentProfile.age

Photo URL: ning.CurrentProfile.photoUrl

Gender: ning.CurrentProfile.gender


1. Restricting access to certain pages by determining their age group


if(ning.CurrentProfile.age < 18){

    window.location.href = '/'; //redirect to home page


(P/S: Samething with ning.CurrentProfile.gender, just use == 'm' or == 'f'

2. Welcome the user

Place this html inside a textbox on home page:

Welcome, <div class="thisusername"></div>.

And, place this script into your custom code(below):




3. The above example shows user's name, but what about their photo too?

Same as above, put this into any place you want their thumbnail to show up, HTML:

<div class="userthumb"></div>



var sizeofthumb = 50;

x$('.userthumb').html('<img src="'+ ning.CurrentProfile.photoUrl +'&width='+ sizeofthumb +'">');


This will produce:

<div class="userthumb"><img src=""></div>

Produces a thumbnail with size of 50x50px

4. Determine if current user is a guest/member


if(ning.CurrentProfile === null){

alert('you are guest');

} else {

alert('you are user');



5. Create user profile link


<a href="#" class="userprofilelink">My Profile</a>



x$('a.userprofilelink').attr('href', ning.CurrentProfile.profileUrl);


That's it, there are still more ways to use these guys, its all based on your ideas. 

Happy Coding. 

You need to be a member of Ning Creators Social Network to add comments!

Join Ning Creators Social Network

Email me when people reply –


      • Hi there Kyryl. I am not sure which code. I wanted it to look like this though with their avatar picture inside a block on a page besides the main page. 

      • Hi there Kyryl I am trying to put this in a profile block on different pages other than the profile page. 

        • Hi there!

          There is no such thing as alerts on 3.0. Since you have shared the screenshot from 2.0 such functionality or block could be only created on 3.0. As there are only links presented you can place the HTML block on the page where you wish this block to be shown and make sure that it would be shown to the sign in members only. After just place the links to the friends, inbox, sign out, and the settings, if necessary you can add pictures to each link. The plus of this approach is that you can accomplish everything without coding :-)

          Best regards,

          Ning Team.

          • Thanks so much Kyryl! :) How can I add the members profile picture at the top?

            • Hi there!

              I'm not sure what exactly are you trying to do, where the picture should be added exactly? Should it be the picture of the logged in as a member or it should be the list of pictures of all your members?

              Best wishes,

              Ning team.

              • I want it to be the picture of the logged in member above the sign out link in the picture

                • Hi there!

                  You can try something like this:


                  if (ning.CurrentProfile!=undefined){x$('.ningbar-userLinks li:last-child').before('<li><img src="'+ ning.CurrentProfile.photoUrl +'" height=24></li>')}
                  Should be inserted into the custome code section, end of page field.

                  Hope this helps.

                  Best regards,

                  Ning Team.

                  • Hi there Kyryl, I wanted to put the logged in members picture in a custom box on a page? how can I do that? and how can I add their message with the notification number icon as well into the custom box on a page? 

                    • Hi there!

                      You should modify the script a bit. Instead of the .ningbar-userLinks li:last-child there should be the selector of the container in which you wish to insert the member's picture. .before should be replaced with .append or .prepend since we will be inserting the picture into the box you have determined in the previous step. Then you should do the same for teh message list, using .append or .prepend method the .recentMessages-list should be inserted into teh custom box you have determined.

                      Hope this helps,

                      Best regards,

                      Ning Team.

                      P.S. Since it's not clear where exactly you wish to insert everything you have mentioned I'm not able to provide you with an exact code.

                    • Hi there Kyryl. I wanted to put it to be like this in the picture. 

This reply was deleted.

Featured Discussions



Some interesting articles related to community management, digital marketing etc. could be found in our digest. Don't hesitate to leave a feedback so we would know that we should continue :-)

Latest Activity

Stefan Groll updated their profile
Mateus de Assis Rosa, richard butler and Toni Sheree Bowlson joined Ning Creators Social Network
Jeanette Delgado replied to Dr. Krishna Kumari Challa's discussion
Why isn't my Ning network site not secure?
"Hello I need help with the SSL certificate. Can you help me? Please install the free certificate.
Alex Ning Support replied to ⚡JFarrow⌁'s discussion
A Couple of Improvements I'd Like to See on Creators
Thank you for your suggestions.
I will speak with our developers about the search with resul…"
Alex Ning Support and Fabricio Giugni are now friends
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion
A Couple of Improvements I'd Like to See on Creators
"I wanna add one more request.   In the 2.0 communities admins had a button and a way to share a pos…"
Manuel A J replied to ⚡JFarrow⌁'s discussion
A Couple of Improvements I'd Like to See on Creators
"Bizz I am with you ... important to evolve to transcend these moments of life ... we must give life…"
Apr 17
Bizz replied to ⚡JFarrow⌁'s discussion
A Couple of Improvements I'd Like to See on Creators
"Would be nice but it’s not like the old days when it was always a hive of activity here, unfortunat…"
Apr 16
⚡JFarrow⌁ posted a discussion
I have just a couple of improvements that I'd like to see on Creators Network which should not take…
Apr 15
Alex Ning Support replied to Suzie Nielsen's discussion
SSL on Ning 2
"Hello, Raven.
Sorry for the delay response.
We have the system that updates the SSL certificate aut…"
Apr 14

Meanwhile, you can check our social media channels