All Questions

96
votes
6answers
14k 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
6answers
17k 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 ...
24
votes
3answers
12k 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 ...
5
votes
1answer
2k 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 ...
41
votes
1answer
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
3answers
539 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 ...
4
votes
5answers
482 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. ...
142
votes
11answers
183k views

What are the recommended directory permissions?

I'm gearing up to deploy a Drupal 7 site and I can't find any documentation about what are the recommended security-conscious file and directory permissions should be set. Specifically default/files/ ...
40
votes
7answers
13k 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 ...
5
votes
1answer
2k 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 ...
25
votes
7answers
20k 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?
120
votes
14answers
17k 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 ...
8
votes
9answers
6k 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 ...
106
votes
3answers
66k views

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 ...
56
votes
2answers
20k views
102
votes
1answer
40k 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.
29
votes
9answers
44k 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 ...
21
votes
5answers
5k 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
3answers
874 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 ...
27
votes
5answers
54k 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
4answers
13k 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(...
21
votes
3answers
45k 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'...
54
votes
10answers
11k 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 ...
52
votes
13answers
20k 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 ...
32
votes
5answers
30k views

Views and node count for taxonomy terms

How can I display the node count values for taxonomy terms in Views? with sorting the result list in descending order of node count.
25
votes
5answers
19k 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 ...
5
votes
1answer
2k 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 ...
8
votes
2answers
4k 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
3answers
1k 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 ...
15
votes
2answers
32k 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?
17
votes
6answers
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 ...
0
votes
1answer
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) ...
6
votes
1answer
2k 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 ...
40
votes
12answers
25k 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 ...
33
votes
4answers
39k 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)?
13
votes
3answers
16k views

How can I implement AJAX form submission?

My task is to submit contact form via AJAX and then to show "Thank you for submission!" message, loaded in place where the form was. So I need to ajaxify existing contact form. I found some examples ...
25
votes
5answers
41k 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 ...
26
votes
2answers
52k 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 ...
8
votes
4answers
4k 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 ...
1
vote
2answers
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 ...
35
votes
3answers
42k views

how to send variable from .php file to .js file?

I hope someone is able to help me. The problem is the following one: 1)I have module in which a assign the variable in order to send to the template file php.tpl <?php ... $testvar="Hello from ...
2
votes
1answer
879 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. ...
49
votes
7answers
57k 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 ...
27
votes
3answers
36k 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']); ?...
26
votes
5answers
35k views

Easy way to create blocks programmatically? [closed]

Learning Drupal. I know now that I can create block through the backend, but I would rather precreate them programmatically, if it's possible. In fact I'm pretty sure that it's possible. But what's ...
22
votes
5answers
22k views

Drupal 7.20 Image Styles return a url with Access Denied

I'm using the Insert module to allow users to insert images with a specific image style into a page. After upgrading to Drupal 7.20, the images are not stored in the files/styles folders, and the ...
6
votes
2answers
4k views

How to use the Rules module to implement a custom redirect for an outdated URL?

I used to show content from a catalog via the Views module, accessing an external database, so that all of the URLs would be something like /content?name=[name]. For various reasons, I've opted to ...
6
votes
2answers
2k views

How to create a basic message - notifications system displaying a real time message counter badge? [closed]

I'm looking for a way to create a basic current user notifications system for my site, e.g.: "some user" has created a new "group" "some user" has joined your "group" "some user" has posted a node in ...
1
vote
1answer
419 views

How to set multiple values to an unlimited Term Refence field with Rules

I have two content types: Ingredient and Recipe Sheets. Both Ingredient and Recipe Sheet have a term refence field called Allergens. Ingredient has the Allergens term reference field filled in. IE: ...
2
votes
1answer
253 views

Which user related token(s) can be used to create a Rule for setting up a message type?

I have created few activity logs using the Message module. All works ok, but when I try to create a message type for example "username started following you on github". When setting up the rules for ...

15 30 50 per page