Commit 5f9becd7 authored by Alex Laughnan's avatar Alex Laughnan Committed by enzipher
Browse files

Issue #2444419 by laughnan: Certain roles should be exempt from redirection

parent 1f457be1
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -24,12 +24,30 @@ function og_homepage_menu() {
}


/**
 * Implements hook_permission().
 */
function og_homepage_permission() {
  return array(
    'bypass og homepage redirection' => array(
      'title' => t('Bypass OG Homepage redirection'),
      'description' => t('Removes redirection from specified roles.'),
      'restrict access' => TRUE,
    ),
  );
}


/**
 * Implements hook_init().
 */
function og_homepage_init() {
  global $user;

  if (user_access('bypass og homepage redirection', $user)) {
    return;
  }

  // Check if we have a logged in user and if we are on the front page.
  if (user_is_logged_in() && drupal_is_front_page()) {
    // Does this user possess a role which has og_homepage enabled?