The first module I would like to share is called webform_userpoints. It integrate the userpoints system with the webform module and allows individual webform submissions to award points to the submitter. With the upgrade of Webform to v3, the ability to include PHP code within the form submit process was removed and placed into a seperate module (webform_php). Whilst the functionality of the module I have created can be replicated using webform_php, it is not recommended to use this method as it opens up security issues - such as allowing php code to be run from a textfield - something the author is strongly against.
The webform_userpoints module simply adds an admin item to the webform config page allowing the webmaster to manage userpoint allocations without the need to include php code or install modules that may increase the security risk.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | webform_userpoints.zip | 8.25 KB | barrya |
| #7 | webform_userpoints.zip | 2.85 KB | barrya |
| #3 | webform_userpoints.zip | 9.67 KB | barrya |
| #1 | webform_userpoints.zip | 9.68 KB | barrya |
Comments
Comment #1
barrya commentedInitial build of the module webform_userpoints
Comment #2
avpadernoHello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review the code, pointing out what it needs to be changed.
Comment #3
barrya commentedIgnore the previous upload, I misnamed some of the function names in the .install file. Serves me right for using webform_php as my reference.
Comment #4
pcambraHi barrya!
Thanks for submitting the module, I think it could be very useful, here is what I found reviewing the code:
Comment #5
pcambraComment #6
pcambraComment #7
barrya commentedUpdated the module.
Cleaned the code as requested, added cvs headers, removed license.txt.
I have left the .install file adding fields rather than creating a new table for the moment. This is mainly due to another webform module I spotted that did this and I wanted to maintain consistency. My usual thought would be to seperate this into a seperate table - so this isn't a problem.
As for a universal webform settings page, what do you have in mind for this? Would this allow default settings that would prepopulate new webforms?
Comment #8
Scyther commentedYou should have a seperate DB table for your module and have a "connection" between your table and the 'webform' table.
And then clean up the webform_userpoints_configure_form_submit() and use drupal_write_record instead.
Comment #9
pcambraI don't think that those two issues are compulsory for getting the module commited, only a "nice to have", maybe opened as issues when the project is created
Comment #11
svendecabooterThere is still a normal warning and a few minor ones when running the module through coder.module, and the schema_alter could indeed be avoided, but apart from that this looks ready to go
Comment #12
pcambraWhat do you say barrya? do you think that using a sepparate table for the module data could be done prior to commiting the version to CVS?
Comment #13
avpadernohttp://drupal.org/node/539608 reports what is considered an application blocker.
Having a separate database table is not one of them, but the module should implement
hook_schema_alter().Comment #14
barrya commented@svendecabooter - Which lines are still reporting an error. i still see an error on line 88, but i've ignored that for what I hope are obvious reasons. Other than this I am not seeing any errors with the latest coder beta.
Comment #15
barrya commented@pcambra
as @kiamlaluno states, amending an existing table is acceptable as long as hook_schema_alter() is implemented. As it is I am going to leave this as it stands for the moment. It should not stop the module from being released in its current form. Thinking about it, having this information in a seperate table may cause more problems than it is worth as there will be additional overhead from the additional join that would be needed by this module.
I'm still open to discuss the merits for moving this to a seperate table, as I said this was going to be my original route, but should be raised as in issue once the module is published.
Comment #16
pcambrabarrya, ok then I think hook_schema_alter belongs to module file and not to install one? https://drupal.org/node/51220, note that you have documented it as hook_schema and not hook_schema_alter.
Comment #17
juankvillegas commentedI guess that if the schema modification is done just one time, like in this case, it must be in example.install
But if you modify database tables dinamically, like CCK, it would be in example.module
Comment #18
pcambraThanks juankvillegas, do you know if this is documented somewhere?
In that case, hook_schema_alter should be documented properly and we'll ready to go :)
Comment #19
avpadernodrupal_alter('schema', $schema)is normally called insidedrupal_get_schema(), aftermodule_load_all_includes('install').The hooks that should go in the installation file are
hook_enable(),hook_disable(),hook_install(),hook_schema(),hook_uninstall(), andhook_requirements(); other hooks should go in the module file.Comment #20
barrya commentedAccording to Pro Druapl Development By John K. VanDyk
the .install file should include hook_schema_alter(). Page 105-106.
I have also seen it used this way elsewhere. It makes more logical sense for it to be here than anywhere else.
I have attached a new version of the module with the function documented correctly.
Comment #21
barrya commentedComment #22
pcambraThis is very curious, but I can't find any docs that refer on where to call the hook_schema_alter function, it would make sense to call it in the install file, but is not included in the "usual install file functions set", also would be the only alter function called in this file, bear in mind that alter functions are invoked by drupal_alter function.
It would be great to clarify and document this for the future
Comment #23
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, 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.
I thank all the dedicated reviewers as well.
Comment #24
avpadernoComment #27
avpaderno