I have a Open Social Application and maintained at my ning network.  And i wanted to store the user records which one accessed my application.

 

Could you please help me how to get the current user details and what is the best method to store the records.

 

Thanks

Views: 117

Reply to This

Replies to This Discussion

You need to create a use the newFetchPersonRequest() data request function. The name of person you need to specify is VIEWER. Checkout the Accessing Member Information example and let me know if you have further questions. Here is the relevant code:

var req = opensocial.newDataRequest();
var viewer = opensocial.IdSpec.PersonId.VIEWER;
req.add(req.newFetchPersonRequest(viewer), 'viewer');
req.send(callbackFunction);

Thank you very much Devin,

 

Now i wanted to display Users in my webpage (i.e. Drupal content Page). I have placed the code in my webpage source code as like this:

<?php

require_once(file_directory_path().'/ning_apps/api/src/NingApi.php');

$users = NingApi::instance()->user->fetchNRecent(5);

$returnData['users'] = $users;

print(json_encode($returnData));

?>

When i execute this page getting following error message:

 

Fatal error: Uncaught Invalid query parameters. Suspect parameters: [amp;fields] Options are: ? ?private=true ?private=false ?author=* ?author=*&private=true ?author=*&private=false ?approved=false ?approved=true ?author=*&approved=false ?author=*&approved=true (400) 2-3 thrown in /var/www/vhosts/mendprogramme.org/httpdocs/sites/default/files/ning_apps/api/src/NingException.php on line 56

 

Could you please help me how to execute my code in drupal page.

 

Thanks

VLRao

It looks like there is an encoding issue with the URL. The 'Suspect parameters: [amp;fields]' part shows that the URL's ampersand (&) was converted to an HTML entity. The PHP function htmlentities() does this but the default PHP client code doesn't contain that function.

 

I haven't been able to reproduce this issue. Did you make any modifications to the Ning PHP client code?

 

Reply to Discussion

RSS

Blog Posts

Getting Started

Posted by Kyle Ford on October 13, 2010 at 8:00am 3 Comments

A Note on API Pricing

Posted by Phil McCluskey on October 1, 2010 at 8:55am 0 Comments

Welcome to Build!

Posted by Kyle Ford on September 30, 2010 at 8:30pm 1 Comment

Ning Status

© 2024   Created by Build Team.   Powered by

Badges  |  Report an Issue  |  Terms of Service