In the module configuration "Require Login settings", I tried adding exclude path and it does not work. I'm a front-end developer and not good in php, so I did hack the module like the below just for it to temporary work. But it requires adding the path in module.

Is this exclude path tested and working? If yes, can you suggest on what might possibly is causing the issue.

Thanks!

if (request_path() == 'my/excluded/path/here') {
    return TRUE;
}

Comments

Mackee’s picture

Issue summary: View changes

Hi,

I just want to say that I think I got it fixed. Here is the modified code in require_login.module line 89.

// Excluded paths.
  $excluded_paths = explode("\n", variable_get('require_login_excluded_paths'));
  $excluded_paths = array_map('trim', $excluded_paths);
  
  if (in_array(current_path(), $excluded_paths)) {
    return TRUE;
  }
Mackee’s picture

StatusFileSize
new451 bytes

Here is a patch for this changes if anyone may need it.

greenskin’s picture

StatusFileSize
new1.8 KB

Here's a patch that allows wildcards in the excluded paths.

The Services endpoints, specifically for REST servers, needs the wildcard options so an exception doesn't have to be created for each resource.

greenskin’s picture

Status: Active » Needs review
Funksmaname’s picture

Thanks so much for your patch #3 greenSkin! This simple change has made the module very easy to use with the domains module where one of my domains can be accessed (by using '*' for all paths) and the rest are blocked!

---SPOKE TOO SOON!

the domain specific overrides don't seem to work - it's either all blocked or all accessible, setting things for individual domains aren't sticking... any ideas?

RedactedProfile’s picture

Just installed the latest stable version of this in a fresh copy of the latest Drupal, I cant seem to get the user/register and user/password pages to be accessible even when adding them to the exclusion list on admin/config/system/require_login

---

EDIT: Not sure why, but it started working after a few hours despite flushing all cache's hours before

breidert’s picture

I reviewed and applied patch #3, it works as designed.

bobooon’s picture

Status: Needs review » Closed (fixed)

The exclude paths functionality has been rewritten in version 7.x-2.0. It now utilizes drupal_match_path() to both enable wildcards and standardize excluded path matching. Other changes have been made as well to improve reliability and consistency. I highly recommend upgrading to 7.x-2.0.