The Newsletter Prompt module provides a simple but yet comprehensive solution for managing a popup that collects email addresses, to be used for online marketing.
The data collected can be (optionally) stored in an internal table or made available to external modules that implement hook_newsletter_prompt_store_alter.
Drupal core version: 7.x
Sandbox link:
http://cgit.drupalcode.org/sandbox-PaoloN-2596687/
To clone:
git clone --branch 7.x-1.x https://git.drupal.org/sandbox/PaoloN/2596687.git newsletter_prompt
Other modules manually reviewed:
https://www.drupal.org/node/2765941#comment-11414723
https://www.drupal.org/node/2758289#comment-11417281
https://www.drupal.org/node/2767837#comment-11417565
Comments
Comment #2
PaoloN commentedComment #3
yogeshmpawarHi PaoloN,
Automatic Review -
http://pareview.sh/pareview/httpsgitdrupalorgsandboxpaolon2596687git
Please fix these errors, will do a manual review in some time.
Comment #4
3ssom commentedI wasn't able to enable your module .. I got this error:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'sid': CREATE TABLE {newsletter_prompt} ( `sid` INT unsigned NOT NULL auto_increment DEFAULT 0 COMMENT 'Primary Key: Unique NewsLetter subscriber ID.', `email` VARCHAR(254) NOT NULL DEFAULT '' COMMENT 'The email address collected.', `submitted` INT NOT NULL DEFAULT 0 COMMENT 'Timestamp for when the email was submitted.', `updated` INT NOT NULL DEFAULT 0 COMMENT 'Timestamp for last time the email has been updated.', `locale` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'The locale where the email has been captured.', `status` TINYINT NOT NULL DEFAULT 0 COMMENT 'Whether the email address is still valid or needs to be removed.', `propagated` TINYINT NOT NULL DEFAULT 0 COMMENT 'Whether the email address has been sent to external providers.', PRIMARY KEY (`sid`), UNIQUE KEY `email` (`email`), INDEX `submitted` (`submitted`), INDEX `updated` (`updated`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Table for Newsletter Prompt.'; Array ( ) in db_create_table() (line 2720 of ..so I couldn't complete the review !!
Comment #5
3ssom commentedanyway I did review:
please add you sandbox link to the original post
Automated Review
PASS Automated Review.
Manual Review
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.
If added, 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.
Comment #6
PaoloN commentedThanks 3ssom and Yogesh.
I've fixed the issue with the schema, added the hook_help and the toc to the readme.
I've also tidied up a bit some JS and CSS, plus fixed the test that wasn't working well before.
Comment #7
PA robot commentedWe 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 #8
PaoloN commentedComment #9
PaoloN commentedComment #10
3ssom commentedHello PaoloN :)
I was able this time to enable your module ,, which allowed me to redo the review ..
but here are some notes I found:
Thank you ..
Comment #11
3ssom commentedComment #12
PaoloN commentedHey 3ssom! :)
Thanks for taking the time to review, I know the queue is quite long.
As per your points:
1- You should not pass the title and description in menu hooks through t() : https://www.drupal.org/node/323101
2- I had that issue before, due to a mistake when committing (updated code was on another machine), but I've fixed it a couple of days ago, before I fixed the issue with the schema (same problem, code wasn't the right one)... I've re-installed everything from absolute scratch and it shows up correctly. It's also returning a pass in the automated test, which checks for an hidden class. Not sure if it's maybe some sort of caching from the previous test you did? I will try to reproduce it, but can you please try with clean cache tables?
3- The data won't be saved in the table, unless you specifically turn that option on, for privacy reasons (in the README.txt, under the Configuration section)
Comment #13
PaoloN commentedComment #14
PaoloN commentedComment #15
PaoloN commentedComment #16
PaoloN commentedComment #17
PaoloN commentedAdding the Review Bonus (see description with my 3 reviews)
Comment #18
3ssom commentedHello PaoloN :)
sorry for this late feedback :(
I installed a fresh Drupal installation .. enabled your module ,, default theme ,, no modules ,, tried to show the block but that didn't work either sorry my friend :( .. I reviewed everything else and everything looks good .. selected to store the email in DB and it did ..
can anyone else try the block thing ! .. it might be from my end .. so I won't change the status of the issue because it needs a second opinion as a review ..
Thank you
Comment #19
smfsh commentedAutomated Review
Automatic Review on paraview.sh and locally via Coder passed
Manual Review
This review uses the Project Application Review Template.
Your code looks fantastic. It's very easy to read and you've taken a really simple approach to this sign-up functionality. It was relatively trivial to figure out how your module works just by reading through the code. I was surprised not to find any duplicates for this functionality but glad this one is in the pipeline.
If possible, I'd add your sandbox project link into this ticket as well so that it's easier to review what you've got there for your project documentation so we don't have to dig it out of the README.
As a last note, I also had issues displaying the block. Enabling it doesn't appear to do anything but didn't have a chance to really debug what was going on.
Comment #20
afinnarn commentedHey PaoloN,
A few suggestions...
You can use more of the form API to setup the email signup form. For instance, the placeholder you added in JS can be done with
$form['some_element']['#attributes']['placeholder'] = t('Placeholder text');There is also an "#element_validate" key you could use but I don't think that would save in lines of code or function reuse. I didn't know about a lot of this functionality until I read the From API page closely.
On your JS functions, I typically see them wrapped in a "Drupal.behaviors.functionName" rather than just ran outside of a function.
For the hook you provide, it was hard for me to know what it was or how to use it, but it seems to work fine. Typically, you'll want to put an example hook in newsletter_prompt.api.php with explanation in the docblock of what it does.
For the propagated and status fields in the newsletter_prompt table, I don't see how those values are ever changed. So, I see no point to having them unless you can change them somehow.
The CSS on the top view popup could use some work. I only tried bottom right and top, but the bottom right looked better. When displayed on top the close button wasn't even visible to me on Chrome.
Finally, I would think people might just want a time delay to show the popup as well as having the scroll option. I personally would just use the time delay as some pages would be hard to scroll or the user might not want the below-the-fold-content...also you might want to validate the pixels from top to only include positive values.
These are all suggestions and I see no major flaws, so I'll mark this RTBC.
Comment #21
afinnarn commentedComment #22
avpadernoI will update 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!
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.
Thanks go the dedicated reviewer(s) as well.
Comment #23
PaoloN commentedThanks a lot to you all!
@afinnarn , yes, some functionalities are more for a future scope, but I agree, should be a bit better documented. As per the Behaviors, I left it out on purpose, since don't want it to be triggered at any DOM change. I could have wrapped into a .once(), but didn't see the need for that. Anyway, it's a valid suggestion and will look at improving it.
Thanks!
Comment #24
3ssom commentedCongratulations my friend:)