Programming

Programming manuals, coding tips, tutorials, code snippets and more...

Merge permissions of Drupal roles

  • Posted on: 25 November 2015

Merge permissions from multiple Drupal roles

First specity the new role which will be the source and destination for the merge

$source_role_names = array('blogger', 'editor')
$dest_role_name = 'merged';

Fetch the rid from the names

foreach ($source_role_names as $name) {
  $rid = user_role_load_by_name($name)->rid;
  $source_role_ids[$rid] = $rid;
}

Create the role if necessary.

Tags: 

Working with git repositories

  • Posted on: 20 November 2015

Initialize bare git repository

Use these commands to initialize a bare (empty) git repository. This is usualy a good idea when you want to create a central repository.

mkdir /var/git-repo/project.gif
cd /var/git-repo/project.gif
git init --bare

Configure git groups and users

Also make sure that the developers will have access to the repo. This can be done by adding them to a group developers and giving permissions to the git repository directory.

If the developers group does not exist yet, you can create it with this command:

Tags: 

Drupal multilanguage explained

  • Posted on: 20 November 2015

Drupal supports language handling functionality and enables the translation of the user interface to languages other than English. There are multiple modules that enable you to do that in different ways.

Read here about different ways to enable multilanguage in Drupal 7 and how this is handled in the database.

Tags: