Questions tagged [7]

Version tag to tag issues specifically related to Drupal 7.x. Please note that 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
31
votes
8answers
18k views

How to make a form required with states?

I have a drop down list that displays various fields based on what is chosen and I know that I can toogle the visibility with states but when I try to use required the * span is display but it isn't ...
8
votes
2answers
17k views

How can I display a change password form on its own?

I have a need to place a user's password reset form in areas outside the context of the user edit page. This Change Password module looked promising; however, it is only available for drupal 6 and ...
39
votes
1answer
18k views

Managed file: the file used in the field may not be referenced

I am having some issues with the managed_file type. Whenever I try to edit and save a form that has a managed_file element in it an error occurs: The file used in the Picture field may not be ...
24
votes
5answers
15k views

Expose single filter of combination of two fields in views

I have two user profile fields "Last Name" and "First Name". I also have a user list views. I want to expose "Name" as filter which can search for both Last Name and First Name. How can I do single ...
11
votes
5answers
34k views

how to use hook_views_query_alter() to modify where condition?

I'm trying to modify the where condition of a views query. till now I was successful with altering "order by", but I have no idea how to alter the where condition. I want to check the search_term and ...
19
votes
4answers
9k views

EntityFieldQuery vs Db_select()

Why should I use EntityFieldQuery when I can do the same work with Db_select() to fetch the value. It would be better if someone can provide an example, not only a link.
19
votes
7answers
12k views

fast saving single field value

I've got around 70k nodes of specified type on my site. I need to run an update on them. Some operations and setting one field to desired value. node_save is really slow and it causes crashes (too ...
18
votes
3answers
22k views

Filtering on node whose user ID is equal to the current user

In Drupal 6 you can have a filter node.uid = current user. How do you do this in Drupal 7?
13
votes
2answers
5k views

Override field template with custom module

Instead of adding tpl files (in this case, media-youtube-video.tpl.php) to the theme. How can I override field templates from a custom module? Including when the field is used in a View.
10
votes
5answers
18k views

How to get the translated term name by tid?

I'm looking for a working method to get the translated term name by tid. The following code returns the original term name but not the translation. global $language; $lang_name = $language->...
7
votes
1answer
3k views

How to implement a multi step approval with webforms/entityforms based on form components?

Is it possible to invoke multi-step submission workflow using either Webform or Entityform? Here is the scenario of workflows: An employee submits the form Superviser gets notification,...
3
votes
2answers
5k views

How to show the count of members that belong to a group?

I have a view showing a list of nodes of type group. How do I set it up to show the count of members that belong to each group?
3
votes
4answers
11k views

views and contextual filters with entity reference field

how do you use contextual filters to a views block when you want to use a reference field from the content type displaying the view? here's the simple scenario artist content type has some basic ...
9
votes
3answers
9k views

Can I use ajax to target multiple form elements from one input?

I'm trying to use ajax to update two different parts of a drupal form from just one form input blur. I have the standard ajax stuff on my input: $my_form['my_input']['#ajax'] = array( 'callback' =&...
8
votes
4answers
13k views

How to define Meta tags on Views? [closed]

Is there any module or some configuration that I can define the meta tags for the views page display in drupal 7 using Views 3.0?
1
vote
1answer
3k views

How can I display a picture from a field as the user picture rather than the drupal default with user-picture.tpl.php?

Because my site requires user pictures to be approved, the default Drupal user picture is not suitable. Instead, I want to show a picture from a field in each user's profile as the user's profile ...
0
votes
1answer
333 views

How to show authorized users a link for relevant Views results using the Rules Link module?

Assume a list of entities, created by the Views module. For example a list of "All blocked/active users" which looks like so: User name Active Created date Last login Hillary.Trump No ...
18
votes
5answers
8k views

How to Filter view by comparing 2 fields. If field-a < field-b

I have a product content type that has 2 price fields. I want to create a view that shows all products where price-A is less than price-B. I was hoping I could just add a filter and select price-A ...
8
votes
3answers
8k views

Listing entity fields

I wonder if there is a good, and easy way to get all fields of an entity. I have a taxonomy vocabulary. Its terms have a special field I want to make list in a select box in one of my modules, so ...
1
vote
2answers
639 views

How to concatenate all token values of a list in a single field within a Rules loop?

I am attempting to send a list of uploaded files on a newly created node via email. In a content type, I have a File Field that allows unlimited values. Within Rules, I created a loop calling the ...
1
vote
2answers
4k views

drupal /?q=user is working but /user not working

I have recently moved my files from dev server to test server. same setting and db of dev server were copied to test server. In dev server all is working fine but when I have am checking in test sever ...
0
votes
3answers
767 views

How can I set a reminder for a specific user to be triggered on a specific date?

How can I set a reminder for a specific user to be triggered on a specific date (in a Drupal 7 site)? Example: I want to remind the user regarding particular event such as hepB vaccination day. Any ...
15
votes
2answers
6k views

Need a simple Google Maps solution; lost in the labyrinth of modules

First of all, let me just state that I don't care which version of Drupal I'd have to use (6 or 7). I have experience with both versions I just didn't need to work with Google Maps till now. The ...
29
votes
2answers
23k views

How to create test_endpoint?

I am new to drupal and I am using services module for using REST and RESTWS module. I used RESTWS and could get the content of the node by http://base_url/node/1.xml and now I need to add a node ...
37
votes
4answers
21k views

What is the template suggestion for node 'teaser' view mode?

node--[type|nodeid].tpl.php targets to node's default view mode. However I want to override the template for teaser view mode. What is the template suggestion (.tpl.php file) for 'teaser' view mode?
19
votes
3answers
8k views

How does the batch API work internally?

I ran into a timeout issue using migrate the other day and started to wonder how the Batch API works internally. The way I understand it is that in its simplest form you'll pass an array of values (...
19
votes
4answers
12k views

Programmatically creating an order in Drupal Commerce for anonymous users redirecting to payment page

Ryan has some great code that you can programmatically create an order <?php global $user; $product_id = 1; // Create the new order in checkout; you might also check first to // see if your user ...
12
votes
1answer
14k views

How to set Media Styles in Media 7.1.2 / Media 7.2.X?

Where is the latest form of the component in the Media project family that allows styles to be defined for Media files? I see a lot of references to the idea that the Media module contains, once ...
23
votes
5answers
23k views

Get the actual query executed by a view

I need to find out the SQL query that is executed by a certain query. Views module can show the SQL when configuring the view but apparently the query is not the actual query that gets run in all ...
30
votes
3answers
37k views

Count results in Views using aggregation [closed]

Is it possible to count results (e.g. count the nodes of the content type x) in a view, using aggregation (not programmatically)?
25
votes
5answers
21k views

Preprocess function per content type

I have a couple of content types which I need to preprocess in different ways. So template.php in my theme foo currently looks like: function foo_preprocess_node(&$variables) { if ('news' ==$...
20
votes
3answers
16k views

specify $form elements to be excluded from display?

I want to hide certain elements in form using form_alter or a template file. I have read somewhere that in Drupal 7 , we can specify $form elements so it will not display in form, but I can't remember!...
14
votes
2answers
4k views

How do I set my views to return a 404 using Global: Null under contextual filters?

Standard Drupal behavior is to pass all arguments through, whether or not they requested. Sometimes this behavior is desired. However, I need to return a 404 for anything but a query string. Example ...
12
votes
3answers
17k views

Page template suggestions are not working

I've created a theme and have my template files in this structure /templates/page/page.tpl.php /templates/page/page--node-type.tpl.php I've created a custom page template but for some reason it's ...
21
votes
2answers
15k views

EntityFieldQuery INNER JOIN

I'd like to run a query using the EntityFieldQuery object. I need value from both the node and node_access table therefore I'd need to use INNER JOIN. From the d.o documentation I can't figure out how ...
17
votes
5answers
12k views

After deleting all nodes, how do I reset the node ID to start from 1 again?

I generated tons of dummy content for testing, and then deleted them all. As nid is auto-increment, newly created node will have a nid of last created nid +1. How can I make nid start from 1 again?
32
votes
7answers
108k views

How do I silence PHP errors?

Is there a way to silence all PHP errors, warnings and notices in Drupal? They are usefull on the devel site but they are a big security risk, and make the site look bad on live. I know on Drupal 6 ...
20
votes
3answers
18k views

Form Redirect not working if 'destination' is in URL

In one of my forms, I'm trying to set a $form_state['redirect'] so the form will go to that destination after the user clicks one of the action buttons. If I inspect $form_state['redirect'] both ...
5
votes
2answers
14k views

Show all child nodes of a taxonomy term D7 [duplicate]

Ok, so I've been ripping my hair off for the past 2 days now. I'm developing a web-site with a car catalog which contains the following hierarchy (taxonomy hierarchy): -brand1 --model1 --model2 --...
3
votes
1answer
12k views

How to theme webform elements (radio buttons etc.)?

I would like to know how to theme Drupal 7 Webform elements? I want to change the HTML structure of every element, not just wrap form with div or something like that. And I want to leave theme's ...
31
votes
7answers
22k views

Excluding empty(Null) fields when using EntityFieldQuery query condition

Is it possible to select all of the entities who's xyz field is empty? I tried soemthing like this: ->fieldCondition('field_name', 'value', NULL, 'IS NOT NULL'); However, this doesn't seem to ...
27
votes
11answers
57k views

“The website encountered an unexpected error. Please try again later.”

I have this error with Drupal 7 how can I have some more information about this error ? Any report, any log anywhere ? Nothing in php errors. how can I disable that message and have a more useful ...
22
votes
2answers
11k views

how drupal decide execution order of same hook in different modules?

if there is two modules A and B and both have same user_login hook. so when i log in. out of A_user_login() and B_user_login() function which one called first.and how drupal decide execution order of ...
21
votes
10answers
40k views

List of all active modules used in a site

Is there a way of having a list of all the used (active) modules on a site ? I am in the process of documenting a site and would like to list all the active modules, I know I can take them from admin/...
17
votes
5answers
15k views

How I can delete all node/field revisions?

I have a drupal 7 sites, where it keeps node and field revisions. I keep revisions for the case where by mistake a new faulty version is saved and I want to revert back. But, now I want to clean and ...
12
votes
9answers
13k views

Cron stopped running; logs say: “Attempting to re-run cron while it is already running.”

What are the steps to troubleshoot and resolve this issue as per title? When I try to run manually, I get a page immediately, and the error message "Attempting to re-run cron while it is already ...
6
votes
1answer
13k views

How to insert values into Global custom text field of views programmatically?

How can I programmatically insert values into Global custom text field from the views. I have tried using the $views variable from the hook_views_pre_render(&$views) and ...
5
votes
2answers
5k views

Using db_query() or db_select() to connect to multiple databases

How can I execute a query that connects to different databases? I have the following query, and I need to rewrite it for Drupal. SELECT a.empid, b.empname FROM db1..empidmaster a, db2..emplist b ...
6
votes
1answer
9k views

How to disable the revision feature completely?

I've followed discussions here and on d.o about removing unneeded revisions tables. How would I completely prevent any data from being written to the node_revision and field_revision_* tables?
6
votes
2answers
12k views

Filter a view based on current user's roles?

Using Drupal 7, Views 3 and the Node Reference module, I'm using a view to populate a node reference field on a custom content type. (So it's a view of "Reference" display type.) I want to filter ...