I have managed to get the current logged in members email address, but think I have made it overly complicated. This is what I have done, my question is, is there a more efficient way to do it?
In my ning network, I have added a text box and inside this, put the following HTML:
<iframe id="testIframe" horizontalscrolling="no" allowtransparency="allowtransparency" style="border: none; width: 500px; overflow-x: hidden;" name="testIframe" frameborder="0"></iframe>
var author = ning.CurrentProfile.id;
document.getElementById("testIframe").src = "http://xxx.com/test.php?author="+author;
Now in the file test.php I have:
//Get HTTP vars
$author = trim($_GET['author']);
$args = array(
"author" => $author
$result = NingApi::instance()->user->fetch($args );
This then gives me access to the logged in members email address, which I will then use to pull out of SalesForce some relevant data for that member and display it.
It works, but can I do this better?
Why does this work fine on my test network, but doesn't work for non-admin users (i.e. members) on my live network?
On my live network, I get the following error:
Fatal error: Uncaught No User matches your query. (404) 3-1 thrown in /var/www/app.royalcanin.ca/ning/api/ning-api-php/NingException.php on line 56
In the above code example, if the $author is a 'member' id, I get the above error.
Works fine for admin. On test, members and admins get data returned appropriately.
Ok, ignore me.
I hadn't updated my tokens and network address in NingApi.php
It was still set to my test network. Schoolboy error. Nothing to see here...move along. All working fine!