function answers_userpoints_views_default_views_alter in Answers 7.4
Implements hook_views_default_views_alter().
Adding the user points to the user.
File
- answers_userpoints/
answers_userpoints.views_default.inc, line 391 - Views defaults for the answers userpoints module.
Code
function answers_userpoints_views_default_views_alter(&$views) {
if (array_key_exists('questions', $views)) {
$views['questions']->tag = ($views['questions']->tag == '' ? '' : $views['questions']->tag . ', ') . 'answers_userpoints';
$handler =& $views['questions']->display['default']->handler;
/* Relationship: Userpoints total: User */
$handler->display->display_options['relationships']['uid_1']['id'] = 'uid_1';
$handler->display->display_options['relationships']['uid_1']['table'] = 'userpoints_total';
$handler->display->display_options['relationships']['uid_1']['field'] = 'uid';
$old_fields = $handler->display->display_options['fields'];
$handler->display->display_options['fields'] = array();
/* Field: Userpoints total: Current total points */
$handler->display->display_options['fields']['points']['id'] = 'points';
$handler->display->display_options['fields']['points']['table'] = 'userpoints_total';
$handler->display->display_options['fields']['points']['field'] = 'points';
$handler->display->display_options['fields']['points']['relationship'] = 'uid_1';
$handler->display->display_options['fields']['points']['label'] = t('!Points', userpoints_translation());
$handler->display->display_options['fields']['points']['exclude'] = TRUE;
$handler->display->display_options['fields']['points']['element_label_colon'] = FALSE;
$handler->display->display_options['fields'] += $old_fields;
/* Field: User: Name */
$handler->display->display_options['fields']['name']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['name']['alter']['text'] = '[name] <span class="answers-views-userpoints">[points]</span>';
}
}