You are here

function _vkxp_post_to_wall in VK CrossPoster 7

Same name and namespace in other branches
  1. 6.3 vkxp.module \_vkxp_post_to_wall()
  2. 6 vkxp.module \_vkxp_post_to_wall()
  3. 6.2 vkxp.module \_vkxp_post_to_wall()
  4. 7.2 vkxp.module \_vkxp_post_to_wall()

Post node message with uploaded images to wall.

Parameters

$message: Text to post.

$images: String with photo IDs to post.

$url: Absolute link to posted node.

Return value

array Server response.

1 call to _vkxp_post_to_wall()
_vkxp_process_node in ./vkxp.module
Process node and send it to vk.com if needed.

File

./vkxp.module, line 415

Code

function _vkxp_post_to_wall($message, $url, $images = '') {
  $params = array();
  $params['from_group'] = variable_get('vkxp_official', 1);
  if (variable_get('vkxp_wall_owner', 'group') == 'group') {
    $params['owner_id'] = '-' . variable_get('vkxp_group_id', '');
  }
  else {
    $params['owner_id'] = variable_get('vkxp_group_id', '');
  }
  $params['message'] = $message;
  $params['attachments'] = $images;
  if (variable_get('vkxp_add_link', 0)) {
    if ($images) {
      $params['attachments'] .= ',' . $url;
    }
    else {
      $params['attachments'] = $url;
    }
  }
  $params['access_token'] = variable_get('vkxp_access_token');

  // Send query to vk.com and return result.
  return vkxp_query('wall.post', $params);
}