function getUserActivity($stream)
{
try {
if ($stream == "me") {
$response = $this->api->updates('?type=SHAR&scope=self&count=25');
} else {
$response = $this->api->updates('?type=SHAR&count=25');
}
} catch (LinkedInException $e) {
throw new Exception("User activity stream request failed! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e);
}
if (!$response || !$response['success']) {
return array();
}
$updates = new SimpleXMLElement($response['linkedin']);
$activities = array();
foreach ($updates->update as $update) {
$person = $update->{'update-content'}->person;
$share = $update->{'update-content'}->person->{'current-share'};
$ua = new Hybrid_User_Activity();
$ua->id = (string) $update->id;
$ua->date = (string) $update->timestamp;
$ua->text = (string) $share->{'comment'};
$ua->user->identifier = (string) $person->id;
$ua->user->displayName = (string) $person->{'first-name'} . ' ' . $person->{'last-name'};
$ua->user->profileURL = (string) $person->{'site-standard-profile-request'}->url;
$ua->user->photoURL = null;
$activities[] = $ua;
}
return $activities;
}