array( '#label' => t('Grant points to a user'), '#arguments' => array( 'user' => array( '#entity' => 'user', '#label' => t('User'), ), ), '#module' => t('Userpoints'), ), ); } function userpoints_event_info() { return array( 'userpoints_points_awarded' => array( '#label' => t('User was awarded points'), '#module' => t('User Points'), '#arguments' => array( 'user' => array('#entity' => 'user', '#label' => t('Current User')), 'points' => array('#entity' => 'points', '#label' => t('Points Awarded')) ) ) ); } // End Function /** * Implementation of a workflow-ng action: grant points to a user */ function userpoints_action_grant_points($user, $settings, &$arguments, &$log) { extract( workflow_ng_token_replace_all(array('number'), $settings, $arguments, $log) ); userpoints_userpointsapi(array('uid' => $user->uid, 'points' => $number)); } /** * Implementation of a workflow-ng action: disables revision moderation. */ function userpoints_action_grant_points_form($settings = array(), $argument_info) { $form = array(); $form['number'] = array( '#type' => 'textfield', '#title' => t('Number of points'), '#default_value' => isset($settings['number']) ? $settings['number'] : '', ); workflow_ng_token_replacement_help($form, $argument_info); return $form; } function userpoints_action_grant_points_submit($form_id, $form_values) { return workflow_ng_token_get_settings(array('number'), $form_values); } function userpoints_workflow_ng_userpoints($op, $points = 0, $uid = 0, $event = '') { switch ($op) { case 'points after': workflow_ng_invoke_event('userpoints_points_awarded', $uid, $points); break; } }