Hi,
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>
<script language="JavaScript" type="text/javascript">// <![CDATA[
var author = ning.CurrentProfile.id;
document.getElementById("testIframe").src = "http://xxx.com/test.php?author="+author;
// ]]></script>
Now in the file test.php I have:
<?php
require_once('ning-api-php/NingApi.php');
//Get HTTP vars
$author = trim($_GET['author']);
$args = array(
"author" => $author
);
$result = NingApi::instance()->user->fetch($args );
print_r($result);
?>
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?
Tags:
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!
Posted by Kyle Ford on October 13, 2010 at 8:00am 3 Comments 3 Likes
Posted by Phil McCluskey on October 1, 2010 at 8:55am 0 Comments 1 Like
Posted by Kyle Ford on September 30, 2010 at 8:30pm 1 Comment 1 Like
© 2023 Created by Build Team.
Powered by