Skip to content

Instantly share code, notes, and snippets.

View sadanandkenganal's full-sized avatar

Sadanand Kenganal sadanandkenganal

View GitHub Profile

One Day Workshop On Drupal

##Agenda ###Goals

  • Students attending the workshop should come away with a good understanding of what Drupal does and what types of sites it can be used for.
  • They should be exposed to the basics of building a site in Drupal.
  • They should be exposed to the modules most people use to build Drupal sites.
@sadanandkenganal
sadanandkenganal / clea_url_drupal7.md
Last active September 7, 2017 07:23
Enable Clean URL's drupal 7

It's very simple.

In your project Directory, you have .htaccess file. open it and make the following changes. Its a hidden file.

  1. Modify the RewriteBase if you are using Drupal in a subdirectory or in a VirtualDocumentRoot and the rewrite rules are not working properly. For example if your site is at http://example.com/drupal uncomment and modify the following line:

Line 106 - RewriteBase /yourprojectname(project folder)

  1. If your site is running in a VirtualDocumentRoot at http://example.com/, uncomment the following line and modify:
@sadanandkenganal
sadanandkenganal / redirect_in_drupal7.md
Last active August 29, 2015 14:01
Redirect users after login in drupal7.

How to redirect users after login in drupal?

For example, there is page called user-serach. I want to redirect to a user-search page, when the user of some ROLE 'user-search-role'.

For this, you need to implement, hook_user_login(&$edit, $account).

Complete Code

@sadanandkenganal
sadanandkenganal / update_drupal_core.md
Last active August 29, 2015 14:01
Update Drupal Core

Steps to update Drupal core with a newer version of Drupal. (Eg. Drupal 7.27 to Drupal 7.28)

1. Make a backup of your Drupal instance. (Imp. With site folder and mysql)
2. Download the latest release of Drupal version.
3. Extract the [tar ball or zip] Drupal package.
4. Set your site on maintenance mode. (Visit this admin/config/development/maintenance).
5. Delete all the files & folders inside your original Drupal instance except for /sites folder and any custom files you added elsewhere.
  1. Copy all the folders and files except /sites from inside the extracted Drupal package [tar ball or zip package] into your original Drupal instance.
@sadanandkenganal
sadanandkenganal / drupal_multisite..md
Last active August 29, 2015 14:02
Configuring a basic multisite development environment in Linux

Basic multisite environment in Linux

Step 1: Download and uncompress Drupal

You can download and uncompress Drupal by following the steps on the Download and uncompress Drupal page of the Installation guide, as this step does not differ from a normal installation.

Step 2: Set up your hosts file

Add the following lines to /etc/hosts:

@sadanandkenganal
sadanandkenganal / drupal_menu_tabs.md
Last active August 29, 2015 14:02
How to hide menu tabs, menu links and assign access permissions in Drupal 7

Hide menu tabs, menu links and assign access permissions in Drupal 7

hide "create new account" tab in "/user" page. To hide menu tabs we have to use hook_menu_alter hook. This hook changes the menu items. So here we are going to alter menu tabs that come with user module. Using this hook we can also do some other changes like title, permissions etc.

###For hiding menu tabs

Eg: Hide 'create new account' tab  and 'request password' tab.

In your Custom module
@sadanandkenganal
sadanandkenganal / drupal_add_js.md
Created June 20, 2014 06:49
Add Javascript OR CSS to Particular Content Type Page.

You should add this code in template.php file inside your custom or contributed theme.

function tb_rave_preprocess_node(&$variables) {
    if($node->type == 'contenttypename') {
      $node = $variables['node'];
      drupal_add_library('system', 'ui.tabs');
      drupal_add_css(drupal_get_path('theme', 'yourtheme') . '/example.css');
      drupal_add_css(drupal_get_path('theme', 'yourtheme') . '/example.js');
    }   
}
@sadanandkenganal
sadanandkenganal / replace_flag_links.md
Created June 24, 2014 08:32
Replace flag links by image icons in drupal 7
@sadanandkenganal
sadanandkenganal / activelink_codeigniter.md
Last active April 3, 2022 12:24
Add active class to menu in codeigniter.
@sadanandkenganal
sadanandkenganal / install_ruby_on_rails.md
Last active August 29, 2015 14:19
Install Ruby on Rails (ROR) on Ubuntu 14.04

1. Install some dependencies for Ruby.

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

2. using rbenv(recommended : Ruby Environment). Since there are other methods also.