I am trying to build a Q&A / Ticket System with custom nodes. the current status is:


  • Company: on the company node you get a link with "I want to ask a question"
  • Question: on the question node you get a link with "add comment"
  • Comment: on the comment node you get a link with "add comment"

Multiple comments create a thread.

The relation is made with Node Reference URL Widget. The question node has a reference to company. The comment node has a reference to question.

I have 2 user roles:

  • Company
  • Clients

Companies can only react on questions and comments related to themselves. e.g. pcpower can only react on questions for them and not on those asked to pcworld.

How can this permission be accomplished. For now a company can react on all questions.

Clients: can ask questions to anyone (is working) BUT must only reply on comments/reactions on subjects created by them.

At this moment clients can make comment to any question or comment in the system.

Any help regarding to this would be really helpful.

Kind regards, Jos

2 Answers 2


You could accomplish this with a custom node.tpl.php for the content types - whereby it checks if the author of the node is the currently logged in user, and if not, it doesn't display the comments links (or the comments all together).

  • It is not a reliable solution to implement it in template file. Even though you hide the link, the user can write the path to the address bar and access the comment form.
    – Elin Y.
    Jun 1, 2014 at 18:41
  • Then I would look at the Comment Permissions Module (drupal.org/project/comment_perm)
    – Geoff
    Jun 1, 2014 at 19:11
  • thanks.@Geoff in regards to the comment. The comment is a cutom node type. so i am NOT using standard comment form. My idea was that with comments/answers as nodes it was easier to work with views. But i think you would prefer to use the standard comment form?
    – logadvance
    Jun 2, 2014 at 7:40
  • I think my original answer would work then if you're using a custom node for the comments - how do you associate the question and answer? is done automatically via the link, or is there a drop-down (or similar) in the comments node showing the questions, or something else?
    – Geoff
    Jun 2, 2014 at 13:08
  • bit.ly/1hrNk16 for the site. login klant/test in the company node. a klant(client) can create a question I will play with the node.tpl.php options to see whats the best way to hide links. do you know a code? if user = author. cant seem to find an aexample on the web.
    – logadvance
    Jun 2, 2014 at 15:01

thanks. Getting there (partial) i have restricted acces to the add comment link for the node author using.

    global $user;
    if ($user->uid == $node->uid || $user->uid == 1 ): 
        print $links;
   <?php print $terms; ?>

Now I would like to create acces to the link for the company user.

  • user(company) has field_company as term
  • question has field_company as term

Can I create a code that will say: print link when logged in user term is equal to current node term?

I have only found a code that print the term name.

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.