Reputation: 2186
Thanks to this previous thread: Parse, Fetch and Display Current User
I managed to display the Current User's username,
I figured that I could also display the user's ID using .getObjectId();
So I gave that a try, but I get an error in the console telling me that it is undefined.
Here is my code:
$(document).ready(function(){
Parse.initialize("xxxx", "xxxx");
var currentUser = Parse.User.current();
currentUser.fetch().then(function(fetchedUser){
var name = fetchedUser.getUsername();
var uniqueID = fetchedUser.getObjectId();
$('.container').append('<ul class="nav pull-right"><li><a id="nametag" href="#">' + name + '</a></li></ul>');
$('.btn-box-row row-fluid').append('<a href="#" class="btn-box big span4"><i class=" icon-random"></i><b>' + uniqueID + '</b>');
});
});
Upvotes: 0
Views: 102