DrupalBin
Submit Code
About
Recent Posts
Code
10 min 31 sec
ago
Code
26 min 8 sec
ago
css path
2 hours 10 min
ago
Fix for Code
6 hours 10 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for bug in _form_builder_handle_input_element() function in form.inc ..
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
<?php # vim: set filetype=php expandtab tabstop=2 shiftwidth=2 autoindent smartindent: /* bug in _form_builder_handle_input_element() function in form.inc at line when doing "$form['#attributes']['disabled'] = 'disable';" Fatal error: Cannot use string offset as an array in /data/projects/voip_support/trunk/control_interface/includes/form.inc on line 965 */ function user_queue_member_admin($form, $form_state = NULL) { if(module_exists("profile")) { $default_value = FALSE; if($field = _user_queue_member_get_profile_field()) { $default_value = $field->name." [".$field->fid."]"; } $form["profile_field"] = array( "#type" => "textfield" ,"#title" => t("Phone number field") ,"#autocomplete_path" => "admin/user/user_queue_member/autocomplete" ,"#required" => FALSE ,"#default_value" => $default_value ); } else { $form["profile_field"] = array( "#value" => t("Enable profile module to send calls to user phone number.") ,"#title" => t("Phone number field") ); } $form["save"] = array( "#type" => "submit" ,"#value" => "Save" ); return $form; } function user_queue_member_admin_validate($form, &$form_state) { if($form_state["values"]["profile_field"]) { /* parse the profile field */ if(!preg_match("^.*\[([0-9]+)\]$", $form_state["profile_field"], $matches)) { form_error($form["profile_field"], "Profile field could not be identified, you can keep it blank if you do not want to use phone number."); return; } /* see if the fid exists */ if(!$field = db_fetch_object(db_query('SELECT f.name, f.fid FROM {profile_fields} f WHERE f.fid = %d', $matches[1]))) { form_error($form["profile_field"], "Profile field does not exist, you can keep it blank if you do not want to use phone number."); return; } $form_state["fid"] = $field->fid; } } function user_queue_member_admin_submit($form, &$form_state) { if($form_submit["fid"]) { variable_set(USER_QUEUE_MEMBER_PHONE_NUMBER, $form_submit["fid"]); } } function user_queue_member_admin_autocomplete($string) { $matches = array(); $result = db_query_range("SELECT f.name, f.fid FROM {profile_fields} AS f WHERE LOWER(f.name) LIKE LOWER('%s%%')", $string, 0, 10); while ($data = db_fetch_object($result)) { $matches[$data->name." [".$data->fid."]"] = check_plain($data->name); } drupal_json($matches); }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.