You are here

function _vkxp_post_to_wall in VK CrossPoster 7.2

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 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.

2 calls to _vkxp_post_to_wall()
vkxp_post_to_wall_action in ./vkxp.rules.inc
Action: Post node to VK wall.
_vkxp_process_node in ./vkxp.module
Process node and send it to VK if needed.

File

./vkxp.module, line 491

Code

function _vkxp_post_to_wall($message, $images, $url) {
  $params = array();
  $params['from_group'] = variable_get('vkxp_official', TRUE);
  if (variable_get('vkxp_wall_owner', 'group') == 'group') {
    $params['owner_id'] = '-' . variable_get('vkxp_owner_id', '');
  }
  else {
    $params['owner_id'] = variable_get('vkxp_owner_id', '');
  }
  $params['message'] = $message;
  $params['attachments'] = $images;
  if (variable_get('vkxp_add_link', FALSE)) {
    $params['attachments'] .= !empty($images) ? ',' . $url : $url;
  }
  $params['access_token'] = variable_get('vkxp_access_token');

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