Closed (fixed)
Project:
Simplenews Statistics
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Nov 2009 at 15:20 UTC
Updated:
15 Oct 2011 at 17:36 UTC
Jump to comment: Most recent file
Comments
Comment #1
j0nathan commentedHi,
From my first patch, I changed the permission name from 'view newsletters statistics' to 'view all newsletters statistics' in case one day we can separate viewing by newsletter.
Please see attached patch.
Comment #2
Docc commentedYeah a seperate permission is a good idea.
Though you should put the new permission in the existing array.
like this:
Ill commit to HEAD this week
Comment #3
j0nathan commentedGood point, thank you!
Comment #4
beekerstudios commentedRegarding granular control over stats and newsletter info...
What I did, is build a view for "Sent Issues", since that function of simplenews also suffers from the same, all or nothing paradigm.
I then built a custom TPL off of the view, to add on the clicks/opens. Doesn't give all data/info, but this actually allows me to limit newsletter admins so they only see click traffic to their sent issues. It doesn't even allow them to see other newsletter submissions from other admins who can send to the same newsletter.
In my case that doesn't really matter, since for the most part it will be a 1 user to 1 newsletter, or 1 to few newsletter ratio. Not a many users to 1 newsletter ratio.
The other added benefit is I limit the admins to only see their sent issues. So it kind of kills 2 birds with 1 stone.
This may be a huge kludge, but it works. If the module maintainer has any suggestions or ways to make this more future proof or secure please advise away. I am all ears.
Here's the gist of what a did.
- Installed views as well as simplenews and simplnews statistics
- build a page view for Newsletter nodes, that are authored/owned by the currently logged in user.
My filters section looks like this:
Filters
User: Current Yes
Simplenews: Sent status = Sent
Node: Type = Newsletter issue
My fields section looks like this:
Fields
Node: Nid Nid
Node: Title Title
Taxonomy: All terms Newsletter
Node: Post date Post date
Simplenews: Sent status Sent
Node: Edit link Edit
(nid is hidden, when we output the view)
As much as I hate tables, I made the view style a table. I really want this system to have an easy upgrade path, so I stuck with the default garlin theme for now as well. This is a backend utility for me, doesn't have much curb appeal as they say I guess.
In the Theme section, under style output, create a views-view-table--NAME-OF-VIEW.tpl.php in the directory for the module, copy what it says the output should look like for that view template, and then rescan template files.
The code in that view for me looks like this:
Sorry for the long post, wish the code output had a scrolling div on drupal.org, but it doesn't. The code is basically stolen from the simplenews module. Rather than modify the module itself, I just built this view with a custom template.
Hopefully this helps out someone until simplenews and/or simplenews stats gets more granular control over access.
Now this doesn't have the same full featured data as stats, but for the most part I just want the admins to be able to see how many people are actually looking at the messages. I might build a custom php snippet, that gives them the ability to see who opened at the least. For right now, even the opens and clicks are more data than they are getting at the moment.
Comment #5
j0nathan commentedBecause I need to download the patch from a drush makefile and I don't want to use HEAD, here is the file from #1 with modifications from #2.
Comment #6
yrocq commentedThis patch is broken.
will make drupal call the function
However, the user_access function takes three arguments : the permission, an optional user account, and an optional reset flag. In this case, drupal will try to use 'view all newsletters statistics as an user object. This will generate a warning and the function will always return FALSE. It makes statistics page hidden for all users (user #1 included). I will work on a functional patch soon.
Comment #7
yrocq commentedHere is a new patch.
Comment #8
yrocq commentedComment #9
yrocq commentedComment #10
weseze commentedBumping this to 3.x. No features are being added to 2.x release anymore. Granular permissions are a great idea and I will be looking at this patch!
Comment #11
weseze commentedPermissions have been comitted. There are 2 permissions available: "View all newsletter statistics" and "View own newsletter statistics".
Comment #12
weseze commentedSorry, had to change this back to 1 permission. It was giving ma painfull headaches to get a secure Views integration...