Hooks are PHP functions used to interact with the Drupal API.

learn more… | top users | synonyms (1)

0
votes
1answer
24 views

page “/node/add” that I would like to programmatically limit the links that are displayed based on the users role

I have a page "/node/add" that I would like to programmatically limit the links that are displayed based on the users role. Is using either hook_form_alter or hook_form_ID_alter the way to do this? I ...
-1
votes
1answer
18 views

How to use predefined drupal elements in a custom block/module?

This is regarding the user block but the question is general and could be related to any standard block/module: How to use in a custom block elements that have been defined in standard modules? (for ...
0
votes
2answers
59 views

Assign text formats per user roles

I tried to program the logic where friends_html text format would apply to nodes saved by users with the new 'friends' role, while friends_somik_my_html text format would apply to nodes saved by all ...
2
votes
1answer
27 views

array_flip() error while creating a menu item with form

My aim is to create a new menu item and display the user profile form on that page. Here is the code I am using. /** * Implements hook_menu(). * */ function profile_preferences_menu(){ ...
1
vote
2answers
34 views

Custom Login form question

In my website have two types people login one is designer another is reader, i want people come to login my website by role. Mean designer go to design login form to login. Reader go to reader login ...
0
votes
2answers
26 views

curent language token on block body

what is the token used to get the curent language, I want to use this token on a link in the block body, like that: <a href="/[curent-language]/about-us">About us</a> I find this token ...
0
votes
1answer
13 views

Additional fields for Ubercart uc_order_product

I need to add fields to the Ubercart entity uc_order_product. I was looking into the function field_create_instance, but don`t know exactly where to use it. I believe I should attach the field I want ...
4
votes
1answer
42 views

How to alter node title link?

I want alter $node_url in node.tpl.php inside a module not in node.tpl.php, which hook should I use?
0
votes
1answer
32 views

How to rewrite the value of an array element in page.tpl.php

I'm totally new to PHP programming and modifying the values of Drupal output with php customisations, so sorry if this question seems dumb. In Drupal 6 I need to rewrite the value of the array ...
0
votes
1answer
11 views

working with LDAP authorization hook

While I have been able to use the LDAP authentication hook (hook_ldap_authentication_allowuser_results_alter) to perform additional authentication, I have not been able to use what I thought was the ...
0
votes
1answer
29 views

how to get form element value before submit in drupal

i have form has first name and last name field,and a custom login form,when user login it redirect to another page,and i want to get first name and last name fields in that page.., this is the way ...
1
vote
1answer
15 views

How to add a custom widget to a node creation form Drupal 6

This may be a dumb question, but nothing I could find really told me what I was looking for. Without furthur ado: I need to add a custom widget that will edit node reference fields on CCK content ...
0
votes
0answers
22 views

How to create a form inside a form which is created in a custom content type

I've created a custom content-type using hook_node_info. Now in that hook_node_info I've declared 'base' as some test. Now i want to create a form. For that I've used hook_form which is "test_form" ...
0
votes
1answer
19 views

How Can I change the fields order without using CCK

I want to change the order of the fields in each node. I know that I can use CCK but I would like to do this in hook_node_load Is it possible? Thx :)
0
votes
2answers
80 views

Guidelines on customisation options when using hook_views_default_views?

Are there any good instructions for the customisation options available when creating a default Views files using hook_views_default_views()? The API for the function can be found here: ...
1
vote
0answers
18 views

Calling a hook from a hook in the same module

Hey guys I am a Drupal Noob so be easy on me. I have created several custom modules with different forms however I was all the time using either a hook_form or hook_output. I was wondering if I can ...
1
vote
2answers
27 views

how to add html elements inside block and get data when saving

i want to add few html elements call first name and last name,company name in top of user/register page and save that data when user click create account button..,how can i achieve that,i add html ...
1
vote
1answer
34 views

Error displaying field_view_field content [duplicate]

I have some working but drupal keeps giving me warming errors each time i look at the admin pages. I am in the process of building a forum using drupal's core forum module. Once you selected a listed ...
0
votes
0answers
12 views

Term Reference Update Event

I Have implemented a term reference field in my custom content type. The widget i am using is hierarchical select. Now when a content type is being created a hierarchical select box is shown, if a ...
0
votes
1answer
20 views

Using drupal_add_content_region()

I am trying to dynamically add content into a region. In the preprocess function, I use the following code. function firsttheme_preprocess_page(&$vars){ drupal_add_region_content('dev', ...
0
votes
2answers
59 views

Can we call a custom block inside our hook_block_view()?

I have a module of type block.Now based on the user i want to display different blocks . So i have a written the module but my dilemma is if its possible to call a block(default) inside our custom ...
1
vote
1answer
47 views

How do I prepopulate the value of a taxonomy term reference field on the node creation form?

I'm using an approach similar to the one taken in this question. The difference is that I have a taxonomy term reference field in the user profile that I want to use to prepopulate a custom content ...
0
votes
0answers
16 views

How to create a link for certain user roles to modify a field of a node?

I have a content type called "orders". Users can create orders, admins can list orders (via a view). What I want to do is add a link or button both on the view and the content page of "order" to let ...
1
vote
1answer
30 views

How can I limit a views_pre_render() to a specific display of a view?

I have a views_pre_render() hook that I want to limit to a specific views display. So far, based on this code, I have this: function MYMODULE_views_pre_render(&$view) { if ...
0
votes
0answers
31 views

Background Image from a specific Content Type

I'm fairly new to Drupal and got the following problem: The User should be able to upload as many background images as he likes. He can tag the background images for a specific region of the website ...
2
votes
1answer
31 views

How do you change what a function in a core module does?

I am trying to change certain Drupal behavior. I have traced this behavior back to a function in RDF core module, and would like to change what it does. The function in question is ...
1
vote
1answer
29 views

Change drupal search result count

Drupal search is giving 10 items per page. The number is hard coded in search core module. Is there any way to make it 15?. I am using drupal 6.
1
vote
1answer
45 views

Add content type machine name to an attribute in the body tag?

I figured this would be easily done in the template_preprocess_html function, but I haven't found a way to do it... yet. I need to add the content type machine name to a "data-init" attribute in the ...
0
votes
2answers
28 views

hook_filter_info langcode is always und

I am trying to filter text and the result replace depends on the language of the node. The filter process callback function accepts $langcode argument but it always pass as "und". If I could access ...
0
votes
0answers
29 views

Jquery Mobile module page change not detectable?

I'm implementing a mobile version of an existing site. I'm using the jquerymobile module to make this happen. The constraints of the problem are: The main site has a header that appears on every ...
1
vote
1answer
23 views

Target Bundle with hook_element_info_alter

Using the following hook you can alter form elements function EXAMPLE_element_info_alter(&$type){ // Increase the default weight range if (isset($type['weight']['#delta'])) { ...
2
votes
1answer
47 views

drupal 6 search pdf content

Is there any way include pdf files in common drupal search. I tried http://drupal.org/project/search_files module. But it gives the results under a separate tab. Is there any to include them in common ...
1
vote
1answer
31 views

how to alter block subject html tag?

I am trying to change the <h2> tags that block.tpl.php uses to wrap <?php print $block->subject ?> to <h3> tags so that I can target them with jQuery UI Accordion. I've got the ...
0
votes
0answers
25 views

How to set Content-Lenght http header for images?

How to set the Content-Lenght header or any other header for images? I need it to set a rule in the varnish to not cache images larger than 500kb.
1
vote
1answer
47 views

which hook to change the node order in a view?

I have a custom view but now I want to put the nodes created by a specific user role on top. I want to do this using code so I can easily implement this throughout multiple web pages. I'm thinking ...
0
votes
1answer
38 views

Problem with restricted download links (hook_file_download)

On my site I have a bunch of files that require logged-in user for download access. Well that's not about just display access, I also want to avoid passing download links around. Having read about ...
0
votes
0answers
16 views

What could cause modules to not fire in the correct order after altering the module weight or name, and how to correct it?

I wrote 3 custom modules, and I have given them a weight of 1,2, and 3 in their .install files as functionality in the later modules depend on functionality in the modules before them. The weights ...
-2
votes
1answer
76 views

How to navigate from one page to another in drupal? [closed]

Can anyone provide a sample code to output the value to another drupal page from the existing.
2
votes
1answer
89 views

How to implement a mysql date or datetime field correctly in hook_schema()?

I have written a mymodule.install file which contains a schema definition to create a table in my database. This table contains two data fields. Theese fields will be populated by the users when they ...
0
votes
1answer
35 views

Altering the breadcrumb contents

I'm trying to use this hook in order to alter a breadcrumb link : hook_menu_breadcrumb_alter(&$active_trail, $item) The hook don't seem to be called. I've tried : Using the hook on a theme ...
0
votes
0answers
22 views

How to change the user view mode?

We are using Display Suite for managing User View Modes. We want to be able to change the view mode based on some conditionals we specify. We tried rules where we managed to implement our conditions, ...
1
vote
2answers
22 views

how to refer to data of referenced node

In drupal 6, I have an event node type and an event_attend node type. The event_attend node type has a nodereference to event. In hook_form_alter for the event_attend node type, i added a validation ...
1
vote
2answers
26 views

How to figure which function(s) are triggered upon file download to check permissions

I am experimenting with private file system, done custom way :) . There is file system/files/test.txt (That is, private://test.txt). When I try to access the file, I get access denied from Drupal, ...
0
votes
2answers
35 views

hook_uninstall not working

I have created a custom content-type in my custom module with custom fields.. It works fine.. But when I try to uninstall it, it doesnt call hook_unistall().. Can any one suggest what can be the ...
3
votes
1answer
25 views

When is hook_file_download triggered

I wonder which files are being considered to go through hook_file_download. When this function is triggered, what are conditions ? (Generally, how I can track myself hooks conditions ?) I am trying ...
2
votes
2answers
46 views

How to get notified when a user is blocked?

Is there a way to get notified when a user is blocked ? like a hook in user module or ? or there are another way ?
0
votes
0answers
13 views

Custom template for media

I am using media module and using it in WYSIWYG. Is it possible to customize the display of media image? Is there any template file I can rewrite or any hook to call? I found file_entity.tpl.php. but ...
0
votes
1answer
36 views

(Newbie question) Something goes wrong here with db_add_field

I'm trying to adapt that D6 module to D7. I'm on the "add afield" part of .install Here's my code : function node_statistics_install() { db_add_field('accesslog', 'nid', array( 'description' ...
0
votes
0answers
19 views

what is the use of # symbol in coding drupal module? [duplicate]

could anybody tell about the use of # symbol in drupal coding? Ihave found this in drupal hook implementations. Thank You in advance.
0
votes
3answers
70 views

How to remove results returned from Views UI

I am getting results as expected using Views UI. But I don't want to display a particular record from the output of Views UI. How to achieve this and will I require any hooks for this? For example; ...

1 2 3 4 5 16