Posted by johnnygamba on November 27, 2012 at 1:46pm
6 followers
Jump to:
| Project: | Drupal.org Project applications |
| Component: | module |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
This module sets a cookie the first time a user comes into the site and exposes a function called is_first_time_visit(); This is done via javascript to guarantee the code executes even if a proxy reverse is implemented.
Link to project: http://drupal.org/sandbox/johnnygamba/1851384
Link to git repository: git clone --recursive --branch master johnnygamba@git.drupal.org:sandbox/johnnygamba/1851384.git first_time_visit
Drupal 7
Thanks.
Comments
#1
Using the following as a structure for my review http://drupal.org/node/894256 and http://groups.drupal.org/node/184389
Manual review:
You can find the results of the automated report at http://ventral.org/pareview/httpgitdrupalorgsandboxjohnnygamba1851384git.
first_time_visit.js
On line 4, the class passed to the "once" function should be less generic I think. Maybe something like this:
$('body', context).once('first_time_visit_processed', function(){first_time_visit.module
Maybe rename "is_first_time_visit" to "first_time_visit_is_first" or something like that.
#2
hi thanks for the review, your help is much appreciated.
#3
Hi @idflood, i did everything you pointed me, can you review it again please? thanks.
#4
review please
#5
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 I'll take a look at your project right away :-)
#6
Ok i will give it a try, i will be letting you know, thanks.
#7
I have already reviewed one, but it hasn't passed yet, i'll be informing you about my progress helping the community.
cheers
#8
Hi,
need to clear some errors/warnings. see here: http://ventral.org/pareview/httpgitdrupalorgsandboxjohnnygamba1851384git
first_time_visit.module
(optional) can be add
hook_help()You still have good review at #1. plz complete your work following that.
#9
hi, thanks for the review, i just fixed everything, cheers.
#10
Don't forget to change status then. :)
#11
Sorry man change the status to what?, i don't know what to do next.
thanks for your time.
#12
first_time_visit.module
You should use
isset()insidefirst_time_visit_is_first().You could implement the function as follows:
function first_time_visit_is_first() {return isset($_COOKIE['first_time_visit']) && $_COOKIE['first_time_visit'];
}
or better:
function first_time_visit_is_first() {return !isset($_COOKIE['first_time_visit']) || $_COOKIE['first_time_visit'];
}
first_time_visit.js
You have:
$('body', context).once('first_time_visit_processed', function(){if (!$.cookie('first_time_visit')) {
$.cookie('first_time_visit', true, { expires: 5000 });
}
else {
$.cookie('first_time_visit', false);
}
});
Honestly, I don't see how this can work. If the cookie is not set or is false, you set it to true. If the cookie is true, you set it to false. But the next time, the cookie will be set to true again.
Maybe you want to do this: ??
$('body', context).once('first_time_visit_processed', function(){if ($.cookie('first_time_visit') === null) {
$.cookie('first_time_visit', true, { expires: 5000 });
}
else {
$.cookie('first_time_visit', false);
}
});
Please also align all the javascript code properly.
README.txt
The file is short. Could be extended explaining how the module works and what it uses.
#13
#14
Closing due to lack of activity. Feel free to reopen if you are still working on this application.
If you reopen this please keep in mind that 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 I'll take a look at your project right away :-)