1

I have created a basic page which I only want to be viewable by people who have access to the administration theme.

I have given the page a path of admin/shipping-help but to my surprise the page is visible to anonymous visitors, nor does the page display in the admin theme.

What am I doing wrong?

5
  • I am a bit confused because when I assign an admin path to a views page, it is always displayed in the admin theme. Feb 20, 2015 at 20:21
  • is that working @Paul did you tried below answers ? Feb 20, 2015 at 20:21
  • Because of the complications I ended up moving away from the idea of publishing nodes within the admin interface and instead found a workable solution using the collapsible blocks module - drupal.org/project/collapsiblock For the moment this serves my purposes by allowing me to place help information where needed. Feb 21, 2015 at 10:51
  • Based on suggestions here I did succeed with a combination of Themekey and Path Access, but this seemed like a hammer to crack a nut. Collapsiblock will do for now. Feb 21, 2015 at 10:59
  • okay got solution good to know :) happy coding Feb 21, 2015 at 11:01

3 Answers 3

0

There are some modules that can help with this: like Content Acess, or Node Access

Node Access Content Access

0

For restricting particular url or Basic page you can go with

this module will suite you best path_access

if that dont work

Refer this link for Controlling Access to Content Overview

hope this helps

1
  • Yes I like path access and may go down this route. Something which displays the node in the admin theme is also needed. As the page title suggests, it is for an internal help system. Feb 21, 2015 at 9:50
0

A basic page is a node. It will be on the internal node/% path. Giving it an alias of admin/shipping-help is not going to change that. You need it to be on admin/... internal path.

Create a new entry for hook_menu with your admin path and display the node in question:

function MODULE_menu(){
  $items = array();
  $items['admin/shipping-help'] = array(
    'title' => "Shipping Help",
    'page callback' => 'MODULE_shipping_help',
    'access arguments' => array('access administration menu'),
  );

  return $items;
}

function MODULE_shipping_help() {
  $node = node_load(70);
  if ($node) {
    return node_view($node);
  }
}

Then set the node in question to unpublished to protect it from unauthorised access from node/% path. You can even intercept a request for that path and redirect to the admin path.

2
  • Well I didn't know that I didn't know that :-) So much to learn. Is there a lightweight contrib module which can provide this functionality. Thank you. Feb 21, 2015 at 9:45
  • Page Manager and Panels come to mind, though they aren't lightweight Feb 21, 2015 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.