示例#1
0
/**
 * Post update to Linkedin
 */
function buddystreamLinkedinPostUpdate($content = "", $shortLink = "", $user_id = 0)
{
    global $bp;
    $buddyStreamFilters = new BuddyStreamFilters();
    //strip out location tag
    $content = str_replace("#location", "", $content);
    $content = $buddyStreamFilters->filterPostContent($content, $shortLink);
    $content = '<?xml version="1.0" encoding="UTF-8"?><share><comment>' . $content . '</comment><visibility><code>anyone</code></visibility></share>';
    //Handle the oAuth requests
    $buddystreamOAuth = new BuddyStreamOAuth();
    $buddystreamOAuth->setPostData($content);
    $buddystreamOAuth->oAuthRequestPostXml('https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=' . get_user_meta($user_id, 'buddystream_linkedin_token', 1));
}