Skip to main content

Questions tagged [7]

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

Filter by
Sorted by
Tagged with
20 votes
3 answers
28k 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?
george marcotte's user avatar
20 votes
7 answers
15k 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 ...
Eloar's user avatar
  • 303
20 votes
2 answers
17k views

Using views with a custom table/schema

I need to set up some views that will pull some data from a custom table I created. Some views will need to pull content the regular way and from my custom table (where I may query for a particular ...
vintorg's user avatar
  • 1,993
19 votes
7 answers
34k views

Add FILTER CRITERIA in Views Programmatically

I want to add/modify a filter criteria programmatically. For example, for a view, I added an "Email Address" filter whose value is needed to change dynamically, it is needed to set to the current ...
Shafiul's user avatar
  • 1,226
18 votes
5 answers
9k 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 ...
Fadzy's user avatar
  • 181
18 votes
4 answers
10k 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.
j2r's user avatar
  • 981
13 votes
2 answers
6k 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.
Allan Thomas's user avatar
12 votes
2 answers
17k views

Where is links__system_main_menu defined?

I searched for links__system_main_menu, but just find usages of this theme. Where is it defined?
hpn's user avatar
  • 2,398
10 votes
5 answers
21k 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->...
mate64's user avatar
  • 328
9 votes
2 answers
19k 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 ...
SMTF's user avatar
  • 946
8 votes
4 answers
15k 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?
Luiz Guilherme's user avatar
8 votes
3 answers
9k 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 ...
Johnny's user avatar
  • 235
7 votes
2 answers
4k 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,...
JT-Drupal's user avatar
  • 115
7 votes
3 answers
21k views

How do you theme a content type's create/edit form?

Like it says -- I've got a D7 content type whose editing form needs to be themed. I did this all the time in D6 by registering theme functions in template.php and writing the associated theming ...
Jim Miller's user avatar
  • 1,948
1 vote
2 answers
5k 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 ...
Hitesh's user avatar
  • 576
1 vote
2 answers
1k 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 ...
AndrewMRiv's user avatar
1 vote
1 answer
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 ...
Patrick Kenny's user avatar
0 votes
1 answer
1k 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....
Pierre.Vriens's user avatar
0 votes
3 answers
961 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 ...
rose's user avatar
  • 129
39 votes
4 answers
22k 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?
gilzero's user avatar
  • 6,037
34 votes
7 answers
131k 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 ...
drupal_stuff_alter's user avatar
32 votes
11 answers
71k 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 I would like to list all the active modules. I know I can take them from admin/...
drcelus's user avatar
  • 1,662
31 votes
2 answers
36k views

Eliminate render-blocking JavaScript and CSS in above-the-fold content

I am building a Drupal 7 site. These are some of the modules I use: Adaptivetheme (theme), Views and Content Panes, Panels, Mini panels, Panels everywhere, Page manager, Superfish for menus, Addthis, ...
EB84's user avatar
  • 1,417
31 votes
3 answers
43k 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)?
hpn's user avatar
  • 2,398
28 votes
2 answers
24k 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 ...
sridhar's user avatar
  • 281
25 votes
5 answers
26k 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' ==$...
cherouvim's user avatar
  • 1,937
23 votes
5 answers
31k 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 ...
jjei's user avatar
  • 683
20 votes
3 answers
10k 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 (...
uwe's user avatar
  • 12k
20 votes
3 answers
19k 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 ...
geerlingguy's user avatar
  • 5,483
20 votes
3 answers
17k 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!...
Serjas's user avatar
  • 1,357
20 votes
4 answers
15k 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 ...
user13134's user avatar
  • 558
20 votes
2 answers
17k 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 ...
Allan Thomas's user avatar
18 votes
5 answers
20k 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 ...
john's user avatar
  • 1,601
16 votes
5 answers
14k 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?
gilzero's user avatar
  • 6,037
15 votes
2 answers
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 ...
F1234k's user avatar
  • 1,456
15 votes
2 answers
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 ...
Nigel Waters's user avatar
  • 1,024
14 votes
5 answers
44k 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 ...
nooshinha's user avatar
  • 418
12 votes
1 answer
15k 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 ...
user56reinstatemonica8's user avatar
12 votes
3 answers
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 ...
Paul Sheldrake's user avatar
12 votes
9 answers
17k 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 ...
giorgio79's user avatar
  • 4,631
8 votes
9 answers
18k 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 ...
Druvision's user avatar
  • 2,503
7 votes
2 answers
14k views

Filter a view basing 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 ...
s427's user avatar
  • 735
7 votes
5 answers
29k views

Customizing menu link output

In Drupal 7, how I can intercept menu rendering in template.php and add pipes after menu links? I tried using template_preprocess_menu_tree but I don't think that is what I am looking for. I want to ...
Kevin's user avatar
  • 27.9k
6 votes
1 answer
11k 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?
uwe's user avatar
  • 12k
6 votes
1 answer
15k 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 ...
harshal's user avatar
  • 4,354
5 votes
2 answers
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 --...
zombar's user avatar
  • 71
5 votes
4 answers
4k views

How can I show a block in a view page, excluding its paginated pages?

I want to place put a block in a view page. Let's say the news page, whose path is http://www.example.com/news. The view uses pager to list the content. I want a block to show up only in the ...
gilzero's user avatar
  • 6,037
5 votes
3 answers
3k views

inheriting fields from a base content type

I need to create 10 content types which, apart from their specific fields, will have 4 common fields (e.g name, surname, email, age). Since I'm using Features I could create the first and copy paste ...
cherouvim's user avatar
  • 1,937
5 votes
2 answers
6k 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 ...
jacksantho's user avatar
4 votes
2 answers
10k views

Adding more fields to the registration process

In Drupal 7, is there a way to add more fields to the registration process? I was thinking along the lines of birthday, fullname, gender, twitter, etc. Also how do I access this data once it's in, so ...
enchance's user avatar
  • 2,049

1 2
3
4 5
59