We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [7]

Version tags should be used only for questions that apply to a version only, not to merely say what version a site is using.

Filter by
Sorted by
Tagged with
7
votes
6answers
11k views

How can I import and export Drupal Commerce Products?

I have a Drupal 7 site and installed the Drupal Commerce module. In which I have added Commerce Product with Category like: Software Products Hardware Products Electronics Others I would like to ...
5
votes
5answers
22k views

How do I programmatically create an entity with its fields?

I'm using Entity API to work with some entities but I cannot figure out how to create a new entity with its fields attached. I created a bundle and added some fields to that bundle. I'm looking to ...
4
votes
3answers
5k views

create drupal 7 webform programmatically?

I have already created a webform and I need to fill it programatically. how can I create webform ? Can i create it like node creation: $node = new stdClass() $node->type = 'webform' $node->...
20
votes
4answers
18k views

How to override some admin theme CSS rules? [closed]

Is there a way to override just some CSS rules used by the admin theme, without touching the admin theme itself (via some theme functions or module hooks)? For example, I'd like to add a text-align: ...
16
votes
7answers
7k views

How can a module detect when the “access denied” page is output?

How is it possible for a module to detect when Drupal is outputting the "access denied" page? I know how to do it with Drupal 6; I need to know how to do it with Drupal 7.
10
votes
7answers
13k 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, ...
10
votes
2answers
9k views

How to define and use an external database connection in a custom module

I'm developing a module that will rely heavily on external database queries. Is there a best practice for defining and using an external database connection throughout a module? This page tells me ...
9
votes
3answers
4k views

How to display a flag to anonymous users?

I'm using the Flag module, but I have a problem in displaying a flag to anonymous users. I have 2 flags called "make feature" and "add to Favorites". I want to display this flag to anonymous users ...
9
votes
2answers
6k views

Remove the 'read more' and 'Add new comment' links on the home page

How do you remove or modify the list of links shown after the content?
8
votes
3answers
3k views

Issue a html.tpl.php override from a module?

Is there a way to override the output of a page from a contributed module and issue your own html.tpl.php, effectively taking control of the output from the theme? I want to do this in effort to ...
8
votes
1answer
12k views

How do I create a static block programmatically?

I want to create a static block using a module. I do not want to use the Views module to create a block. Could anyone explain me how to create a static block programmatically? I have already checked ...
7
votes
9answers
15k views

How to change a field type from Integer to Decimal?

I have a content type with an integer content field. The field needs to contain float data. What's the easiest way to change the field type from integer to decimal? (There are thousands of existing ...
7
votes
5answers
7k views

Changing an inner join to a left join in views 3.3?

Using views 3.3, I have a view in Drupal 7 where I am showing two content types. I have a filter criteria based on the value of a field that is attached only to one of the content types. So long as I ...
4
votes
2answers
3k views

How to debug a rule that doesn't want to fire?

I have nodes that can be flagged with a global flag. When a node is updated I want a rule to unflag that node. Rules Event: After updating existing content Rules Action: Unflag a node. I then ...
3
votes
5answers
13k views

Ckeditor doesn't work

I have 2 drupal sites, both using Drupal 7. How can I add the full HTML format, and attach CKEditor to it?
3
votes
2answers
5k views

How to trigger Ajax forms machinery

I'm working on ajaxifying a form which uses Hierarchical Select widget. I need to update a text field based on the value of HS and a couple of other fields. I want to use Drupal forms Ajax API. I ...
3
votes
2answers
2k views

How to create (& pre-populate) multiple “field collection” fields on an ajax call

This is an extension of this question - "How to pre-populate multiple "field collection" fields in node form" I'm trying to do the same thing, but I'm trying to get it to work on an ajax ...
18
votes
7answers
6k views

Change the input format for 3000+ nodes

I have a lot of nodes that need to get their input format changed - I could do that by hand, but then I won't be done before Christmas 2014. Where is Drupal storing that information? How can I ...
9
votes
2answers
956 views

“changed by” on nodes

mysql> select nid, uid, created, changed from node; +-----+-----+------------+------------+ | nid | uid | created | changed | +-----+-----+------------+------------+ | 1 | 8 | 1336040166 |...
7
votes
3answers
4k views

In hook_user_login is there a way to know if this is the first time the user has logged in?

I'm overriding hook_user_login to redirect users to a specific page when they log in. The problem is I'm using the verification email setting on registration which requires the user to set their ...
7
votes
2answers
3k views

Public and temporary files error in my “Status Report”

I just upgraded to 7.25 from 7.19, and now in my Status Report I have a red X on my "Public Files" and "Temporary Files". See http://drupal.org/SA-CORE-2013-003 for information about the ...
5
votes
5answers
23k views

Display node as a popup window

I am new to Drupal. I have a form which adds details of user to my table. I want to display that node in a popup window. How would I do this?
4
votes
2answers
4k views

Add properties to an entity hook_schema_alter

I need to implement a custom module that adds fields and properties to an entity defined in another module. I felt the best way to do this was using hook_schema_alter and hook_update_n to achieve the ...
4
votes
3answers
8k views

Path alias tokens and node references

I'm trying to figure out if path aliases are even capable of what I'm trying to do, or if I need some other sort of module. I have a content type "project" and a content type "mockup". A "project" ...
18
votes
2answers
12k views

How to prevent user registration

I'm getting a couple of user registrations on my personal website (presumably from bots or people trying to hack my site). How do I disable new user registration entirely?
4
votes
6answers
7k views

How to hide default “N/A” option for checkboxes?

I have a "gender" (checkbox) option that I want to show on the user profile page (but not on the registration page). The options are "Male" (default) and "Female". Since I don't make the field ...
3
votes
2answers
3k views

Need to redirect the non-existence URL's to 404 page instead of parent url

This is in connection to drupal.org issue #432384. That's when I happen to request for page "node/1/aaa/bbbb", I'm served the response for "node/1" (it's parent page). I can understand, this is the ...
2
votes
1answer
575 views

How to revoke edit access to the node's author after publishing a node?

I am trying to build a new rule on Drupal 7 with both the Rules and Content Access modules (and its sub module Content Access Rules integration). Thus, I get new actions like "grant or revoke an ...
2
votes
9answers
11k views

Render form in template

I have made the following .tpl.php template: <?php print drupal_render($element["term"]); ?> <?php print drupal_render($element["search"]);?> <?php print drupal_render($element["...
1
vote
1answer
1k views

Optionally add image/icon after node title based on boolean content type field?

Using Drupal 7.10 with a Zen sub-theme. I have a custom content type, say Product. The products have titles such as "Wrench", "Hammer", "TV". I want to designate certain products as being a ...
9
votes
1answer
4k views

Do not translate the admin area / How can I set the language of the admin area to English?

I am building a multilingual site with 3 languages. Lets say English, Italian and German. English is the default language. Is it possible to leave the admin area untranslatable, even I am currently ...
8
votes
4answers
10k views

Unable to generate the derived image

Today I uploaded my site to the server, and I get errors like the following: Unable to generate the derived image located at public://styles/sponsor_image/public/TerraThermaSponsorLogo.png. Image ...
4
votes
4answers
5k views

After logging off, a user is able to see the pages by pressing back button of the browser

I have a requirement in which the user should not be able to see the books in the site unless he is logged in. And the user is not able to see the content. The problem is when a user logs in, views a ...
4
votes
0answers
821 views

How do I suppress a warning or error message for site users? [duplicate]

file_unmanaged_copy() drupal_set_message() on certain conditions. Even with visible errors messages disabled, anonymous users see this. Indeed, the comment in the code even has a TODO to change it to ...
4
votes
3answers
1k views

PHP in database: bad practice but

Lots of times here I've been told that using views custom php fields, filters or others is a bad practice, because putting php in the sql is dangerous. My question is, if you only call to a function, ...
2
votes
1answer
3k views

Filename for the front page template file

How do I create a theme for the front page only? I only want to change what is in the content area but leave the rest of the stuff the same from page.tpl.php.
2
votes
2answers
234 views

Custom Login form question

In my website have two types people login one is designer another is reader, i want people come to login my website by role. Mean designer go to design login form to login. Reader go to reader login ...
1
vote
1answer
323 views

How to add a column to the list of group members or create a Views equivalent of it?

I use the "Group" module and I want to add a column "Email Address" on the page that lists the members of the groups (I want to put this "Email" column between the column "member name" and the column "...
1
vote
2answers
83 views

How to grant userpoints only for modifying nodes last changed at least 20 days ago?

I am not sure how to go about this. I use the Userpoints module in Drupal 7 to attribute points to users who create nodes ('reviews'). I also want to allow them to gain some points if they supersede ...
1
vote
1answer
754 views

How to make menu badges count disappear after the page is viewed?

With reference to my previous question which was a little confusing or I should say it was mixed up with two different problems. I am posting my question again with clarification. I have created a ...
1
vote
1answer
109 views

Cannot login after moving site [duplicate]

I am in the process of recovering from a catastrophic hard disk failure on a completely new machine. I am fortunate to have both a database backup and a backup of the folder with the D7 code that was ...
35
votes
2answers
24k views

Difference between Minimum cache lifetime and Expiration of cached pages

On Drupal Performance Page, under the fieldset Cache you have two options. One is Minimum Cache Lifetime and the other is Expiration of cached pages. What is the difference between these two.
31
votes
4answers
48k views

How to use drupal_mail() to send emails with custom template

I would like to use the drupal_mail() function to send out emails but with a custom HTML template so that they are in keeping with my website design but I am a complete newbie to hooks and modules etc....
25
votes
5answers
35k views

How to send HTML email

I am creating a simple module which will be sending HTML emails to users for deals in our website. I have searched a lot, but I can't find a solution proper solution for Drupal. Now I can send mails ...
41
votes
11answers
28k views

How to display a field before node title?

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 ...
27
votes
6answers
15k views

Debug EntityFieldQuery?

I have a module which is misbehaving. An EFQ is returing unexpected results, but I can't see why just by looking at the code. Is there a dpq() equivalent for EFQs? Other ways of debugging them?
16
votes
3answers
28k views

Best APC settings to reduce page execution time

I have Drupal 7, apc with php-fpm and apache behind varnish and512 MB RAM. I measure page execution time with devel module. Database query time is low (62ms) compared to page execution time which is ...
35
votes
11answers
34k views

Get all users with specific roles using EntityFieldQuery

I thought this was an easy task, yet there does not seem to be a Drupal-method for this. I came as far as knowing I have to use EntityFieldQuery for this - because the API said conditions for ...
32
votes
18answers
38k views

How to hide Input Format Options and help text under a textarea?

How to hide Input Format Options and help text under a textarea when adding|editing a node?
28
votes
5answers
21k views

How do I override a taxonomy/term/% list with a view?

I have a vocabulary attached to a content type. Only one term can be selected to categorize a node made with this content type. The vocabulary is called Vehicles and has terms 'cars, trucks, boats.' ...