Skip to main content
Home
Toggle menu

Main navigation

  • Home
  • Blogs

PHP

Programmatically delete configuration - Drupal 8

By default Drupal stores all configuration into database. Below example shows how to remove / delete configuration object of 'automated_cron.settings', i.e. remove cron settings.
  • Read more about Programmatically delete configuration - Drupal 8

Bootstrap Drupal 7 on Multisite

As a developer we always been into position where we need to write a custom script which bootstrap's Drupal Core from code and do some operations. This is pretty straight forward when working single site.
  • Read more about Bootstrap Drupal 7 on Multisite

Redirect User after login - Drupal 8

When building sites, many client wants users to get redirected to particular page (like Site Home Page) or page based on User Roles.
  • Read more about Redirect User after login - Drupal 8

Replace file extension from string - PHP

Suppose we've file name (with extension) as part of string and while displaying to users we want to replace file extension from string. Here's how we can do this:
<?php
  $snippet = 'Lorem ipsum dignissim interdico meus file.exe dolore ideo.';
  • Read more about Replace file extension from string - PHP

Configure PHP.ini to show errors - Ubuntu

Note: Make sure you're enabling this only on development server. It's very common for any developers to make a mistake while developing, which will result in White Screen of Death (WSOD).
  • Read more about Configure PHP.ini to show errors - Ubuntu

Alter $WP_Query in WordPress

When showing list of content (i.e. Posts, Custom Post Type) on Category Page, the main $WP_Query renders posts of default Posts type.
  • Read more about Alter $WP_Query in WordPress

How to get Payment method settings in Drupal Commerce

Today we're going to see how we can retrieve the payment method settings when ever we required. The payment methods are used to accept the payments from user during Checkout process.
  • Read more about How to get Payment method settings in Drupal Commerce

Drupal - Change label of exposed filter form button in views

Views one of the great module available in Drupal. Views can be used to show various types of dynamic data and can also be used to allow users to filter results based on his criteria.
  • Read more about Drupal - Change label of exposed filter form button in views

How to display PDF in browser via PHP

The last project I was working on was having a requirement hiding the file URL in browser, for security reason. The file was actually PDF file and was containing user's order data.
  • Read more about How to display PDF in browser via PHP

Get number of hours between 2 timezones

Here is how you can find the difference between two different timezones
<?php
  // Set time to UTC
  date_default_timezone_set("UTC");
  $utc = date("Y-m-d h:i:s A"); // Get current time as per UTC.
  • Read more about Get number of hours between 2 timezones

Monthly archive

  • March 2019 3
  • September 2018 1
  • July 2018 2
  • April 2018 1
  • August 2017 1

Pagination

  • Next page ››
sfy39587stp18