This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

How can i use form_alter hook to add something to admin/content/types/page ?

How can i use form_alter hook to add something to admin/content/types/page ?

I used this to do the job for node/x/edit

function node_controll_form_alter($form_id, &$form) {
  $type = $form['type']['#value'];
  $title = t('Access restricted for non-vip users');
  
    case $type.'_node_form':
      if (user_access('administer nodes')) {
        $node = $form['#node'];
        $vip = (int) db_result(db_query('SELECT 1 FROM {vip} WHERE nid = %d', $node->nid));
        $form['options']['vip'] = array(
          '#type' => 'checkbox', 
          '#title' => $title, 
          '#default_value' => $vip,
        );
      }
      return;
  }
}

But how to do this for the admin/content/types/page ?

I tryed (without success)


function node_controll_form_alter($form_id, &$form) {
$type = $form['type']['#value'];
$title = t('Access restricted for non-vip users');

switch ($form_id) {

case 'node_type_form':
$form['form-checkboxes']['vip'] = array(
'#type' => 'checkbox',
'#title' => $title.'222',
'#default_value' => 1,
);
return;

case $type.'_node_form':
if (user_access('administer nodes')) {
$node = $form['#node'];
$vip = (int) db_result(db_query('SELECT 1 FROM {vip} WHERE nid = %d', $node->nid));

where to put a php script file, and how can ajax client know its url in a module?

I am wrinting my custom module. The client side's ajax will have to retrieve some data via issuing a request to one of my php scripts. Where should I put this script, in my module directory? How can I get the full url of the script?

using hook_user to add "Required" fields - a bug?

hi,
i'm writing a new drupal module that adds some custom fields to the user registration form.
One of these fields is marked as required=true and has no default value.

If user leaves this field empty, he gets a notification message ('XXX field is required') - that's ok.
However - even if he nows fills it in, message still appears!

I narrowed it down to this -
if i set the "default value" of this field to something, this does not happen. However, behavior is still not ok - the default value gets filled, and not the "empty" value.

I looked a few times at the profile module code, and it seems we're doing the same thing - and i do not get that behavior when using the profile module (it is not enough for me, so i have to write my own).

can anyone help with this?

below is the relevant code subset (pretty straight forward):

Noam,

-------------------------------

function qm_reg_user($type, &$edit, &$user, $category = NULL) {

switch ($type) {

case 'register':

{
$form['Community'] = array('#type' => 'fieldset', '#title' => 'Community', '#weight' => 1);
$form['Community']['Credit Card'] = array('#type' => 'textfield',
'#title' => 'Credit Card',
'#default_value' => $edit['Credit Card'],
'#maxlength' => 255,
'#description' => 'Please enter your credit card number',

taxonomy_otf for 4.7

Anybody interested in getting the taxonomy_otf module working in 4.7?

Email me at - kpaul.mallasch@gmail.com - might be able to offer a little incentive and/or trade services.

Thanks!
kpaul

Check permissions of another module

I need to check the permissions of the node_clone module from my own module. I want to set it up so that if a role is allowed to use clone, they are automatically allowed to use my module. Is this possible?

thanks,

duggoff

ThickBox base on jQuery 1.1.1,but in drupal5.1 ,it is jQuery1.0.4. when is jQuery updated in drupal5.x?

ThickBox base on jQuery 1.1.1,but in drupal5.1 ,it is jQuery1.0.4. when is jQuery updated in drupal5.x?

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions