I am creating a module in Drupal 7, where I need to have a list of all nodes created by a logged in user of specific content type. How can I achieve this? It is easy to do it in view but I need to do it in a custom module. Can anybody help?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
There is module available https://drupal.org/project/usercontent still if you want to do it in custom module then here is the code:
$node_query = db_select('node', 'n')
->condition("type", "node type")
$node_result = $node_query->execute()->fetchAll();