public static function addPost($owner_id, $user_id, $message = '', $attachments = '') { mpr($owner_id); $g = self::getPlusMinusId($owner_id); $arAttachments = App::upload_photo($g, array($attachments)); $attachments = array(); foreach ($arAttachments as $key => $value) { $attachments[] = 'photo' . $user_id . '_' . $value; } $data = App::api('wall.post', array('owner_id' => $g, 'message' => $message, 'attachments' => $attachments)); return $data['post_id']; }
public static function addPost($owner_id, $user_id, $message = '', $attachments = '', $link = '') { $user = self::getUser($owner_id); $attach = array(); if (strlen($attachments) > 0) { $arAttachments = App::upload_photo($user->id, array($attachments)); foreach ($arAttachments as $key => $value) { $attach[] = 'photo' . $user_id . '_' . $value; } } if (strlen($link) > 0) { $attach[] = $link; } $data = App::api('wall.post', array('owner_id' => $user->id, 'message' => $message, 'attachments' => $attach)); return $data['post_id']; }