Synopsis
This module helps to create country specific Blocks. It Add country setting to block and manages country specific display of block.
Block will be only visible for the selected countries. It detects and gets User's country from Ip2Country information and based on this it manages block visibility.
Configuration
To add country specific visibility to a block, Go to that block's configuration country settings is listed under block "Visibility settings"

Maintainer
This project is originally written by Ashish Dalvi
Project Page
This is the project page link for Block Country
Clone Repository
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/Ashish.Dalvi/2552025.git block_country
Manual reviews of other projects
https://www.drupal.org/node/2563687#comment-10319901
https://www.drupal.org/node/2552369#comment-10321813
https://www.drupal.org/node/2554407#comment-10322195
Automated Review Link
http://pareview.sh/pareview/httpgitdrupalorgsandboxashishdalvi2552025git
| Comment | File | Size | Author |
|---|---|---|---|
| block_country.png | 46.18 KB | ashishdalvi |
Comments
Comment #2
rajeev_drupal commentedI will review this and get back to you...
Comment #3
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 #4
ashishdalviComment #5
ashishdalviComment #6
dishabhadra commentedAs I review this module IP addresses are stored in SESSION variable. The drawback is if I am in another country for eg. originally I was in India and my SESSION is set for India and now I am relocated to US still I am able to see the Block which is set for India.
Comment #7
ashishdalviComment #8
ashishdalviComment #9
klausiRemoving review bonus tag, you have not done all manual reviews, you just repeated the output of an automated review tool. Make sure to read through the source code of the other projects, as requested on the review bonus page.
Comment #10
ashishdalviComment #11
ashishdalviHi @klausi,
I have reviewed one more project. Please review it and let me know in case if i have missed anything.
Adding +PAReview: review bonus tag
Thanks,
Ashish
Comment #12
ashishdalviComment #13
chandrasekhar539 commentedAutomatic Review
This project has some issues in automatic review
ESLint has found some issues with your code (please check the JavaScript coding standards).
block_country.js: line 6, col 2, Error - Use the function form of "use strict". (strict)
block_country.js: line 20, col 4, Error - Missing semicolon. (semi)
Also add the automatic review link in this issue so that others can review it easily.
http://pareview.sh/pareview/httpgitdrupalorgsandboxashishdalvi2552025git
As it is not a blocker but is important for others to review easily.
Comment #14
ashishdalviComment #15
ashishdalviHi @chandrasekhar539,
Thanks for the review.
I have fixed all suggested issues and Added automated review link of profile issue page as well.
+ Marking it as Needs Review.
Thanks,
Ashish
Comment #16
ashishdalviComment #17
shashwat purav commentedManual 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 #18
ashishdalviThank you @Shashwat Purav for review.
I have worked on your suggestions. Please find my comments inline to your suggestions.
1. Please add the section of "Similar projects and how they are different", if your project is similar to, or otherwise overlaps the functionality of some other project(s).
I didn't found any similar project which provides country-wise display of block. so it dose not apply here.
2. Provide help text in the Drupal UI: At both the end-user and coder/developer level, the Drupal help pages are the obvious place to access information about your module. All but the most trivial modules should implement hook_help().
I have added hook_help page.
3. Featured Request: Add functionality to show the block in country for certain duration. This is would help in showing blocks related to events, advertisements, news etc.
Similar functionality is provided by Block by Date module.
Please review it and let me know in case any more suggestions.
Updating issue status as + Needs Review.
Thanks,
Ashish
Comment #19
ashishdalviComment #20
nashkrammer commentedAutomated Review
[Best practice issues identified by pareview.sh / drupalcs / coder. Please don't copy/paste all of the results unless they are short. If there are a lot, then post a link to the automated review and mention that problems should be addressed.]
Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.
Manual Review
module_load_includeinstead ofinclude_once DRUPAL_ROOT . '/includes/locale.inc';.It is only required for country_get_list() function so it can be in its scope.$form_stateneed to sanitized before using with db update.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 #21
klausi$form_state must not be sanitized before saving data with db_update(): "When handling data, the golden rule is to store exactly what the user typed. When a user edits a post they created earlier, the form should contain the same things as it did when they first submitted it. This means that conversions are performed when content is output, not when saved to the database." from https://www.drupal.org/node/28984
The rest also does not look like application blockers, anything else that you found or should this be RTBC instead?
Comment #22
nashkrammer commented@klausi,
Rest is tested, I am changing the status to RTBC.
Comment #23
dishabhadra commentedComment #24
ashishdalviComment #25
ashishdalviComment #26
ashishdalviComment #27
naveenvalechaAssiging to myself for second review that may be tonight
Comment #28
neetu morwani commentedGreat module.
Review of the 7.x-1.x branch (commit b2a3642):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
There are few issues which I noticed while reviewing the module-
1. hook_form_alter has been implemented. But the function doc says - "Implements hook_form_FORMID_alter()."
2. Additionally, you will also have to implement hook_form_block_custom_block_delete_alter(hook_form_FORM_ID_alter) in order to delete your module specific configuration for this block,when this block will be deleted.
Comment #29
neetu morwani commentedComment #30
klausi@neetu morwani: that sounds like useful improvements but are surely not application blockers - anything else that you found or should this stay RTBC?
Comment #31
naveenvalechaReview of the 7.x-1.x branch (commit b2a3642):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Manual Review :
Good points that @neetu.morwani addressed
as unique key in schema and instead of adding and removing the record load the visiblity settings by module and delta uniqueness in hook_form_alter to fetch the data.It will give performance hits. See block_noresults for more information.
There are few extra lines in module so remove those.
Nothing major jumped at me, Assiging to klausi to give a final review if he has time.
Comment #32
klausi@naveenvalecha: since this was RTBC already you can simply approve it, not need for a second git admin review.
Comment #33
ashishdalviHi,
Thank you @neetu.morwani, @naveenvalecha, @klausi for review and suggestions.
All suggestions really helped a lot to improve module functionality and performance.
I have worked on all above mentioned suggestions. Please review. Git commit Details 7.x-1.x branch (commit 154b623):
@neetu.morwani :
1. hook_form_alter has been implemented. But the function doc says - "Implements hook_form_FORMID_alter()."
-- Fixed function doc
2. Additionally, you will also have to implement hook_form_block_custom_block_delete_alter(hook_form_FORM_ID_alter) in order to delete your module specific configuration for this block,when this block will be deleted.
-- Implemented block_country_form_block_custom_block_delete_alter.
@naveenvalecha :
1. The module implements hook_boot that will give performance issues for large scale websites so specify on the project page about the same.
-- Updated project page and README.txt
2. Readme.txt is nice. you can also add maintainers as well as about performance implications in it see https://www.drupal.org/node/2181737
-- Updated project page and README.txt
3. block_country_help : Use single quotes where ever possible as per coding standards see http://www.drupal.org/node/1354
-- Updated block_country_help hook
4. (*)Implement a hook_form_FORM_ID_alter for block form delete and remove the block country specific configuration.or you can reuse the block_country_form_alter for it.
-- Implemented block_country_form_block_custom_block_delete_alter.
5. unique key in schema
-- In block_country table block, delta can not be unique as we can assign multiple country to single block.
6. Use drupal_write_record
-- Replaced db_insert with drupal_write_record.
Thank you all for review.
Thanks,
Ashish
Comment #34
naveenvalechaRead (commit 154b623) :
Manual Review :
"use strict";Nothing major jumped at me.Thanks for your contribution.
Comment #35
naveenvalechaThanks for your contribution, Ashish.Dalvi!
I updated 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!
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.