Spotting friends in a WWW
An easy way to allow the visitor of your website to share content with his friends on Hyves is to allow him to spot one of his friends in a WWW. This WWW wil be visibile in the buzz of all his friends and the spotted friend will get a notification in his Hyves inbox. A WWW with a spotted friend will look like this:

Step 1: Retrieve friends of logged in Hyver
First, we need to retrieve the friends of the currently logged in Hyver.
// How to sort the results. Options are "alphabetically" or "lastlogin" $sorttype = "alphabetically"; // Extra responsefields - In this case only the profile picture $responsefields = "profilepicture"; // Filter the request server-side by only asking for those return fields you need // In this case we need the userid, first name and profile picture $returnfields = "/user/userid,/user/firstname,/user/profilepicture/square_large/src"; // Which page to request. This API method is paginated in pages of 20 results $page = "1"; $oXML = $oGenusApis->doMethod("users.getFriendsByLoggedinSorted", array( "sorttype" => $sorttype, "ha_responsefields" => $responsefields, "ha_returnfields" => $returnfields, "ha_page" => $page ), $oOAuthAccessTokenLogintoken);
Now you'll need to create a friendpicker which allows you to browse through the Hyves friends of your visitor. In the live example we've made a suggestion on how to do this.
Step 2: Retrieve fancylayout tag of the friend
To spot a friend in a WWW you will need the fancylayout tag. This is a code which represents this specific Hyver on our platform.
// The userid of the friend you want to spot $userid = $_REQUEST['friend']; // To spot the friend, you need the fancylayouttag respsonsefield $responsefields = "fancylayouttag"; // Since you only need the responsefield, filter out all the other responsefields $returnfields = "/user/fancylayouttag"; // Get information from selected friend $oFriend = $oGenusApis->doMethod("users.get", array( "ha_responsefields" => $responsefields, "ha_returnfields" => $returnfields, "userid" => $userid ), $oOAuthAccessTokenLogintoken);
The result of the above API call will be the fancylayout tag of the selected friend:
[hyver=username]displayname[/hyver]
Step 3: Post the WWW
Now that you have all the required information to spot a Hyver in a WWW you can post it towards Hyves:
// The body of the WWW with the spotted friend $emotion = "Hey ".$oFriend->user->fancylayouttag.", check out this WWW!"; // The location of the WWW. This can be a link to your website $where = "Your location"; // The visibility of the WWW $visibility = "superpublic"; $oXml = $oGenusApis->doMethod("wwws.create", array( "emotion" => $emotion, "where" => $where, "visibility" => $visibility ), $oOAuthAccessTokenLogintoken);
This example uses the OAuth authorization example and the GenusApis PHP library.
Click here to see a live example and download the source code.