All Questions

Filter by
Sorted by
Tagged with
98 votes
7 answers
15k views

What are the downsides of using PHP Filter code in blocks, nodes, views-args, etc?

I have seen many times people saying not to use custom PHP/PHP filter (from the Drupal UI) in blocks, nodes, views-args, rules, etc. I have searched around a bit and haven't found much, it seems like ...
Laxman13's user avatar
  • 6,815
21 votes
6 answers
18k views

White screen of death: Fatal error: Allowed memory size of X bytes exhausted

I have a issue with my Drupal installation, for example: when I enable or disable the modules, It redirects me to a blank page, when I create a new content type and save it, redirects me to a blank ...
Jayaram's user avatar
  • 791
6 votes
1 answer
3k views

What are the various roles supported by the Group module?

The Group module is an alternative for Organic Groups. For each group you can specify appropriate permissions, and this for various "roles" that are specific to the Group module (these roles are not ...
Pierre.Vriens's user avatar
29 votes
4 answers
20k views

Database general error: 2006 MySQL server has gone away

Recently I started getting an error every time I try and add a content no matter what type. This is the error that shows up in the browser: Additional uncaught exception thrown while handling ...
Mike2012's user avatar
  • 1,761
41 votes
1 answer
6k views

Why is hook_form_alter() so messy?

Here's an example I just ran into. I'm trying to put some HTML in the label of my field. $form['field_feedback']['und']['#title'] <- has the title $form['field_feedback']['und'][0]['#title'] <- ...
Joren's user avatar
  • 2,440
2 votes
3 answers
738 views

How can I display the value of a variable inside a condition?

I have created a rule using the Rules UI. My rule is not working, and I need to debug it, displaying the values of my variables inside a condition where I make a comparison. I see within Rules ...
bunset's user avatar
  • 131
153 votes
10 answers
214k views

What are the recommended directory permissions?

I'm gearing up to deploy a Drupal 7 site and I can't find any documentation. What are the recommended security-conscious permissions for files and directories? I am specifically interested to the ...
ack's user avatar
  • 2,149
5 votes
5 answers
994 views

How to stop a Views block from displaying to administrators, such as user/1?

I created a view and put an access role of anonymous user. When I log in with normal user account I don't see it, but when I log in with my admin account I see the view. I would like to not see it. ...
No Sssweat's user avatar
  • 31.3k
45 votes
9 answers
153k views

How do I get the raw field value in a twig template?

myfield is a plain text field. {{ content.field_myfield }} renders the field with HTML markup and the field label. How do I render the raw value of the field? {{ content.field_myfield.value }} doesn'...
Pim's user avatar
  • 1,055
5 votes
1 answer
3k views

What's the alternative to using the Conditional Rules module?

The Conditional Rules module allows for including Rules Conditions within Rules Actions (using its If/Else constructs), something you cannot do by only using the Rules module. Here are just a few (out ...
Pierre.Vriens's user avatar
45 votes
10 answers
104k views

How can I programmatically display a block?

I'm developing a site using Drupal 8 beta-14. I've created a view block of different terms and now I want to display it using code. How can I display it programatically? I used to do it in Drupal 7 ...
rashidkhan's user avatar
40 votes
7 answers
14k views

Drupal SA-CORE-2014-005 - How to tell if my server / sites were compromised?

I just updated all my sites using the patch method of resolving the Drupal SA-CORE-2014-005 exploit. I just read reports that just yesterday there is someone from a Russian IP infiltrating drupal ...
Patoshi パトシ's user avatar
111 votes
2 answers
68k views

Contextual filters taxonomy name

I'm adding a contextual filter to a view for a custom content type that has a taxonomy field. The contextual filter allows me to filter by the taxonomy tag id but not by the taxonomy tag name. Meaning ...
powers1's user avatar
  • 1,253
125 votes
14 answers
19k views

What is the basic concept behind hooks?

I am intermediate in PHP. To polish my skills I start learning Drupal 7. While learning Drupal architecture concepts, the terms hooks and bootstrapping puzzled me a lot. I read the "Pro Drupal ...
GiLL's user avatar
  • 1,733
57 votes
2 answers
21k views

What are Ctools plugin (content type, access, etc), and how does one create them?

What are Ctools plugins, and how does one create them?
9 votes
10 answers
13k views

Unable to send e-mail. Contact the site administrator if the problem persists

When my web form is filled and submitted, I get redirected to a page that says: Thank you for submitting. but theres a red warning box there that says: Unable to send e-mail. Contact the site ...
saadlulu's user avatar
  • 1,760
108 votes
1 answer
44k views

How should I implement hook_menu()?

What are the fundamentals of implementing hook_menu()? I would like to see the basics covered in a single question, to avoid having to answer the same similar but different questions over and over.
62 votes
14 answers
136k views

How to get the valid URL of a Link field from within a Twig template?

I have a Link field named field_my_link (machine name). Within a Twig template I can get the link's URL value with this: {{ node.field_my_link.uri }} If inside the Link's URL there is an external ...
Andrea's user avatar
  • 1,267
25 votes
7 answers
24k views

How to see the error messages when I get the white screen of death?

How can I see the error messages when the site I am working on gets a white screen?
Dion's user avatar
  • 2,398
21 votes
5 answers
6k views

Is displaying a working Field Widget Form on its own possible?

I'm interested in embedding a Field Widget Form out side the context of the whole node edit form. I have displayed full forms in the past using drupal_get_form but that doesn't seem to apply for ...
SMTF's user avatar
  • 946
5 votes
3 answers
1k views

How to restrict access to a node via node/12 and allow access via a path like content/sometitle?

Problem: I want to restrict direct node access using node number www.example.com/node/12 and allow access using pathauto alias www.example.com/content/sometitle to anonymous user. This user should be ...
suneel's user avatar
  • 51
30 votes
5 answers
58k views

Dynamic select list in the form (dependent dropdown)

I'm using Drupal seven. I want to make the options in a select list be dependent on the value chosen in another select list in a form. I'm sure this has been asked many times before, but I am having ...
Ben's user avatar
  • 1,030
16 votes
4 answers
14k views

Properly bootstrap drupal for standalone PHP file?

This is what I have right now: <?php define('DRUPAL_ROOT', '/var/www/clients/client1/web15/web'); include_once(DRUPAL_ROOT . '/includes/bootstrap.inc'); drupal_bootstrap(...
Joren's user avatar
  • 2,440
8 votes
2 answers
6k views

What are the features of the Group module versus Organic Group module?

To create groups in Drupal we have at this moment the Group module and the Organic Groups module. From the Group module page: The Group module allows you to create arbitrary collections of your ...
Adrian Cid Almaguer's user avatar
6 votes
1 answer
3k views

How to create a node from a Webform using rules?

I want to create a node based on a webform data using the Rules module. This is because of a complication surrounding relationships within the associated CRM system. I am already at the point where ...
Darren Whittenham-Gray's user avatar
54 votes
10 answers
15k views

How do you improve Drupal performance?

Drupal is fast at develop, but the performance is so poor. It is hard to reach 50 request per second. And there are so many SQL queries in a simple web page. If you test the request time of a form ...
Bruce Dou's user avatar
  • 655
34 votes
5 answers
33k views

Node count for taxonomy terms

How can I display the node count values for taxonomy terms with sorting the result list in descending order of node count?
ya.teck's user avatar
  • 5,642
6 votes
4 answers
2k views

How to prevent a node being saved when using the Rules module?

Is it possible to prevent a node from being saved with Rules? This is what I do now: Create a rule Before saving content of type ''. Condition: IF ... TRUE => Redirect & set message Create a ...
nielsv's user avatar
  • 786
5 votes
1 answer
3k views

How can I compare data comparison with values submitted in a webform?

I am trying to use webforms with the Rules module. How can I compare data with the values submitted in a webform ? For example, if the webform has a yes/no radio button, how can check the submitted ...
Ryan Hepple's user avatar
81 votes
4 answers
87k views

What does "The provided host name is not valid for this server" mean?

I am running a Drupal 8 website, and when I browse to any page, I get a plain white page with just the following error message on it. The provided host name is not valid for this server. What does ...
50 votes
12 answers
22k views

How do I hide 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 ...
Chaulky's user avatar
  • 6,453
29 votes
3 answers
62k views

Programatically render a block in a twig template

I need to render a views block in my page.html.twig template. In D7 I would do this: <?php $block = module_invoke('module_name', 'block_view', 'block_delta'); print render($block['content']); ?...
Rick Bergmann's user avatar
27 votes
5 answers
22k views

Using OR with EntityFieldQuery

I have never had the need to do this before today, but it doesn't seem like you can make OR queries with EntityFieldQuery, since db_or is used for select queries. An example would get to all entities ...
googletorp's user avatar
  • 35.4k
17 votes
2 answers
45k views

How do I apply a patch file? [closed]

I downloaded a patch file from mailhandler module and need to apply the changes in order to fix the problem of pop3 accounts not deleting emails after download (import). How do I install it?
Q Beat's user avatar
  • 417
16 votes
6 answers
3k views

Why don't we hack core?

I couldn't believe that this question hasn't already been answered on this site, but I didn't find it when I searched, so... Why is it such a bad idea crime against nature to hack core? Is it really ...
beth's user avatar
  • 9,087
6 votes
2 answers
11k views

How to safely render node body on a custom variable?

I created a custom template for my programmatically created block. I defined a variable for the template called test so in my render array I have '#test' => $node->get('body')->value ...
No Sssweat's user avatar
  • 31.3k
1 vote
2 answers
2k views

How to specify a Rules event like "Content is 'going to be' viewed"?

To answer the question about "How to restrict access to a node via node/12 and allow access via a path like content/sometitle?", I thought it should be possible to use the Rules module to do so. I ...
Pierre.Vriens's user avatar
0 votes
1 answer
1k views

How to make the permissions of a module more granular?

Assume a (contributed) D7 module, say module ABC, comes with only a few permissions (which can be set on the typical /admin/people/permissions page). For example: Administer module ABC. Access (view) ...
Pierre.Vriens's user avatar
35 votes
2 answers
63k views

Custom validation for a form?

I need to add custom validation to a form, lets says add article form. I was expecting something like hook_FORM_ID_validate() to handle this, but cannot find anything relavant in the API ...
gilzero's user avatar
  • 6,037
29 votes
3 answers
82k views

Add a custom submission handler to a form

How can I add a custom form submission handler? I tried adding $form['#submit'][] = 'mymodule_form_submit'; or $form['actions']['submit']['#submit'][] = 'mymodule_form_submit'; to hook_form_alter(). ...
Yuseferi's user avatar
  • 22k
27 votes
9 answers
84k views

How can I find the form ID of a form?

How do I get the form id of my form? I've just begun to make my modules and I'm at a standstill. I got this code from someone else and am trying to customize it: function hook_form_alter(&$form, &...
enchance's user avatar
  • 2,049
20 votes
4 answers
59k views

How do I simply make the whole site use a secure connection? [closed]

In Drupal 7, I used the Secure login module to run the site on a secure connection, but it seems it doesn't revert back to http on logout. I would like to just run the whole site as https:// as a ...
Paul Connolly's user avatar
19 votes
7 answers
45k views

How do I programmatically log in a user with a POST request?

Do anyone have a working REST Login on Drupal 8? This is what I tried. POST /user/login HTTP/1.1 Host: 8.d8.local Content-Type: application/x-www-form-urlencoded Accept-Encoding: http://nikhilmohan.in ...
niksmac's user avatar
  • 7,692
9 votes
4 answers
7k views

PDOException when creating the table: Base table or view not found [closed]

I have Drupal running on MariaDB 5.5.33. When I run update.php (after upgrade to Drupal 7.28 from Drupal 6) I get an error: Failed: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 ...
Tilia's user avatar
  • 233
2 votes
1 answer
1k views

Rule to store user's last post date and scheduled rule based 30 day reminder

In this scenario, user's can post 1 node of a specific content type every 30 days (interval changes depending on user role). We are using node_limit to accomplish this; it's doesn't play with rules. ...
Sam Roy's user avatar
  • 53
51 votes
7 answers
64k views

How to a use a template file to theme a form?

While nodes, comments, blocks and many other things in Drupal are themed using theme template files (like node.tpl.php), forms are a different story. There are no theme template files for forms. How ...
Chaulky's user avatar
  • 6,453
46 votes
15 answers
46k views

How do I remove a configuration object from the active configuration?

I'm writing a custom module for Drupal 8. It defines a field storage configuration object, in a file called modules/mymod/config/install/field.storage.bloom_stem.bs_twitter_ac.yml. The problem is ...
artfulrobot's user avatar
  • 4,019
34 votes
4 answers
50k views

How do I update jQuery to the latest version I can download?

I'm using Drupal 7, which uses jQuery 1.4 as default? How can I update it to the latest version (currently 1.7)?
Karmacoma's user avatar
  • 1,043
29 votes
3 answers
9k views

How can I programmatically change the active theme?

How can I programmatically change the active Drupal 8 theme? In Drupal 6, we used the following code. global $custom_theme; $custom_theme = 'garland'; In Drupal 7, we used hook_custom_theme(). In ...
visabhishek's user avatar
  • 1,346
19 votes
19 answers
34k views

Redirect after user login

I would like to redirect users after they log in. Is it possible to use hook_user_login() to make the redirection? How do I add the parameter for the redirection?
johnchan's user avatar
  • 371

15 30 50 per page
1
2 3 4 5
165