I have a code snippet that currently adds user information to a div with the id #userid. However, I need the ability to print out the user ID wherever I want, rather than it automatically adding to a div.
My main objective is to retrieve the USER ID and use it in a WordPress query. The userid is currently used as a post tag, and I aim to pull all posts from that specific user by querying posts based on the tag.
<script src="http://connect.soundcloud.com/sdk.js"></script>
<script>
SC.initialize({
client_id: "a808af7fabb53ad7971c6c9675f392b3",
redirect_uri: "http://madebyguerrilla.com/clients/2012/theappreciationengine/wordpress/wp-content/themes/TheAppreciationEngine_WP/callback.html"
});
$("#connect").on("click", function(){
SC.connect(function(){
SC.get("/me", function(me){
$("#username").text(me.username);
$("#userid").text(me.id);
});
});
});
$("#update").on("click", function(){
SC.put("/me", {user: {description: $("#description").val()}}, function(response, error){
if(error){
alert("Some error occurred: " + error.message);
}else{
alert("Profile description updated!");
}
});
});
</script>
Your assistance would be highly appreciated.