The module allows to display popup after a certain delay after a page load. This fills a gap in popup modules family (Popups, Popup), which are designed to show popups only after click on an HTML element, or to implement a complex behavior like modal dialog forms.

If you want to just display a popup after a page load, the Popup Advertisements module possibly fits your needs. It does some very simple things:

  1. Creates PopupAd entity type, so that popup advertisements are separated from another content in database and administrative interface.
  2. Provides some basic configuration options, which can be extended by other modules via hooks and standard Drupal form alter functions.
  3. Provides an action for popup ad displaying. The action can be used as a result of rule evaluation.

The module depends on following modules:

...and uses Colorbox library.

Drupal version: 7.x
Sandbox URL: http://drupal.org/sandbox/d.novikov/1940872
Git link: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/d.novikov/1940872.git popupad

Comments

Seppe Magiels’s picture

Status: Active » Needs work

Automated review

The automated review revealed several issues, please fix these issues.

Manual review

I took a glance at the code and noticed two things:

1) The hook below isn't defined anyware. And preferably these definitions should be placed in an .api.php file.

/**
 * Implements hook_popupad_check_display_conditions().
 */
function popupad_popupad_check_display_conditions($popupad) {
  return !popupad_check_time_cookie();
}

2) The classes in the .module file should be placed in seperate files. (http://drupal.org/node/608152)

Use an .inc file and use files[] in the .info file to extend a class or implement an interface.

That's all for now, once the errors indicated by the automated review are resolved I will check the code more deeply.

Greetings!

d.novikov’s picture

Status: Needs work » Needs review

Thank you very much, Seppe.

I fixed automated review errors except of some "Line exceeds 80 characters" warnings, and added popupad.api.php file with hooks description.

Also I removed the master branch.

PA robot’s picture

We are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and put yourself on the PAReview: review bonus high priority list. Then I'll take a look at your project right away :-)

I'm a robot and this is an automated message from Project Applications Scraper.

tinker’s picture

Status: Needs review » Needs work

@d.novikov, Tried the module but it did not do anything.

- Downloaded module from git
- Enabled module
- Had Libraries 2.x + already
- Downloaded ColorBox using 'drush colorbox-plugin' which installed 'colorbox' folder into sites/all/libraries
- Configure PopupAd module to Random, delay 1000ms, cookie lifetime 7, rest default
- Created 2 popup entities.
Browsed various non-admin pages and nothing happened. Logged out and tried again.
Do not see popupad.js in source code

Looked at the code format and everything looks good. Good structure, hooks. doc tags.
As reported previously you should truncate the 80 char + lines in the README.txt. I think the CamelCase class names are OK since EntityAPI uses them.

BTW using
Drupal 7.21
Libraries 7.x-2.1
Tried latest Colorbox and 1.x version https://github.com/jackmoore/colorbox/archive/1.x.zip

d.novikov’s picture

@tinker,

Have you tried to check for the "popupad_time" cookie in the browser? It could be set earlier for some reasons, before you installed colorbox library or something. This cookie stops popup from displaying to the same user multiple times. After cookie expiration period a popup will be displayed once again, but you can manually remove the cookie and see what happens.

d.novikov’s picture

Status: Needs work » Needs review
tinker’s picture

Status: Needs review » Needs work

@d.novikov, Yep that was it. Cookie had been set before Colorbox was installed. I think that identifies an issue.

  1. Perhaps you should used $colorbox = libraries_detect('colorbox') then check $colorbox['installed'] to make sure the library exists in popupad_init() and only continue if it does. This could also trigger a warning message on the admin form with directions on how to install colorbox library.
  2. There is no validation of user inputs on popupad_admin_settings_form(). User can enter non numeric values for lifetime and delay.
  3. Specifying 0 for popup width can create a popup that goes off screen if long sentences are used. If popup is fixed position then user cannot scroll to see the offscreen content. Perhaps a check for max width? This field does not state that its limited to integer which will be used as pixel width. Some people may try to enter widths as percentages.
  4. Using entities seems counterintuitive for the user. I would assume the popupad to be a content item so you can add new content item. Having it in 'structures' makes it confusing. Is there a reason you chose entity?
d.novikov’s picture

Status: Needs work » Needs review

@tinker, I finally found time to add fixes according to your comments.

  1. Added colorbox library detection and warning message in the popupad admin area.
  2. Added validation for numeric values to the popupad admin settings form.
  3. Altered description for popup form fields to say that width and height are specified in pixels. However, I don't see a need to filter out those displays, where a popup doesn't fit. Site's owner intention can be to create large popups. Also he can use colorbox "overlayClose" and "escKey" properties to allow users close popup in any conditions.
  4. The reason why I chose entities was that nodes have too much unnecessary functionality for popups (revisions, created/updated date and so on). But you're right, I moved Popup Ad menu item to the admin/content submenu, as it is more intuitive.

Thank you for all your help. All recent changes are pushed to the repo.

tinker’s picture

@d.novikov I will be busy for the next 5 days so will not be able to review until end of next week. Good going on the changes and I look forward to testing them out.

pagolo’s picture

I apologize, but if I try to clone your module, I'm asked for a password...

$> git clone --branch 7.x-1.x d.novikov@git.drupal.org:sandbox/d.novikov/1940872.git popupad
Cloning into 'popupad'...
d.novikov@git.drupal.org's password:

Can you help me?

Thanks in advance
Paolo

d.novikov’s picture

@pagolo, it happens because you need to setup your Drupal git account first. Possibly these tutorials can help: http://drupal.org/node/1047190, http://drupal.org/node/1027094. Also try to use your own username, not mine (d.novikov).

tinker’s picture

@pagolo use the public link:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/d.novikov/1940872.git popup_advertisements

@d.novikov perhaps you should update the git link in #1.

d.novikov’s picture

Thank you, I've updated the link.

But the module is called popupad. For better understanding I have left long project name (popup_advertisements) on Drupal.org.

pagolo’s picture

Thank you!
Paolo

erez111’s picture

Status: Needs review » Needs work
d.novikov’s picture

Status: Needs work » Needs review

I fixed all warnings except of

40 | ERROR | Variable "entityType" is camel caps format. do not use mixed case
| | (camelCase), use lower case and _

Camel caps format is allowed by entities coding standards.

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

Perhaps I missed something, but aside from the name and your documentation I don't see where the "Ads" part comes in. I assume that's what you're using this module to do, but it could be used for many other purposes. Consider a more descriptive name that describes what the module itself does, maybe "Popups Everywhere" or "Popup by Path".

The code seems pretty good though, thanks!

----
Top Shelf Modules - Enterprise modules from the community for the community.

d.novikov’s picture

Guys, sorry for delays, I'm literally sunk into my current work.

@kscheirer,
Do you think renaming should also consider module machine name and namespace ("popupad_" to something more relevant) change, or its enough to change a human-readable name? In the first case, I also thought about the "Popup A.D." name, which is a bit exotic, but allows to preserve module machine name as is.

d.novikov’s picture

Status: Reviewed & tested by the community » Needs review
tinker’s picture

@d.novikov If you want to want to change the human readable module name then you should probably change the machine name if it is substantially different. Much easier and better to do this whilst in sandbox.

BTW I don't think module naming is a reason to remove RTBC status but I commend you for doing so. Good work on the module. I have left it 'Needs review' just because you set it there.

d.novikov’s picture

Thank you, @tinker!

I will change then the machine name then too. Hope "popup_onload" will reflect the actual purpose better.

kscheirer’s picture

Title: Popup Advertisements » [D7] Popup Advertisements
Status: Needs review » Reviewed & tested by the community
kscheirer’s picture

Status: Reviewed & tested by the community » Fixed

Well, the code still looks decent. The name hasn't changed yet, but that's up to you.

Thanks for your contribution, d.novikov!

I updated your account to let you 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 get 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.

----
Top Shelf Modules - Crafted, Curated, Contributed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated git link to be public.