This tag is for questions regarding the use, reuse and manipulation of nodes, the most basic form of content on a Drupal site. While nodes are implemented as entities in Drupal 7, this tag should be used instead unless specifically referring to Entity API functionality.

learn more… | top users | synonyms (1)

22
votes
12answers
5k views

How do I hide Drupal nodes that shouldn't be directly accessed from users and search engines?

I've found that there are times I have a node that simply contains content that will be displayed somewhere else, but shouldn't be viewed directly. That is, no one should ever go to node/1234, but the ...
21
votes
4answers
18k views

Get a node ID from the URL

So far, I came across these 3 functions, but I am not really sure what the difference between them is, and which is more appropriated to get the node ID in a block preprocess function. ...
18
votes
10answers
11k views

Displaying a field before node title in Drupal 7

I'm looking to render a certain field before the node's title when displaying a teaser in D7. Effectively I want to go from this to this. I have looked into updating the node.tpl.php but I notice ...
15
votes
2answers
10k views

Is there a Drupal API function to get the list of nodes by type?

Is there a Drupal API function like node_load() that will return a list of nodes by a given type? I've tried $nodes = node_load(array("type" => 'student_vote')), but it only returns one node. I ...
11
votes
8answers
8k views

Delete all nodes of a given content type

I have several thousand nodes of a particular content type. Using the web interface (example.com/admin/content), I can only delete about 50 at a time. How can I quickly delete them?
11
votes
7answers
12k views

Where does Drupal store the content of a node's body?

In the node table, you'll find everything except the actual body. Where can I find this body text? I'm assuming it's being stored as a blob somewhere.
11
votes
0answers
347 views

Mass image upload with Storage API and Services API

I am trying to set up a site that will be storing a large amount of images (roughly 50,000 to start with). The strategy for this was to use Storage API and S3 storage to deal with the costs of ...
10
votes
3answers
4k views

Count of nodes by type

I am looking for a snippet that lets me display the total count for a specific node type, e.g. "Pages = 167" or "Products = 10630." What code should I use to achieve this?
10
votes
2answers
2k views

Is it possible to restore a deleted node?

While revisions are kept and it is easy to get back to a previous revision of a node, I was wondering if it is possible to restore a node that has really been deleted by a user?
10
votes
3answers
7k views

How do I remove the “submitted by” text on node display?

In Drupal 6 the option to remove that text was located in the theme settings; where is it in Drupal 7?
10
votes
1answer
3k views

How to get a node by its url alias?

I know I can load a node by its title with the node_load() function. Is it possible to load a node by its URL alias?
9
votes
1answer
3k views

How do I get the name of the content type?

in Drupal 7, which function do I need to call to get the name of the content type? I have the $node object and I also have the id of the content type if I use $node->type. But I need to get the ...
9
votes
2answers
5k views

load a node content into a lightbox2 (without headers and footer and other blocks)

is it possible to load a node (from an id) into a lightbox 2 without having to load all the additional blocks ? just what the node has to display I want to make some popups on some links to allow ...
8
votes
8answers
4k views

Views slideshow from single node

I'm trying to achieve working slideshow from images in single node. Images are uploaded from the image field. It's drupal 7. I made new content type and all I made now is slideshow from multiple nodes ...
8
votes
2answers
1k views

How can I detect when a node is changed from 'Published' to 'Unpublished'?

In hook_node_update(), I can easily tell the 'status' of a node (whether it's published or not) after it's been updated. However, is there an easy way to check to see if the updated node was ...
8
votes
2answers
996 views

How can I create a bulk node creation interface?

I have a request for an interface where nodes with a small amount of required fields (for example, a title, date, and a node reference) would be able to be created in bulk on one screen. I am ...
8
votes
4answers
2k views

D7 - Views & Flag - View of users flagged by a user, users flagging a user, and nodes from users flagged by a user

The title is pretty self explanatory - I have a user flag that is pretty much like a "follow" or "subscribe" function. Basically I want to create 3 views for my website's user profile pages: A list ...
7
votes
3answers
3k views

How to load a node based on its title?

I only know the title of a node, and I want to load the node using node_load(). How do I do that?
7
votes
1answer
547 views

How to delete node revisions

I need to delete all node revisions before upgrading to Drupal 7 to save time in migration. Is there any way to do that?
7
votes
2answers
6k views

How to pass an argument into Views for Drupal 7?

I'm trying to pass an argument through a block created by a view. The node is an ubercart product node. I have aliased the paths such as: node/45 to products/[name] In contextual filters, I've ...
7
votes
1answer
192 views

What is the best choice to create a node through code?

The scenario goes this way, I have a node type which has lot of Taxonomy term fields in it. It does also have other fields like text, date etc but 90% of it is a taxonomy field. I am aware that a node ...
7
votes
1answer
402 views

What if nid reaches the maximum ?

What if my nid reaches the maximum allowed value of MySql int type I have made a drupal.org site search that ends up Here. And also i found Integer Types (Exact Value). In an app that i am about to ...
6
votes
3answers
2k views

How to pre-populate fields on a node creation form based on fields from Profile2 module?

There is a content type ("Job Listing") that a business account can use to list job openings, and a Profile2 profile for each business that contains the business's address, organization name and ...
6
votes
1answer
2k views

Insert images with Media

I am using Media and Wysiwyg with CKEditor to insert images in the post editing field, and for some reasons I keep getting this code instead of my images. Does anyone know how to fix it? [[ { ...
6
votes
1answer
515 views

One comment per user per node?

Does anybody know if there is any module or other way I can restrict each site user to making only one comment per node on my Drupal 7 site? I haven't found anything yet. Thanks! EDIT: I've accepted ...
6
votes
1answer
265 views

Latest Best Practise: Reusing content/functionality between Drupal 7 sites

Many of the Drupal 7 websites I make have the same functionality (e.g. blogs, news section, special offers). At the moment, I have to re-create the content types, fields, blocks and Views each time. ...
5
votes
5answers
4k views

Display comma-separated list of taxonomy terms?

Drupal 7. In my node.tpl.php, I want to print out a list of taxonomy terms (the taxonomy is called "channels."). If I use: <?php print render($content['field_channel']); ?> It works, ...
5
votes
4answers
1k views

Creating Nodes and Referenced Nodes at Same Time

I have a situation where I would like to be able to create nodes and referenced nodes at the same time. Are there any solutions for this that work well for this? To clarify what I am talking about, ...
5
votes
2answers
68 views

New “type” of node?

Not sure how to phrase this question but basically I'm creating an non-profit's internal portal within Drupal. They deal with school sponsorship of children and we want to manage this database in ...
5
votes
1answer
522 views

How to structure a “many-to-many” relationship between nodes

I would like to have 2 node types, Sellers and Products. Each seller can have many products, and each product can have many sellers. Also, the relationship between Sellers and Products would need to ...
5
votes
3answers
852 views

How do I output one node as XML

I am creating a page flip for a drupal site using pdf_to_imagefield module to export PDf to JPG and then I need to have the list of JPG files as XML to use them in Dynaimc page flip. The PDF and all ...
5
votes
2answers
2k views

How To Set Node Path/Alias Programatically

I am creating some nodes in Drupal 6 programatically by creating an empty object, setting some properties and calling node_save() on the object. When I print out the object again, I see new ...
5
votes
4answers
974 views

CKEditor generates <br /> when leaving a textarea field empty

I'm using CKEditor module with satisfaction, but it behaves really frustrating in one case: when leaving textareas empty, it generates <br /> tags in them after rendering CKEditor's interface. ...
5
votes
5answers
5k views

How can a user access only one specific node, and not all nodes of that type?

I have a user with view and edit rights to a specific content type. This give the privilege to all users to view and edit all the nodes of that type. But actually, I want to create for each user a ...
5
votes
1answer
1k views

How to programmatically duplicate a node?

I'm looking to create a copy of a webform I've made, with a new email address as the recipient. After I load the node with node_load, can I just save it with node_save? Will that create a new node ...
5
votes
1answer
155 views

drupal 7 programatically close comments in custom node type

I have created a content type programmatically. Also looked at http://drupal.org/node/1169864 but comments are not being close. Although I solve it by variable_set('comment_mynodetype', '1'). Any ...
5
votes
2answers
541 views

Programmatically assign a node to an organic group

How can I programmatically assign a node to an organic group? I have tried the followings and non of them worked (assuming $target_group is the group ID that I want the $node to be assigned to): ...
5
votes
3answers
537 views

Displaying node reference select list as ordered menu list

I want to display the Node Reference Select List (usually a long list of nodes, unordered and generally quite long) as an ordered bunch of nodes, that replicate the structure of the menu system. The ...
5
votes
2answers
99 views

How do I create additional fields in module.install?

I am creating a module in the ".install" file, using the following code: // if not exists, create new content type if (!node_get_types('type', 'houses')) { $info = array( 'type' => 'houses', ...
5
votes
2answers
959 views

batch importing node data — via database?

I'm looking to migrate an existing site to Drupal. I have a a content type on the new Drupal site that will eventually hold some 1500 nodes. Of course, I don't want to enter each one in the form on ...
5
votes
2answers
906 views

Update a view page content without refreshing the page

Is there a module that updates a view automatically when it is changed, without refreshing the view page? For example, when a new node is added to the view or deleted from the view, or a node is ...
5
votes
4answers
93 views

How to allow a client to do specialized styling for a single node?

I'm working on converting an existing website to Drupal, and I'm looking for best practices for creating specialized styling on specific nodes. I have a page that looks like this (baconized for your ...
5
votes
3answers
585 views

Drupal combine nodes and comments in view

I have a view with nodes of the type 'Note' (custom CT). I have A view with comments that are associated with those nodes. How can I combine these views into one view so that I can filter them ...
4
votes
4answers
4k views

Programmatically attaching files to a node in Drupal 7

I have created the "Gallery" content type, and added two fields: "photo," and "document." I then used the following code for uploading a file in the "document" field: $file = ...
4
votes
3answers
971 views

How to create a node programmatically in Drupal 7?

I know you can create nodes programmatically by creating a node object and then firing node_save() but I don't actually want to store the node in the database. Is there a way to create nodes of a ...
4
votes
2answers
2k views

How do you build a query to get a series of nodes and their field values filtered by field values?

Hopefully someone with Drupal 7 experience can point me in the right direction. I'm creating a custom module to query some nodes and group and sort them by their field values. I tried to use Views ...
4
votes
3answers
621 views

Mass Node Update (e.g., disable comments for all nodes of a given content type)

Is it possible to mass update nodes from, say, "Comments Read/Write" to "Comments Disabled" for all nodes of a certain content type? I changed the Content Type setting and that worked for all the ...
4
votes
2answers
2k views

Load node based on a field name

I have a content type that has a unique field. How can I load a specific node based on this? node_load() only takes the nid. I am using Drupal 7.
4
votes
1answer
2k views

How can I programmatically insert date field values?

I have a bunch of values from a .sql export that are in the datetime format (same format that date fields take in the DB). I'm creating nodes using these date values. How can I insert these values ...
4
votes
1answer
45 views

I want to create a new command for the nodes like the standard edit and delete

In drupal you have the standard commands edit and delete which you access typing : node/99/edit node/99/delete I want to create some other commands like : node/99/approve node/99/test ... Where ...

1 2 3 4 5 25