How to install Drupal on PHP7 and Upgrade Server on Ubuntu

    Follow these steps:
    Step 1: sudo add-apt-repository ppa:ondrej/php-7.0

    Step 2: sudo apt-get update
    With Apache:
    Step 3: sudo apt-get install php7.0

    Step 4: sudo apt-get install php7.0-mysql

    Step 5: sudo service apache2 restart
    With Nginx PHP-FPM
    Step 3: sudo apt-get install php7.0-fpm

    Step 4: sudo apt-get install php7.0-mysql

    Step 5: sudo nano /etc/nginx/sites-enabled/default

    Change fastcgi_pass unix:/var/run/php5-fpm.sock; to  unix:/var/run/php/php7.0-fpm.sock;

    Step 6: sudo service nginx restart

    How to show empty profile2 field in drupal 7

    Create custom module and add following hook to display profile2 field don't have value function _field_attach_view_alter(&$output, $context) { if ($context['entity_type'] != 'profile2' || $context['view_mode'] != 'page') { return; } $profile = $context['entity']; $instances = _field_invoke_get_instances('profile2', $profile->type, array('default' => TRUE, 'deleted' => FALSE)); foreach ($instances as $field_name => $instance) { if (empty($profile->{$field_name}) && $field_name==' or ') { $display = field_ge

    Drupal #states and drupal #ajax examples


    See here:


    See Here:


    How to remove labels from drupal date_popup fields in custom module

    You can do this using below code in custom module
    * Altering Date Popup to remove labels and description for specific field
    function <module_name>_date_popup_process_alter(&$element, &$form_state, $context) {
    if ($element['#name'] == '<fieldname>') {

    * To remove for all date fields remove if statement

    How to use theme imagecahe in drupal 7

    We use theme imagecache in drupal 6. but in drupal 7 we have to use core image style an that can be used as below:
    = theme('image_style', array('style_name' => 'profile_picture', 'path' => 'path uri', 'alt' => 'alt text', 'title' => 'title'));

    How to add custom advanced forum styles in drupal 7

    To add custom advanced forum styles you can create a custom module which styles folder in it having new theme for advanced forum
    Use this hook in your module

    function <module_name>_ctools_plugin_directory($module, $plugin) {
      if ($module == 'advanced_forum') {
        return 'styles';

    create directory in your module


    You can copy any default theme from advanced_forum/styles

    How to remove current password field in drupal?

    To remove current password field in drupal just place this form alter in any custom module this will remove field and its validation also
    function <modulename>_form_alter(&$form, $form_state) {
      $form['#validate'] = array_diff($form['#validate'], array('user_validate_current_pass'));

    How to use theme_imagecache in drupal 7

    Drupal 7 has imagecache in its core so this function can be replaced by theme_image_style For example:
    <?php print theme('imagecache', '<presetname>', '<pathtoimage>', '<alt>', '<title>'); ?>
    Can be Written as
    print theme('image_style', array('style_name' => '<presetname>', 'path' => '<pathtoimage>', 'alt' => '', 'title' => '', 'width' => '', 'height' => '')));

    How to show search block in drupal 7

    You can show search block in drupal 7 by using dashboard module its enabled by default. You can go to dashboard and select the search form block configure it and show it in the region where you need it. If you need to show it programatically You can use following code
    = module_invoke('search', 'block_view', 'search');
    render($searchblock );