function _vkxp_post_to_wall in VK CrossPoster 6
Same name and namespace in other branches
- 6.3 vkxp.module \_vkxp_post_to_wall()
- 6.2 vkxp.module \_vkxp_post_to_wall()
- 7.2 vkxp.module \_vkxp_post_to_wall()
- 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 page:
Return value
array: server response
1 call to _vkxp_post_to_wall()
- vkxp_nodeapi in ./
vkxp.module - Implementation of hook_nodeapi
File
- ./
vkxp.module, line 290
Code
function _vkxp_post_to_wall($message, $images, $url, $node) {
$params = array();
if (variable_get('vkxp_wall_owner', 'group') == 'group') {
$params['owner_id'] = '-' . variable_get('vkxp_group_id', '');
$params['from_group'] = variable_get('vkxp_official', 1);
}
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', '');
$result = vkxp_query('wall.post', $params);
if ($result['response']['post_id'] || $result['response']['processing']) {
_vkxp_watchdog(array(
'text' => t('Node "!title"was successfully posted to vkontakte.ru', array(
'!title' => $node->title,
)),
'severity' => 'status',
), l(t('View'), 'node/' . $node->nid));
}
elseif ($result['error']) {
_vkxp_watchdog(array(
'text' => t('Node was not posted to vkontakte.ru. Error: !error', array(
'!error' => $result['error']['error_msg'],
)),
'severity' => 'error',
), l($node->title, 'node/' . $node->nid));
}
}