This module is developed to track the share statistics of social media clicks. So when a registered drupal user shares any content to social media, this module saves the uid, nid and the share count for FB/twitter in the database for the record.
There is a 'Shares' tab on the user profile page where the user can get the list of content shared on different social networks (facebook, twitter).
This module only tracks the shares that are made using the share buttons that the module provides. If you share the nodes with some other mechanism (say directly copy paste the link to Facebook, Twitter, etc.), those actions / shares are not being counted.
Please read the readme.txt file for detailed instructions on configuration steps.
The reason why this module is different from the rest of the modules available on d.org is it tracks which user shared which node. This we didn't find in any other module. For example - https://www.drupal.org/project/social_stats just shows number of shares per node but which registered user shared which node is not available with social_stats module and even the way the count is fetched is different in both the modules.
Project Page
https://www.drupal.org/sandbox/rinashah/2229633
GIT
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/rinashah/2229633.git social_share_statistics
cd social_share_statisticsPareview :
http://pareview.sh/pareview/httpgitdrupalorgsandboxrinashah2229633git-7x-1x
Demo url
http://demo.acelincreations.in/node/1
Demo user/pass
demo / GZx/suyuy4p'?1w
Reviews of other projects
1. https://www.drupal.org/node/2397045#comment-9459443
2. https://www.drupal.org/node/1874650#comment-9453579
3. https://www.drupal.org/node/2294899#comment-9467209
4. https://www.drupal.org/node/2383707#comment-9477035
5. https://www.drupal.org/node/2370973#comment-9499653
6. https://www.drupal.org/node/2404637#comment-9504897
| Comment | File | Size | Author |
|---|---|---|---|
| #49 | coder-results.txt | 2.87 KB | klausi |
| #19 | Screen Shot 2014-12-18 at 9.53.18 pm.png | 294.61 KB | naveenvalecha |
| #19 | sss_config_formXSS.png | 43.34 KB | naveenvalecha |
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxrinashah2229633git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
rinashah commentedComment #3
rinashah commentedComment #4
naveenvalechaThanks for your contributions!
Automated Review
Lots of issues identified by the pareview.sh.Need to fix all of them. If you want to configure your sublimetext editor with drupal coding standards then read this blog post to fix this. http://www.qed42.com/blog/sublime-awesome-sauce-drupal
Manual Review
The permissions are very lossely coupled.
This will leads to dos attack becuase the operation is too healthy at this callback.you should add the permissions with this callback.We should add some sort of permission with this callback.Initialze all these variables in single line.
Use l tag instead.
$show_shares = array(0 => t('No'), 1 => t('Yes'));Use drupal_map_assoc.Its good to use it.I have not seen the usage of this function. If it is using somewhere then specify.
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
Please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
As I am not a git administrator, so I would recommend you, please help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)
Comment #5
naveenvalechaUpdated title.
Comment #6
Swarnendu-Dutta commentedHi Naveen,
Many thanks for the review.
We have fixed all the issues mentioned in the manual review except point 1.
For now, we have kept the url accessible for annonymous user as well so that
1) others can test the code without login,
2) the code works even if someone forgets to configure role in block config.
We could create an admin config setting for this to do it via backend as well.
Please suggest.
Comment #7
rinashah commentedWe will now try and fix issues listed in automated review. In the mean time, we would really appreciate if some one can review the changes done and suggest.
Comment #8
rinashah commentedComment #9
clintu commentedThanks for your contribution.
I have downloaded the module from the given GIT path. In the .info file the below description is present.
stylesheets[all][] = style.css
When gone through the folders and files, looks, 'style.css' doesn't exist in the given version.
Comment #10
Swarnendu-Dutta commentedHi Clintu,
Thanks for your review.
We have fixed this. 'style.css' doesn't exist in the module.
Comment #11
klausiI don't know what git branch should be reviewed, there is "master" and "dev"? Please create a 7.x-1.x main branch and delete the others to avoid confusion, see also http://pareview.sh/pareview/httpgitdrupalorgsandboxrinashah2229633git
Comment #12
Swarnendu-Dutta commentedComment #13
Swarnendu-Dutta commentedComment #14
Swarnendu-Dutta commentedHi klausi,
Thanks a lot for the review.
We have updated the git branch as well the automated review link.
We are working on the issues listed on the automated review.
Comment #15
naveenvalechaAs discussed with @ mpdoandio Removing the security tag and updated the comment as well. We should add some sort of permission with this callback.
Comment #16
rinashah commentedSo then is it a good idea to use user_access and assign permissions via role permissions? That would give flexibility to site administrator whether he wants anonymous access or no.
Comment #17
Swarnendu-Dutta commentedComment #18
Swarnendu-Dutta commentedWe have fixed all the issues found in pareview and also fixed the access permission mentioned by naveenvalecha. Please review.
Comment #19
naveenvalechaAwesome!
Please address #11 addressed by klausi
There is still a master branch, make sure to set the correct default branch: https://www.drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in https://www.drupal.org/node/1127732
Review of the 7.x-1.x branch (commit 031c6fa):
./README.txt: the byte order mark at the beginning of UTF-8 files is discouraged, you should remove it.
No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.
Security issue
There is the Cross site scripting XSS issue.See how to write secure code, list security issues identified.Screenshot attached to reproduce the issue.
Address aboves that stops me to set this application to RTBC.
These are minor nutipicks :
Use this one instead
Similarly wrong doc comment in social_share_statistics-custom-block.tpl.php
'access callback' => TRUE,in these menu items :node/%/twitter/success , node/%/fb/success, node/%/gplus/successbecause we already have the access arguements.Comment #20
Swarnendu-Dutta commentedHi Naveen,
Thanks a lot for the review.
We have fixed the security issue as well as nutipicks.
Also we have sorted the branch issue addressed by Klausi.
Please review.
Comment #21
naveenvalechaNo more critical.Setting this to RTBC.
Some minors :
$items['fb_share'] = '<img style="cursor:pointer;" alt="share this page" src="' . $base_url . '/' . drupal_get_path('module', 'social_share_statistics') . '/facebook-icon.png" onclick="fb_callout();">';As I am not a git administrator, so I would recommend you, please help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)
Comment #22
Swarnendu-Dutta commentedHi Naveen,
Thanks a lot for your review.
We will work on these minors now.
Comment #23
ajitsAssigning to myself for the review now, since it is similar to the module I maintain Social Stats.
Comment #24
ajitsGreat work on the module! Some issues that needs to be addressed before getting this through.
Manual review
I tried to cancel the plusone on the node thrice to make sure.
social_share_statistics_buttons_content(), it is never recommended to useSELECT * FROM ...in a db_query. Only select data which you need. This will be helpful when the module is used on a site with large number of nodes.Same with the variable
$items['g_share'].rather than what you follow in your module:
For details please see any template from the core.
hook_node_delete()to remove them.The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
Once the issues mentioned are fixed, the application is ready to be RTBC'ed again. I would also recommend you to review other projects and get a Review bonus so that the GIT admins review your work right away. Good luck!
Note: I'm not using the Project Application Review Template since it was used before to cover other areas. I have however verified them.
Comment #25
Swarnendu-Dutta commentedComment #26
rinashah commentedHi Ajit,
Thanks a ton for the detailed review. We really appreciate it. We will get back with the fixes asap.
Cheers,
Rina
Comment #27
Swarnendu-Dutta commentedComment #28
Swarnendu-Dutta commentedHi Ajit,
Thanks a lot for the review.
1. We have removed gplus shares count functionality for now as google prohibits any methods to recognize users' clicks on a Google+ button, the data of which is then disclosed, sold, or otherwise shared with other parties.
google + button policy
8. We will start working with the views very soon.
Rest we have fixed all other issues that you addressed.
Please review.
Comment #29
Swarnendu-Dutta commentedComment #30
Swarnendu-Dutta commentedComment #31
ajitsThanks! No issues blocking as of now. Few issues that you should consider resolving before creating a new release.
social_share_statistics_buttons_content(), you still use the codeThe markup is not required to be passed in the variable. It could be directly printed in the template.
social-share-statistics-block.Marking as RTBC. Please participate in the review bonus program, so that you get a review from GIT administrator.
Thank you for the contribution!
Comment #32
Swarnendu-Dutta commentedThanks Ajit for the suggestions.. Really appreciate it.. :)
We will be integrating the module with views very soon and will start working on adding more social networks.
3.
<div id="fb-root"></div>is necessary and so we are not printing it directly in the template.We will be fixing the rest of the issues..
Comment #33
ajitsPlease help me understand what do you mean by this? If the div is necessary always, why not directly have it in template? All you have to do is replace
with
in the template.
Comment #34
Swarnendu-Dutta commentedSuppose the user customizes the template file to his needs and ends up removing the div.
In that case, i guess it would be safer to keep that in the module file. Pls suggest.
Comment #35
Swarnendu-Dutta commentedComment #36
ajitsA user could also remove the variable from the template, no?
You should add the div to the template directly, and add a comment above it to mention that it should not be deleted.
P.S - Good job on getting the review bonus.
Comment #37
Swarnendu-Dutta commentedHi Ajit,
Thanks :)
Yes that can also be the case..Will fix these minors asap.
Comment #38
Swarnendu-Dutta commentedComment #39
Swarnendu-Dutta commentedComment #40
klausimanual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #41
Swarnendu-Dutta commentedThanks Klausi for the review.
3. Used foreach() loop as we are adding up the values of the share counts on fb,twitter for the respective nodes.
6. The administrator can configure securing the block to show the share buttons to only authenticated users.
We are setting up the url in js files here. Pls suggest.
We have tried to fix the rest of the issues mentioned.
Comment #42
nileshlohar commentedFor 3)
Use something like
SELECT count(fb),count(twitter) FROM {social_share_statistics} WHERE nid = $nid GROUP BY nid;
so you don't need to use foreach.
for 6)
Any user can hit
http://example.com/node/3/twitter/success
OR
http://example.com/node/3/fb/success
else use CSRF to raise share statistics for node id 3
So use security token or something else to avoid this.
Comment #43
rinashah commentedI agree with nileshlohar on point 6. We should use security token to avoid this as a confirmation form will be an extra step for the user and that's not required in this case.
Comment #44
Swarnendu-Dutta commentedComment #45
Swarnendu-Dutta commentedFixed CSRF issue and changed the query.
Please Review.
Comment #46
Swarnendu-Dutta commentedComment #47
Swarnendu-Dutta commentedComment #48
Swarnendu-Dutta commentedComment #49
klausiReview of the 7.x-1.x branch (commit b72db44):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
But that are not critical application blockers, otherwise looks RTBC to me.
Assigning to er.pushpinderrana as he might have time to take a final look at this.
Comment #50
pushpinderchauhan commentedAutomated Review
Best practice issues identified by pareview.sh / drupalcs / coder. None
Review of the 7.x-1.x branch (commit b72db44):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Manual Review
global $base_urlbut $base_url is not in use. remove it if not required.drupal_set_message(t('success share'));Not a user friendly message.The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
Looking at the git history at https://www.drupal.org/node/2229633/commits it looks like all of the recent commits are from Swarnendu-Dutta, which is a different user account? but it is hard to tell what that equates to in volume of code, only one can user can get the git vetted access, so please tell me who should get it.
Comment #51
Swarnendu-Dutta commentedThanks a lot for your review.
We have fixed most of the issues addressed by klausi and pushpinder.
We are working on the rest.
The token has been previously initialized in twitter.js file so it dsnt require re-initialzing in fb.js. fb share count works along with tracking of the user who shared.
Please give the git vetted access to the project sandbox account.
Comment #52
Swarnendu-Dutta commentedComment #53
rinashah commentedHi Pushpinder,
Me and swarnendu both are the authors of this module. How does it work in case of multiple authors?
Comment #54
pushpinderchauhan commentedRepeating the git commit message "Code Review" many times does not really help your git history. See https://www.drupal.org/node/52287 on how to write meaningful messages.
In this case, you can just add him as maintainer. See https://www.drupal.org/node/1011698 for more detail.
so...
Thanks for your contribution, rinashah!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #55
rinashah commentedThanks a ton to all of you to have spent time reviewing this module :)