I am building a simple classifieds style site. Instead of using straight email, I was thinking about creating a simple "make offer" node type. Create a few basic fields (reference to classified listing, message, will buy for X price, would trade, etc...).

Then create a view block and put the nid in to limit those "offer" nodes to only the node being viewed. However, I would like to do two things.

1) Limit the block to only be viewable to administrators and the node author themselves, other users should not be able to see the other offers.

2) Make it so going to /node/{nid} that is an offer content type is hidden from view so users can't just bypass the block and hit the nid of the offer node.

Any help on how to implement this? I am trying to do it with no added modules.

EDIT: The access to the block should be as follows:

Administrators: Should see all "offer" nodes in the block regardless of who they are from.

Listing Author: Should see all "offer" nodes in block.

Offer Author: Should only see "offer" nodes they have submitted to "listing" nodes. They shouldn't see any other "offer" nodes from any other user.

1 Answer 1

  1. In views, add a relationship on "Content: Author", then add a filter "User: Current" and configure it so it uses the relationship you added and has "Is the logged in user" = "Yes".
  2. Install the Rabbit Hole module and its node sub module and configure it (on the edit page for the offer content type) to give a 404 error for those nodes. Then configure the rabbit hole permissions so that admins can bypass rabbit hole if you need that ability. I would recommend adding this module as opposed to writing some custom code to do this.
  • Fantastic! Thank you so much. Rabbit Hole was exactly what I was looking for.
    – Brandon
    Commented Apr 15, 2015 at 0:28
  • Yeah it's a really poorly named module in terms of making it easy for people to find via google.
    – rooby
    Commented Apr 15, 2015 at 0:32
  • Yeah, it should be something relateable like "Custom Node Views" or "Block Node Paths"...or something like that.
    – Brandon
    Commented Apr 15, 2015 at 0:35
  • rooby, I am still having a bit of trouble with this. I have updated the original post with the access requirements and I have the exported view here: pastebin.com/w7yMNF9S Is there something I am missing? Any help would be greatly appreciated. Thank you.
    – Brandon
    Commented Apr 22, 2015 at 3:44
  • 1
    @Brandon: writing Fantastic is ... Fantastic, but are you aware of what's written in Someone Answers ? Moreover, the edited version of your question makes it a cameleon question (= solution to the problem, changes the problem) ... it makes this answer at least look incomplete. Instead you should have posted a followup question (with a link to this one if you want). And the edit you added looks to me like you're mixing block visibility (I think) with block content (not sure what it actually is). Just trying to "help" a bit, ok? Commented Jul 16, 2016 at 9:16

Your Answer

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

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