All Questions
8,185
questions
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 ...
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
...
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 ...
29
votes
4
answers
19k
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 ...
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'] <- ...
2
votes
3
answers
724
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 ...
153
votes
10
answers
212k
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 ...
5
votes
5
answers
977
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. ...
44
votes
9
answers
143k
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'...
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 ...
43
votes
10
answers
99k
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 ...
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 ...
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 ...
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 ...
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 ...
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.
59
votes
14
answers
126k
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 ...
25
votes
7
answers
23k
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?
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 ...
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 ...
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 ...
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(...
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
...
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 ...
54
votes
10
answers
14k
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 ...
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?
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 ...
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 ...
79
votes
4
answers
83k
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 ...
29
votes
3
answers
60k
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']);
?...
27
votes
5
answers
21k
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 ...
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?
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 ...
6
votes
2
answers
10k
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
...
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 ...
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) ...
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 ...
29
votes
3
answers
78k
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().
...
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 ...
18
votes
7
answers
43k
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
...
9
votes
4
answers
6k
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 ...
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.
...
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 ...
46
votes
15
answers
44k
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 ...
34
votes
4
answers
49k
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)?
15
votes
3
answers
25k
views
How can I implement AJAX form submission?
My task is to submit a contact form via AJAX and then to show a "Thank you for submission!" message, loaded in place where the form was. So I need to ajaxify existing contact form.
I found ...
14
votes
5
answers
21k
views
Changing url of exposed filter
When I used an exposed filter the filter selection is passed as name/value pair in the url, for example:
members?field_a=valuea&field_b=valueb
How can I set it up to use more of a "pathauto" ...
9
votes
2
answers
8k
views
Change a normal submit 'input' type to 'button' type with button tag
Is it possible in Drupal 8 to change a regular form submit button from Drupal into a button tag?
This is the output I need to achieve:
<button type="button" class="search-box__button">
<...