This module provides a way to add basic subscriptions functionality to Advanced Forums. It is a very lightweight alternative to installing the 4 modules: Subscriptions, Subscriptions Mail, Subscriptions UI and Taxonomy Subscriptions; if all you want is subscriptions for Forums.
It provides functions to subscribe to:
- All forums (global subscription, on the Forums page)
- Individual Forums (on the Forums page, not on the Topics page where the Subscriptions module puts it)
- Individual Topics (on the Forum Topics page)
Emails are sent to each user who is subscribed at the appropriate level when
- a new Forum is added
- a new Forum topic is added
- a new Forum topic comment is added
An additional tab is provided on the Forum tab menu to view your own subscriptions and optionally remove any subscriptions.
Answers to the usual questions:
Q: Why not contribute this code to Advanced Forum?
A: Advanced Forum 7.x-2.0 has reached RC state so feature set is locked. The maintainer will deal with major/critical bugs only.
Q: Can't this already be achieved with existing modules?
A: Yes and no. If you only want subscriptions for Forums then you must install the Subscriptions modules (with their relatively heavy payload) and disable all of its functionality for all content other than Forum content.
Also, the subscriptions module does not provide a link on the Forums page to subscribe to Forums, you need to go to a Topic within that Forum first.
And also, the subscriptions module does not provide functionality to subscribe to All Forums, ie. it does not have global subscription capabilities.
Project page: http://drupal.org/sandbox/Bagz/1465984
Git repository: git clone --branch 7.x-1.x Bagz@git.drupal.org:sandbox/Bagz/1465984.git
Comments
Comment #1
adammaloneThere are a few things that can be done to improve this module after passing it through pareview.
Your results from running through it are here: http://ventral.org/pareview/httpgitdrupalorgsandboxbagz1465984git
The most striking things are to get rid of LICENSE.txt and to move from the master branch in git.
Almost all of the errors appear to be CSS colour errors. Whereby you've used capital letters but drupal coding standards require lower case.
eg:
223 | ERROR | CSS colours must be defined in lowercase; expected #3c78a7 but | | found #3C78A7Another error that can be easily resolved seems to be that you have extra lines at the end of your modules. Just remove all blank lines from the end of files and it will fulfill requirements!
Comment #1.0
Bagz commentedchanged git instruction due to new branch 7.x-1.x-dev
Comment #2
Bagz commentedHave fixed all of the issues identified by pareview, except for two false positives where two long query statements are incorrectly identified as array declarations.
Comment #3
michelleDoes this actually require Advanced Forum? Since AF builds on core forum and subscriptions are fairly low level, removing AF as a requirement would open this up to use by anyone using core forum.
I haven't actually looked at the code; no time now. I like the idea, though, and I think it's good to have it as a separate module.
Comment #4
Bagz commentedInteresting question Michelle, but no it basically extends much of the Advanced Forum functionality (it adds to the AF templates) and uses some of the AF functions. I never considered anyone would use core Forum rather than AF :-)
I will have a look at core forum and see what I would need to do to make this work for that as well.
Comment #5
michelleAh, I see. Yeah, some do use just core forum but that's usually people who want to keep things very simple, anyway.
I'll be keeping an eye on this to see if it could work with Artesian as well.
Comment #6
targoo commentedHi
I like your code and think it is well written. I have done a first manual review of it :
1) advanced_forum_basic_subscriptions.install
/**
51 * Implements hook_uninstall().
52 */
53 function advanced_forum_basic_subscriptions_uninstall() {
54 }
Remove the function if empty
2) advanced_forum_basic_subscriptions.module
182 drupal_set_title($title);
drupal_set_title($node->title); // XSS vulnerability
drupal_set_title(check_plain($node->title)); // Correct
3) advanced_forum_basic_subscriptions.module
288 $message = "A new comment, $comment->subject, has been added to topic $node->title.";
You don't use this variable so you can remove it.
4) advanced_forum_basic_subscriptions.module
In advanced_forum_basic_subscriptions_subscribe and advanced_forum_basic_subscriptions_unsubscribe
you don't really check the input (arg(2)...).
5) advanced_forum_basic_subscriptions.module
490 $subscription = array();
Do you need it ?
FILE: .../pareview_temp/test_candidate/advanced_forum_basic_subscriptions.module
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
265 | ERROR | If the line declaring an array spans longer than 80 characters,
| | each element should be broken into its own line
301 | ERROR | If the line declaring an array spans longer than 80 characters,
| | each element should be broken into its own line
--------------------------------------------------------------------------------
Comment #7
Bagz commentedThanks for the feedback, always good to have someone else review code to find loose ends.
Have addressed all of the issues you raised:
1 -> function removed
2 -> fixed (this code was copied verbatim from the advanced forum module, so perhaps the XSS vulnerability exists in that module as well?)
3 -> variable removed
4 -> both functions now validate arguments
5 -> statement removed
pareview -> code now 100% clean
Comment #8
michelleWhere? I've grepped the source of AF for both
drupal_set_titleand$node->titleand don't see it.Comment #9
Bagz commented\includes\core-overrides.inc, line 65
Comment #10
michelleTerm title and node title are very different. I suppose if you let random users add forums, this could be an issue (though I didn't check if it is sanitized elsewhere so it may be moot). But node titles of forum topics are normally entered by (potentially) untrusted users so that is a much more serious issue.
Comment #11
Bagz commentedItem 2 is not correct. It makes forum titles like "John's Forum" display as "
John's Forum".This is a common issue that happens with using check_plain twice, and after investigating this further I found it happens because the drupal_set_title function already does a check_plain itself.
I have reverted that line of code back to how it was.
Comment #12
prashantgoel commentedplease visit http://ventral.org/pareview/httpgitdrupalorgsandboxbagz1465984git for the list of errors being generated.
Comment #13
patrickd commenteddon't block in-depht reviews because of these minor issues
Comment #14
Bagz commentedThank you prashantgoel for the feedback. However, it is a bit over the top to refer to this as "errors". They are not errors, they are just trivial semantic non-conformances to standards (however important they are) that do not impact on the functionality of this module whatsoever.
I have modified all of the non-conformances that PAReview identified.
Comment #15
Bagz commentedThank you patrickd for injecting a bit of sanity back into the "review" process.
Comment #16
SebCorbin commentedI see no security issues here, but some variables are loaded but not used and could be affecting performance a bit.
You can see these by configuring your IDE code inspections.
I've installed the module and it gives me errors in advanced_forum_basic_subscriptions_preprocess_advanced_forum_topic_list_view() because my path are aliased by pathauto, the hack should be earlier, not in preprocess.
But I'm not sure if this count in project application review...
Comment #17
Bagz commentedUnused variables have been removed.
No information has been provided on the errors which means I have nothing to go on. Will need more detailed information as to where any errors occur and in what scenario.
Comment #18
SebCorbin commentedScenario:
Comment #19
Bagz commentedThanks for the pointers. The function has been modified so that it now works for both unaliased and aliased nodes.
Comment #20
shawn_smiley commentedA couple minor issues.
In particular, the following functions should have their parameter/return values documented:
Comment #21
Bagz commentedThanks Shawn.
I have addressed all of the issues you identified and updated the repository.
Comment #22
shawn_smiley commentedMake sure you specify the default branch on your project page and remove the master branch from your git repo. See http://drupal.org/node/1659588.
I'd like to see your callbacks to subscribe/unsubscribe be separate from the rendering of the page. As it's currently implemented you leave open the possibility of a user bookmarking a subscribe/unsubscribe operation. So I would recommend making the following changes related to this:
Other than that, I think this is getting close to a release. Thanks for your contributions.
Comment #23
Bagz commentedExcellent suggestion regarding the menu callbacks. I have improved the code to do exactly as you suggest.
The good thing is that it also allowed me to streamline things a bit and cut out the function advanced_forum_basic_subscriptions_page as well as the the hook_menu_alter function as they were no longer required.
Comment #24
vensiresI manually checked the code and couldn't find any particular errors. You seem to know how to properly use the db_query() function with the improvements found in the Drupal 7 version and that's really good. Knowing the tools you have in your possession and how to use them, makes you a better programmer by its own.
But make sure you clear the errors listed in http://ventral.org/pareview/httpgitdrupalorgsandboxbagz1465984git-7x-1x before settings this to "needs review". They are many and maybe boring at the beginning, but fixing these errors in my own project was more and more fun until the whole list cleared. I hope your list will also be empty as soon as possible and you will also have fun!
Comment #25
klausiClosing due to lack of activity. Feel free to reopen if you are still working on this application.
Comment #25.0
klausifixed git branch