By pushka


2011-06-22 07:52:50 8 Comments

When I'm developing sites in Drupal, I create various content types and taxonomy vocabularies that I use with Views to build displays. I might not ever want the nodes to be viewable in their own right or listed by taxonomy. Visitors may never figure out the URLs to do this, but I'd still like to lock this down.

I'm aware of various content access modules, and have considered theming taxonomy displays to simply say 'page not found'. But I've yet to find a simple solution, so wondered what other people use to prevent content from being viewed outside of a View?

3 comments

@G.Martin 2011-06-22 14:11:05

I'd just leave that content unpublished. You can surface it through the view, but no one else can access it.

@mpdonadio 2011-06-22 13:42:33

In D6, I set the path alias for these content types to be

no-view/[nid]

and then use

function MYMODULE_init ()  
{  
    $path = drupal_get_path_alias(request_uri());  

    if (strpos($path, "no-view/") !== FALSE) {  
        drupal_not_found();  
        exit;  
    }  
}

I think this will work as-is in D7, but I haven't tried it.

@googletorp 2011-06-22 12:38:47

Instead of denying access to the page it would be much simpler to let the view page use the actual path you don't want found. Then you could use path_auto to make pretty urls.

Related Questions

Sponsored Content

1 Answered Questions

Allow users to access only terms that he created

1 Answered Questions

Views field for content access?

  • 2015-02-10 18:49:25
  • Pooch
  • 154 View
  • 0 Score
  • 1 Answer
  • Tags:   views users

1 Answered Questions

Specific Content Access only after successfull checkout

1 Answered Questions

2 Answered Questions

Views taxonomy listing of terms linked via contextual path

2 Answered Questions

[SOLVED] Checking access in Views

  • 2011-05-09 20:08:41
  • Kevin
  • 3195 View
  • 4 Score
  • 2 Answer
  • Tags:   7 views users

1 Answered Questions

[SOLVED] How to prevent users from accessing content?

  • 2013-07-31 18:32:10
  • Jack
  • 45 View
  • 1 Score
  • 1 Answer
  • Tags:   users

1 Answered Questions

[SOLVED] How to get taxonomy synonyms working robustly with Search API?

  • 2012-09-09 16:59:27
  • user56reinstatemonica8
  • 3624 View
  • 20 Score
  • 1 Answer
  • Tags:   7 taxonomy-terms search

3 Answered Questions

[SOLVED] Taxonomy inline with several category types?

Sponsored Content