drupal-modules

hook_user(): inserting extra field into database not just form

陌路散爱 提交于 2019-12-05 19:56:56
I can add an extra field to the registration. What I need to know is what step do I need to take to then grab that input and insert it into the user table of drupal. The code below is in my module this adds just a field to the form, but when its submitted it doesnt do anything with the data. function perscriptions_user($op, &$edit, &$account, $category = NULL){ if ($op == 'register') { $form['surgery_address'] = array ( '#type' => 'textarea', '#title' => t('Surgery Address'), '#required' => TRUE, ); return $form; } if ($op == 'update') { // … } } As reported in hook_user() documentation : $op

drupal jQuery 1.4 on specific pages

强颜欢笑 提交于 2019-12-05 16:38:00
I'm looking for a way to force drupal to use 1.4 on specific pages. This is the same as this old question: drupal jQuery 1.4 on specific pages It look me a while to try the answer which I marked correct. But because I'm new to module dev overall I couldn't figure it out based on the answer. The code from that answer looked like this: /** * Implementation of hook_theme_registry_alter(). * Based on the jquery_update module. * * Make this page preprocess function runs *last*, * so that a theme can't call drupal_get_js(). */ function MYMODULE_theme_registry_alter(&$theme_registry) { if (isset(

How to change footer Powered by Drupal and its link?

最后都变了- 提交于 2019-12-05 13:47:05
问题 I am working on Drupal. I want to know how to change that footer text Powered by Drupal and link given to it. I want there "Copyrights 2012 (My site name).All Rights reserved." I can not getting it can any one help me. 回答1: Just go to Structure -> blocks -> Add block Leave block title blank block description Custom Footer or any other if you want and in Block body add following code Copyrights © <a href="http://localhost/drupal-7.12/">TopTableToastMaster</a>.All right reserved. After doing

Include OpenId in drupal

亡梦爱人 提交于 2019-12-05 13:28:10
i want to create a OpenId login system like stackoverflow :) in drupal..By default, drupal doesn't offer this..is there any plugin that does this job? EDIT:the user should ALSO be able to login with their yahoo, gmail, aol or blogger account..u guys can't understand my pro.. it's simple..i've openID enabled in my drupal 6. When i try to use my gmail or yahoo account, it doesn't login. What should i do for that? Yes, there's a module for that. But you added a drupal-6 tag, which suggests you're using Drupal 6; OpenID has been a core part of Drupal 6 for >2 years - it's documented in the

drupal field widget not saving submitted data

落花浮王杯 提交于 2019-12-05 05:54:34
I'm trying to create a custom widget but when I submit, Drupal doesn't seem to save any data. When using hook_field_attach_submit() to display what data I've pasted, it is listed as null. Strangely, if i change the #type to be a single textfield instead of a fieldset it will save only the first character of the string that has been entered. This seems like a validation issue, but I'm not sure how to hook into it or to debug the problem. Where can I go from here? <?php function guide_field_widget_info(){ dpm("guide_field_widget_info"); return array( 'guide_text_textfield' => array( 'label' => t

Drupal: Are hook_ functions in *.api.php ever called?

折月煮酒 提交于 2019-12-05 05:33:19
In Drupal 7, every core module has a *.api.php file, where * is the name of the module. For example modules/node/node.api.php modules/path/path.api.php What are these files for? They contain functions that start with hook_ , and the name of a hook that (I think) the module invokes. For example modules/system/system.api has function hook_entity_view($entity, $type, $view_mode, $langcode) { $entity->content['my_additional_field'] = array( '#markup' => $additional_field, '#weight' => 10, '#theme' => 'mymodule_my_additional_field', ); } There's an entity_view hook that's invoked by the system

How to get rid of Drupal CSS stylesheets?

回眸只為那壹抹淺笑 提交于 2019-12-05 02:09:14
I am trying to accomplish the following. I need to use Drupal 6 as a project requirement, but I want to use it with my own HTML and CSS stylesheets for each node/view/panel etc. The problem is, whatever the theme, I always found that Drupal applies to my HTML content both my CSS stylesheets and the CSS related to the theme chosen. I have also tried, without success, using the stylestripper module (installed in sites/all/modules). No matter what I do, additional CSS stylesheets are applied to my pages, completely destroying my layout. What is the proper way to achieve this? Why stylestripper

How to allow multiple blocks in a module of Drupal

若如初见. 提交于 2019-12-04 22:07:27
I am trying to make a module for Drupal 7 that provides a block and has certain configuration settings. Now what I want is that I want to provide 5 blocks to the user so that they can use different settings in each block. In other words, I want to provide each block a separate set of settings. How can I do that? Edit: Actually I have made a module that shows a single block. If you have used superfish menu module then you can see there that they allow us an option to choose how many block should be made available. So that for each block we can use different menu to show. I am talking about that

How can I redirect a Drupal user after they create new content

拜拜、爱过 提交于 2019-12-04 21:09:18
I want to redirect my users after they create a piece of new content, instead of directing them to the 'view' page for the content. I have seen mention of using hook_alter or something, but I'm really new to drupal and not even sure what that means? Thanks! As you mention that you are new to Drupal, I'd suggest to take a look at the Rules module . You can add a trigger on for content has been saved/updated and add an action, to redirect the user to a specific page. You can however do the same in a light weight custom module using a form_alter hook. First, find the form ID of the form. For node

Where to declare variables common to different include files in a module - Drupal

匆匆过客 提交于 2019-12-04 11:15:11
I have a Drupal Module 'example'. I have split the admin and client side functionality of the module into two include files example.admin.inc and example.pages.inc. I declared constants (define()) in the example.module file, which are accessible in both the pages.inc file and admin.inc file. But how can I declare normal $variables in a centralized location so that they can be accessible in both the admin.inc file and pages.inc file. I tried to declare $variable in example.module, but couldn't access it in the example.admin.inc and example.pages.inc. There are multiple possibilities, depending