drupal-6

Hook into Drupal registration and validate user info against business logic

孤街醉人 提交于 2019-12-03 03:54:38
I want to hook into the registration module. I already have a database of 50000 users who use my old website. Now I am migrating to Drupal. I still haven't migrated the entries to drupal database. I will be checking against my old database. When a user tries to register in Drupal, I need to check whether the username he gave is already present in that list of 50000 (and growing) entries. If it exists, I need to cancel the registration showing an error msg saying username exists.. Which hook should I use? If my code figures that the validation failed, How can I tell drupal to display an error

Removing [nid:n] in nodereference autocomplete

只谈情不闲聊 提交于 2019-12-03 02:50:59
问题 Using the autocomplete field for a cck nodereference always displays the node id as a cryptic bracketed extension: Page Title [nid:23] I understand that this ensures that selections are unique in case nodes have the same title, but obviously this is a nasty thing to expose to the user. Has anyone had any success in removing these brackets, or adding a different unique identifier? 回答1: Ultimately, you need to change the output of nodereference_autocomplete() in nodereference.module. To do this

Drupal return number of results in a View

耗尽温柔 提交于 2019-12-03 02:17:40
I have a view in Drupal that filters my content. It brings back 7 rows. All I want to return is the number or results returned(7). Is this possible? I tried using the View result counter but it returns a number for each results 1 2 3 4 5 6 7 I just need the 7 part. So in SQL I would do a select count(*) what you can do is to activate php for the views header/footer and add the following snippet to it: <?php $view = views_get_current_view(); print $view->total_rows; ?> This will print the total number of rows. If you need the result as a field, you could use the "Views custom field" module ,

Using module: url_alter and it's hook: hook_url_outbound_alter()

你说的曾经没有我的故事 提交于 2019-12-03 00:25:28
问题 hook_url_outbound_alter() I am struggling to find any documentation or explanation for how to use this hook. I have a page: node/1221 and when it look like so: node/1221/profile/chn/3 It loads a profile for that user. I want pretty URL's so that when the user visits departments/pch/chn/profile/3 I want it to actually load node/1221/profile/chn/3 I am pretty sure the hook should help me with this but not sure how it works. Note: Using drupal 6, tried aliases but they didn't work. 2nd update:

How do I hide a CCK Nodereference input widget in #after_build?

…衆ロ難τιáo~ 提交于 2019-12-02 20:01:09
问题 I like simplifying the node form. One of my tricks in the past has been to conditionally hide CCK elements on new node creation when I want to enforce some kind of default. One of my favorite tricks is to whisk away things put in place by the Prepopulate module. Unfortunately for me, it's recent move to an #after_build -based mechanism seems to be creating all kinds of collisions in how I can manipulate the widget. This is what I used to do in hook_form_alter() : $form['field_my_nodereference

How can I theme the template for edit or add a node for a specific content type?

给你一囗甜甜゛ 提交于 2019-12-02 18:33:54
I want to theme the template for edit or add a node for a specific content type. For example, to theme all the content type forms I use the file page-node-{add|edit}.tpl.php (depending what I need to do add or edit). But I didn't found the template name for a custom node type, for example Products. I need to theme only for Products, but not for the other content types. I've tried with page-node-edit-product.tpl.php and page-node-product-edit.tpl.php but no luck. easement Hmm. There may be a better way but what about a preprocess function. I'm still really new to Drupal, so I would maybe try

Removing [nid:n] in nodereference autocomplete

半腔热情 提交于 2019-12-02 16:24:25
Using the autocomplete field for a cck nodereference always displays the node id as a cryptic bracketed extension: Page Title [nid:23] I understand that this ensures that selections are unique in case nodes have the same title, but obviously this is a nasty thing to expose to the user. Has anyone had any success in removing these brackets, or adding a different unique identifier? Ultimately, you need to change the output of nodereference_autocomplete() in nodereference.module. To do this properly, you want a custom module to cleanly override the function. This function is defined as a menu

theme_table drupal development

拜拜、爱过 提交于 2019-12-02 13:25:37
update I have made this table: I have 2 array's UGentArray and InternshipsArray. How can I set these in my table? instead of "Row column 1 data" and "Row column 2 data". My question is: I want the values from UgentArray and InternshipArray as 2 columns under Each title UGentID and Internships enter code here// Make table and display on screen. $tbl_header = array(); $tbl_header[] = array("data" => "UGentID"); $tbl_header[] = array("data" => "Internships"); $tbl_row = array(); foreach($studentUGentID as $key => $value) { for($i = 0; $i<count($value); $i++) { $tbl_row[] = $value[$i]['value']; }

Modificate content profile form to show checkboxes in the matrix

冷暖自知 提交于 2019-12-02 12:47:11
I need to show matrix like this http://eugen.gotdns.com/test/zeitplaner.png in content profile form. I can arrange checkboxes with CSS in this way, but i need also some labels on the top and on the left. Should i work with $form array to add some labels? Can this be done with css maybe? I agree with Mike Crittenden that the way to do this is to use tables, I don't agree with the way he want to do it though. The best solution is to make a custom theme function for the form. Basicly what you do it to loop through your form items and render them. The easiest is to render them one table row at a

How do I hide a CCK Nodereference input widget in #after_build?

拟墨画扇 提交于 2019-12-02 12:21:10
I like simplifying the node form. One of my tricks in the past has been to conditionally hide CCK elements on new node creation when I want to enforce some kind of default. One of my favorite tricks is to whisk away things put in place by the Prepopulate module. Unfortunately for me, it's recent move to an #after_build -based mechanism seems to be creating all kinds of collisions in how I can manipulate the widget. This is what I used to do in hook_form_alter() : $form['field_my_nodereference_field'][0]['#type'] = 'hidden'; $form['field_my_nodereference_field'][0]['#value'] = $form['field_my