node

Display comment form on non-node page

  • 9 August 2014
  • mohit.aghera

During one of my project work there was requriement to display the comment form on the non-node page.

Here in this context non-node page means the page other than node/nid.

I was using plain drupal without panels and other module. If we are using panels then we can always put comment pane in the related page.

As I was using plain Drupal i wanted to render the form via template file aka tpl file.

We can't directly do on node tpl file becasue in tpl file $comment is not bound to nid.

So i followed the approch to create the variable that stores the form and render in the tpl file..

  1. Create
Tags: 

How to check whether any node is accessed in past or not

  • 2 November 2012
  • mohit.aghera

During one of my project development I need to check whether in past any node is accessed by logged in user or not.

Fortunately node module and “history table of database ”came to help me.

In node module there is function  node_last_viewed($nid) which returns the last unix timestamp of node access time.

Basically I was using Og forum module so I wanted to check whether any forum topic is viewed previously by logged in user or not.

So first I filtered all the groups of the logged in user.

After that I checked field_data_group_audience table which stores the relation between group node and

Tags: