Display list of Drupal contents based on your visitor's state/province/region location in Views (using Smart IP and Location modules) and have a dropdown form available to filter other regions

In this article we will discuss how to setup a View that shows list of contents in a Drupal 7 site that are filtered based on your visitor's state/province/region location with the use of Smart IP and Location contributed modules and expose views filter to have a dropdown form available for visitors to enable them to filter list of contents in other regions. Smart IP module is used to identify Drupal site visitor's geographical location based on his IP address and Location module is used to provide the field and expose the views location filters.

Steps:

Running PHP 7.0 as one of multiple PHP versions on CentOS 7 using Virtualmin

In connection to my post Running multiple PHP versions on CentOS 7 using Virtualmin, this guide will show how to install additional PHP 7.0 version on CentOS 7 by using the Software Collections and have Virtualmin detect and use it.

Here are the steps:

  1. Login as root to your server's console terminal.

  2. Install the CentOS Linux Software Collections release file:

          
    yum install centos-release-scl
          
        
  3. Install the PHP package:

Solution on how to force re-index your Search API index application

The following codes below will just force to queue the node to your Search API index application batch process. But the actual index execution will not run yet and this depends on how often your cron runs.

  
// Clear field cache for the node.
cache_clear_all('field:node:' . $node->nid, 'cache_field');

// Reindex the node.
search_api_track_item_change('node', array($node->nid));
  

If you need to force index your Search API index application, you can use the codes below:

How to setup a working Responsive Image in Drupal 8

Responsive Image module is a core module in Drupal 8 and this guide will show setting up this module with working example.

Steps:

  1. Enable the Responsive Image module at http://www.yoursite.com/admin/modules.

  2. We can use existing Breakpoint group but in this guide we will create our own Breakpoint group. It can be created as module or as theme and we will create this as module. Inside /modules folder of your Drupal 8 site, create a folder labelled as "site_optimization".

Display downloadable files based on the country location of the visitor of a Drupal site's content

This article will show how to display downloadable files based on the country location of the visitor of a Drupal 7 site's content. We will take a sample application where the website's contents will have three types of downloadable files; first type should be displayed only for visitors from Philippines; the second type should be displayed only for visitors from Singapore and the third type should be displayed for visitors that are not from Philippines and Singapore (rest of the world) with the use of Smart IP, Field Collection and Location contributed modules.

Influence the Drupal site's suggestion list of search autocomplete module with Smart IP views country filter

This is an example application of Smart IP where it influence the suggestion shown in the list of search autocomplete based on the country location of the visitor in a Drupal 7 site with the use of Smart IP, Search Autocomplete and Location contributed modules. Basically, the search autocomplete will display list of suggestions but the list of nodes will be filtered based on country location of the visitor and nodes that have an empty value in Location country field will not be filtered.

Smart IP Drupal 7 settings explained

The following is the explanation of each Smart IP settings in Drupal 7.

Database Update Status

This Smart IP section setting will only appear if your Data Source is either MaxMind GeoIP Legacy binary database or MaxMind GeoIP2 binary database or Smart IP database (Maxmind's CSV). It display the status of database update process from manually executed or automatically during cron run. If the database update failed, you can manually force the database update by clicking the "Update database now" button.

Display specific Drupal contents based on your visitor's country location in Views (using Smart IP and Location modules) and display all contents if there's no result

This tutorial will show how to setup a View that shows list of contents in a Drupal 7 site that are filtered based on your visitor's country location with the use of Smart IP and Location contributed modules and if there is no result, the fall back is to display all contents. Smart IP module is used to identify Drupal site visitor's geographical location based on his IP address and Location module is used to provide the field and expose views location filters.