This request came as a result of a question on Drupal Answers. I had to show a user how to incorporate userpoints descriptions into a custom view, which included his having to modify the code in userpoints.views.inc to expose txn_id to the view.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Triskelion’s picture

Status: Active » Patch (to be ported)
FileSize
1.02 KB

This patch adds the Transaction ID to userpoints.views.inc, and it corrects a longstanding bug in the node relationship.

Berdir’s picture

Status: Patch (to be ported) » Needs work

Thanks, needs review is the correct status for issues with a patch.

+++ a/userpoints.views.inc	2013-02-28 23:17:17.077230132 -0500
@@ -432,7 +432,7 @@ function userpoints_views_data() {
-          'field' => 'nid',
+          'base field' => 'nid',
           'label' => t('Entity'),
           'handler' => 'views_handler_relationship',

Can you move this part to #1335956: I have entity as 'node' and entity_id as node ids. How to use this to show [node:title] field in Views?.

A patch/issue should only fix a single problem and not mix new features with bugfixes.

Also, the problem with this is that it should also limit entity_type to node, otherwise you could end up with referenced to node for comment or user ids.

+++ a/userpoints.views.inc	2013-02-28 23:17:17.077230132 -0500
@@ -463,7 +463,20 @@ function userpoints_views_data() {
+  $data['userpoints_txn']['txn_id'] = array(
+	  'title' => t('Transaction ID'),
+	  'help' => t('Userpoints Transaction ID'),

This should use two spaces instead of tabs, see drupal.org/coding-standards

Triskelion’s picture

Status: Needs work » Patch (to be ported)
FileSize
770 bytes

Also, the problem with this is that it should also limit entity_type to node, otherwise you could end up with referenced to node for comment or user ids.

Thanks Berdir. I have split the patch and eliminated the tabs, and I corrected an oops in the filter handler (changed string to numeric). I am not sure what you mean by limiting entity_type (bundle?) to node.

Triskelion’s picture

Status: Patch (to be ported) » Needs review

Changed status

Status: Needs review » Needs work

The last submitted patch, userpoints-1930848-3.patch, failed testing.

Triskelion’s picture

Status: Needs work » Needs review

#3: userpoints-1930848-3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, userpoints-1930848-3.patch, failed testing.

Triskelion’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
756 bytes

Re-rolled with 7.x-1.x-dev.

Berdir’s picture

Status: Needs review » Needs work

Hm, still has tabs in the patch. Please replace those with two spaces instead.

Triskelion’s picture

FileSize
770 bytes

Hm. Spaces in the code, tabs in the diff. I will know to hand edit next time.

Berdir’s picture

Status: Needs work » Needs review
Berdir’s picture

Status: Needs review » Fixed

Thanks, commited.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.