function userpoints_nc_description_callback in User points Nodes and Comments 7
Description callback for userpoints operation description/reason.
1 string reference to 'userpoints_nc_description_callback'
- userpoints_nc_userpoints_info in ./
userpoints_nc.module - Implements hook_userpoints_info().
File
- ./
userpoints_nc.module, line 614
Code
function userpoints_nc_description_callback($operation, $entity) {
$arguments = array();
// Try to load content type name.
if ($operation->entity_type == 'comment' && $entity) {
$node = node_load($entity->nid);
$arguments['%title'] = $node->title;
}
elseif ($operation->entity_type == 'node' && $entity) {
$arguments['%title'] = $entity->title;
}
// Fallback to string content if the above failed for some reason.
if (empty($arguments['%title'])) {
$arguments['%title'] = t('content');
}
switch ($operation->operation) {
case 'userpoints_nc_node_insert':
return t('Added %title.', $arguments);
break;
case 'userpoints_nc_node_publish':
return t('Content was published: %title.', $arguments);
break;
case 'userpoints_nc_node_unpublish':
return t('Content was unpublished: %title.', $arguments);
break;
case 'userpoints_nc_node_delete':
return t('Content was deleted.', $arguments);
break;
case 'userpoints_nc_node_gain':
return t('Credited as author of %title.', $arguments);
break;
case 'userpoints_nc_node_loss':
return t('Removed as author of %title.', $arguments);
break;
case 'userpoints_nc_comment_insert':
return t('Commented on %title.', $arguments);
break;
case 'userpoints_nc_comment_publish':
return t('Comment was published on %title.', $arguments);
break;
case 'userpoints_nc_comment_unpublish':
return t('Comment was unpublished on %title.', $arguments);
break;
case 'userpoints_nc_comment_delete':
return t('Comment was deleted on %title.', $arguments);
break;
case 'userpoints_nc_comment_gain':
return t('Credited as commenter on %title.', $arguments);
break;
case 'userpoints_nc_comment_loss':
return t('Removed as commenter on %title.', $arguments);
break;
}
}