Comment QA extends the default Drupal commenting system by adding questions and answers (Q&A) capabilities to the Drupal commenting system.
Drupal comments, by default, will produce a sequence (or thread) of comments entered by users. This works for most sites featuring blogs, forums, etc. But it is not enough for sites where users need to ask questions and get answers from other users or from the owner of the node; a situation very common on B2B sites and communities of practice.
With Comment QA the administrator can designate roles that can create questions and the roles that can create answers. This designation is done from the permissions page where all other Drupal permissions are managed.
This module adds also new check boxes to the comment section of the content type configuration form so that administrators can enable or disable the (Q&A) capabilities for specific content types.
Project page: http://drupal.org/sandbox/jcmartinez/1144278
Code repository: git.drupal.org:sandbox/jcmartinez/1144278.git
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | comment_qa.png | 57.76 KB | d2ev |
| #5 | comment-qa-pareview-result.txt | 9.9 KB | atul.bhosale |
Comments
Comment #1
hazaYour sandbox seems to be empty
Comment #2
tim.plunkettClosing, feel free to re-open if this was a mistake.
Comment #3
jcmartinezCode repository: git.drupal.org:sandbox/jcmartinez/1144278.git
Comment #4
jcmartinezNeeds review.
Comment #5
atul.bhosale commentedAutomated Review
http://ventral.org/pareview/httpgitdrupalorgsandboxjcmartinez1144278git
The automated review scripts are flagging you on quite a number of points. Please check the Drupal coding standards.
It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git
See attachment for more details
Comment #6
jcmartinezCreated 7.x-1.x branch on Git and shifted work from master to the 7.x-1.x branch.
Cleaned out master branch as recommended on http://drupal.org/node/1127732 step #5.
Made various edits to meet Drupal code standards.
Comment #7
pflame commentedThe module seems to be working fine. I could able to add question and answers as comments. But when I access admin/content/comment url there is a drupal_set_message with the comments array. It should be removed.
Comment #8
jcmartinezAll instances of drupal_set_message used for development have been removed from code. Thanks for the feedback.
Comment #9
seyv commentedFirst off: Looks nice !
When you don't set Q&A capabilities for a content type it returns a notice:
Use a isset($settings) to check if any settings are returned.
At the settings:
change to
Comment #10
itsekhmistro commentedHi,
the code looks good.
manually reviewed on fresh drupal installation:
1) When you don't set Q&A capabilities for a content type it returns a notice:
2) When you don't set Q&A capabilities for a content type it returns a notice and tries to add a comment to a node:
You get
and details:
Comment #11
jcmartinezCommitted changes to correct typo on settings page of the module (from Defaul to Default) and fixed a wrong condition that produced "Notice: Uninitialized string offset: 0 in comment_qa_form_alter()" when a user tried to create a new node of a content type that was not configured to use Q&A capabilities.
This addresses issues from comments #9 and #10. Thanks to SeyVaneerdewegh and itsekhmistro.
Comment #12
itsekhmistro commentedHi,
still can't "Add new comment" on an Article node on fresh Drupal installation - the `Comment QA` module was enabled - but I haven't appied any settings/configuration, just trying to add new comment produce an error:
Comment #13
jcmartinezI was able to reproduce issue from comment #12 and applied fixes. Noticed that same issue would apply not only to new comments but also to comments being edited. Also fixed.
Comment #14
itsekhmistro commentedReviewed manually, now works fine for me.
Comment #15
patrickd commentedYou should define() constants instead, that would really improve readability
variable_get('cqa_d...prefix all variables with the full module namevariable_del('comment_qa_' . $node_type);but there are more with cqa prefixcomment_qa_comment_viewif the hook does nothing, either remove it complete or comment it out completely, so it won't be implemented for nothing* @todo Please document this function.better a bad description than none, some todos will never happen ;)That's it for now :)
Comment #16
jcmartinezThe following are the steps taken to address some of the issues that were pointed out on comment #15 (every item below correspond to the item of the same number from comment #15):
Thanks to patrickd for the thorough review.
Comment #17
patrickd commentedThis code will never be invoked because the prefixing module name is not correct.
Also you don't have to make any documentation about parameters and returned variables of hooks if your using them the standart way (but okay if you like it that way).
By following this convention you can apply the following:
Current:
include_once DRUPAL_ROOT . '/' . $path . 'settings_comments.inc';Best practice:
module_load_include('inc', 'comment_qa', 'settings_comments');Best performance:
include_once dirname(__FILE__) . '/settings_comments.inc';variable_get('comment_qa_' . $type, '');There's always an array expected from this, you should set array() as default value (even when this never happens)and/or, use&&/||insteadusing menu_get_object() is probably a better solution here.
Also stuff like
makes your life complicated.
just using variables the common way would make it more simple I think..
generally you should not try to reinvent the configuration system ;-)
t(".... <em>@perm</em> ...", array('@perm' => 'administer comments')),If you want to keep the "administer comments" translatable you have to wrap it within t() separately. But I'm not sure whether inserting a hardcoded translatable string into a hardcoded translatable string makes sense (maybe you should just put them into one string). Anyway, you don't have to use em-tags here if you want to do it this way you can just use % instead of
@.array(0 => t("Comment"), 1 => t("Question"), 2 => t("Answer"))If you got the luck to have a list that is 1,2,3... you should make use of your luck and remove that numbers because php will count them this way automatically (and they look ugly and will make you more work if you got to change something later).That would at least make it a little more simple.
We do really need more hands in the application queue and highly recommend to get a review bonus so we can come back to your application sooner.
Comment #18
jcmartinezMade changes addressing issues that were pointed out on comment #17.
Comment #19
d2ev commentedi have install this module with core comment module. The question and answer commenting system is working fine but when you edit a question or answer comment and save it then it again appending a 'Q:' or 'A:' to comment subject. if want to make a existing comment to question or answer then this is not working.
i have attached a screen shot.
Comment #20
jcmartinezSolved issue pointed out by D2ev on comment #19.
Comment #21
frobIt passed PAReview, so that is good.
Manual Review:
I noticed that you are using get_t() in the install hook. In the install hook you should use st(). get_t() is for code that could be run durring install but doesn't have to be run at install time. Because this is the install hook and that will only run durring install time your should just use st().
In comment_qa_comment_load($comments) you are using case 1: case 2: etc. I would use defines to make the code a bit more readable. <- don't quote me on this, I am not sure of the recommended Drupal policy on defines.
Line 12 of the .module file has a @todo comment. You should resolve this @todo.
Comment #22
jcmartinezGood catch; it has been corrected. Thanks!
This was pointed out earlier on comment #15. These values are NOT constants therefore we are NOT using define() intentionally. I have rewritten the comment near these values in order to make the point more clear to future reviewers.
Even if the script could be rewritten to use define(); at the moment I don't have the time or the intention to make that change unless it is proven that the construction that is being used is against Drupal best practices, or affects the work of the module, or has a negative effect on performance, or that it would compromise security.
This @todo comment was a reminder to myself about adding more information to the existing paragraph that I had provided on the hook_help. More information has been added to the paragraph and the @todo comment has been deleted.
Comment #23
patrickd commentedYour doing that wrong - now install actually breaks ;-)
Replace this with
$t = get_t();Don't forget to test your module after you applied changes
After all I don't see major issues with this module, therefore (after one year) let's push this forward
Comment #24
patrickd commented(no further feedback for a week, I think I was nitpicking enough here)
Thanks for your contribution and welcome to the community of project contributors on drupal.org!
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
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.
As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.
Thanks to the dedicated reviewer(s) as well.
Comment #25.0
(not verified) commentedAdding repository address to description.
Comment #26
avpadernoComment #27
avpaderno