Ning Developer Docs

I need to check if an user already exists in another user's friend-list. For this I'm looking around for ways to use XN_Query to get a screenName's friend-list.
My ultimate purpose is to add the non-existent friend using XN_Profile's save() function.

I have tried using:
XN_Query::FRIENDS(XN_Profile::current()->screenName);

Can anybody let me know what I'm doing wrong?

Any insight is welcome.

Views: 1

Replies to This Discussion

You can use the REST API for this.
I tried this code, and it returned all of the users on the network, rather than just my friends. Is there something missing from it?

I also tried mimicking the /friends/[username] code but when called from a different spot, it again returned all of the people on the network rather than the current friends.
The above code is what I used to use also, but it stopped working for me as well. I found some other code that work for me though. I hope it helps (found in Profiles_UserHelper.php):

$query = XN_Query::create('Content')
->filter('type', '=', 'User')
->filter('owner')
->filter('contributorName', 'in', XN_Query::FRIENDS($screenName))
->begin($begin)
->end($end)
->alwaysReturnTotalCount(true);
User::addBlockedFilter($query);
User::addPendingFilter($query);
User::addUnfinishedFilter($query);
$results = $query->execute();

RSS

© 2026   Created by Ning Developer Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service