Based on a conversation with Berdir, the plan is to move node and comment related modules that are currently part of Userpoints Contributed Modules to the userpoints_nc project (still as separate sub-modules).

So this issue thread is meant to track this change for the userpoints_pageviews sub-module (which allows points to be awarded to the node author when another user views the node).

--Ben

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BenK’s picture

When we bring over the module, we also need to make the following fixes. My comments below are based on the patch listed at http://drupal.org/node/869770#comment-3280332.

A. "Page limit" settings seems to work exactly the opposite as expected. Selecting "All" works like "One" is supposed to work and vice versa. More specifically, if you select "All", then only the first node view will result in a point award. If you select "One" then all node views result in points. So actually, the functionality is working, just exactly in reverse.

B. The operation listed in points transactions is "node view". This needs to be updated to our new machine name format.

C. The sub-module needs an automatically generated "Description" that would be listed in the "Reason" field. My suggestion for the format would be:

[username] viewed [nodetitle].

[username] would be the user who viewed the node, not the user (node author) who is receiving the points. In the "Reason" field, it is already linking to the node (which is great).

D. There should probably be a setting to optionally disable the drupal_set_message when points are awarded for a node view. Otherwise, the user viewing the page actually gets to see that the node author is getting points (even though they are not the points recipient).

E. The settings are using the old fieldset method instead of the new vertical tabs.

F. I'm also wondering if we should move the per content type settings (how many points are awarded) to the individual content type edit page and just have global settings on this page.

--Ben

Berdir’s picture

Status: Active » Needs review
FileSize
3.23 KB

Ok...

- Renamed module to Userpoints Visits (userpoints_nc_visits)
- Renamed all functions, variables, settings,...
- Generally brought this up to our standards as much as I could regarding settings, visually and descriptions.

A. Fixed.

B. Updated.

C. I don't think it would be a good idea to tell the visiting user names, they might not want to let you know (for example, if this module would include profile pages in a dating site.. you might not want to tell all the other users that you visited their profile). Anyway, it doesn't matter since it's not possible, we don't store this information.

D. No setting, always hidden now. Maybe we can add a setting later.

E. Added vertical tab including summary

F. Done, similiar to userpoints_nc. both points and category have a default setting and can be overridden per content type.

PS: Remember to disable and remove the old userpoints_pageviews module from the userpoints_contrib folder...

BenK’s picture

Hey Berdir,

I've begun testing the module and wanted to first pass along some UI and string clean-up. So here goes:

GLOBAL SETTINGS:

A. We should probably add an "Enabled by default" checkbox on the visits functionality to keep things consistent with the rest of userpoints_nc. The description would read: "If checked, all content types award !points for visited content by default. This can be overridden for each content type on the content type edit page."

B. On the global settings, change "Default !points for a visited content" to "Default !points for visited content" (delete the "a"). Also, here's a description for that setting: "Set the default number of !points awarded to a content author when the content is visited (by another user). This can be overridden for each content type."

C. Change the description on the default points category to read: "Choose the category of !points to be used by default when content is visited. This can be overridden for each content type."

D. Change the label "IP Click Ignore" to read: "Recurring visits duration". Change the description to read: "Select a time interval in which repeat visits to the same content from the same IP address will be considered a single visit."

E. Change the label "Page limit" to read: "Eligible content". Change the "All" option to read: "All content". Change "One" to read: "Only the first visited content". Change the description to read:

'Selecting "All content" (the default behavior) allows !points to be awarded for all content visited by a user. Alternately, selecting "Only the first visited content" will allow !points only to be awarded for the first piece of content a user visits during the "recurring visits duration" (with visits to additional content items ignored during the time interval).'

CONTENT TYPE SETTINGS:

F. Create an "Enabled" checkbox that must be checked for functionality to be active on this content type. The description would read: "If checked, !points are awarded for visited content of this type."

G. Change "Default !points for a visited content" to "!Points for visited content" (delete the "Default" and the "a"). Change the description so that it now reads: "Set the number of !points to be awarded to the content author when another user visits content of this type."

H. Change "Default !points category for visited content" to "!Points category for visited content." Change the description to read: "Choose the category of !points to be awarded to the content author when another user visits content of this type."

--Ben

BenK’s picture

Status: Needs review » Needs work
Berdir’s picture

Status: Needs work » Needs review
FileSize
3.45 KB

Updated :)

BenK’s picture

Status: Needs review » Needs work

I've tried the latest patch, but for some reason I can no longer see any point transactions for visits. Points do not appear to be awarded.

I'm not sure if this could be related to the new "Enabled" checkboxes (perhaps not working properly). I did notice that on the content type edit page, the vertical tab summary is not updating when the "Enabled" checkbox is toggled. So even when the functionality is disabled, it looks like it is enabled on the vertical tab summary.

I tried toggling the global "Enabled" checkbox and the content type one, but I couldn't seem to get any points awarded. I also tried changing the "Eligible content" settings, but that didn't have an effect.

One other thought: My "recurring visits setting" had been set to "1 day". I tried changing this without effect. But I did see a single userpoints_nc_visits transaction in my transactions table. Not sure if this occurred before or after the patch. So possibly the setting allowed only one visit award across all users? The "Eligible content" was set to "All content" for most of my testing.

Thoughts?

--Ben

P.S. During the testing process, I realized that I would have liked to have a drupal_set_message to let me know when points are being awarded. So I like that we removed this for the typical user, but it might be nice to have it back when developing.

The other thing I thought about is that there really should be some way to "audit" the visits to know if and when points are being awarded (and for whose visit). I understand why you said it's not good to identify the visiting user on a transaction (your dating site example), but perhaps this should be a admin only field only visible on the transaction view page? On a busy site, you'd see tons of userpoints_nc_visits entries in the transactions table, but have no way to make sure they are legit (or even if there is a bug in the system) because you don't have a record of who is making them. So possibly we should look at recording this information at the same time that the user IP is being recorded (but we can do this later if it's difficult to implement now).

BenK’s picture

A couple more things:

* All of the UI and string fixes look very nice!

C. For the automated "Description" field, I understand your point about not including the username. How about just this instead:

"Viewed [nodetitle]."

--Ben

Berdir’s picture

Well, the problem is that "Viewed [nodetitle]" is imho incorrect, because it suggests that you viewed the node but that's not true, someone else did...

Also, regarding the display user issue. Two things are currently making this impossible, and both could be changed but I'm not sure if we should really do that.

- Neither is the uid of the user stored in the userpoints transaction nor is there any connection to the {userpoints_nc_visits} table so there is no way we can find out by whom the points are

- The rows in userpoints_nc_visits are only stored temporarly and are deleted by cron after they are not needed anymore (= when they are older then the expiration time).

BenK’s picture

As discussed with Berdir in IRC, for C., we settled on this as the automated description:

"A user visited [nodetitle]."

And we're going to postpone the stuff about storing the particular user who visited.

So really the most pressing thing on this issue is figuring out why points have stopped being awarded (as described in comment #6).

--Ben

Berdir’s picture

Status: Needs work » Needs review
FileSize
3.46 KB

You were right, the enabled check was the wrong way round, fixed this.

BenK’s picture

Status: Needs review » Needs work

I just finished testing the latest patch. The "enabled" setting is now functioning great and points are being awarded for visits. Here's my to-do list:

1. The "Only the first visited content" setting on the global configuration page does not seem to be working. Even if that setting is selected, points seem to be awarded for all page visits.

2. On the content type edit page, perhaps change the vertical tab title from "Content visits" to "!Points for visits". This would better match the "!Points for revisions" vertical tab that we already have.

3. On both the global settings page and content type page, if you uncheck "enabled", the vertical tab summary is not changing (should now say "Not enabled" or something similar). As a result, the vertical tab summary indicates points are still being awarded even though the functionality is disabled.

4. Perhaps change the permission that reads "Track page visits for awarding content visit kudos". To this: "Track page visits". Short and sweet. Then change the permission description from this: "If a user has this permission when viewing a piece of content, the author will recieve the configured amount of kudos." To this: "Only users who have this permission will count toward page visits."

That's all I've got. We should be very close to committing this.

--Ben

BenK’s picture

Bumping this so I don't lose track of it...

Berdir’s picture

Status: Needs work » Needs review
FileSize
4.56 KB

1. Fixed, also added tests to verify this! The bug was simply that I used the wrong setting name.

2. Changed. Also set the weight to 30, which currently moves it all the way to the bottom. The other projects (especially node_access) will need to be updated too to end up with the discussed order of things.

3. Fixed. Also updated the strings to be more in line with userpoints_nc and userpoints_nc_revision. nodeaccess will need some minor adjustments too (just Enabled instead of "Userpoints node access enabled" for example).

4. Changed description to "'Only visits from users who have this permission will count as eligible for granting !points.'" Still not quite there but your suggestion sounds strange to me in a way that it says that users are counting toward visits. That doesn't match imho.

New version attached. Oh I want git so much.

BenK’s picture

Status: Needs review » Reviewed & tested by the community

The latest patch is working great... all issues are fixed. This is RTBC. Yay! :-)

Berdir’s picture

Status: Reviewed & tested by the community » Fixed

Commited, removed the truncation part before commiting it.

Status: Fixed » Closed (fixed)

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