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

Revisions

Hi,

I would like to use the revisions with 4.6,
I use the function node_revision_create($node) each time I update the node but it doesn't work!
Did anyone have this problem before?

Drutex simplification

I currently use the Drutex module to show different math problems and solutions on my website. It certainly does look good, I've never even imagined it's possible, you can take a look at the result on www.studentblock.com under the "My first day in MA 275." My question is whether it is possible to make the code a little bit more simple, so I don't have to type $\frac, \cdot or other commands all the time.

Can't copy file attachment to tmp directory

This is a very strange error message considering that it's occuring on a development site which is an exact copy of a production site, they have the same database and files, paths to files and tmp directory are same.

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',

Pages

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