Drupal

File API: hook file_save: Some clarification on when it is called

Drupal Module Development - Fri, 2010-06-11 08:20

Hi

I am new in using File API: http://drupal.org/node/555118

I was reading through some code of a posted Drupal module, and within it was a custom implementation of hook file_save: http://api.drupal.org/api/function/file_save/7

Question #1: When this module is added, then will Drupal call this module's implemented file_save hook upon every event that involves a file save/upload?

Question #2: If Question #1 is true, then is Drupal only providing user upload/saves of media (files) to be only within files directory (./sites/default/files/*)?

Thanks

Jeff in Seattle

Categories: Drupal

Redirect user to specific page after registration

Drupal Module Development - Fri, 2010-06-11 07:32

Hello there,
I am trying to redirect user to specific page after registration. I did use LoginToBoggan but it was messing up with the core login system so I want to write code which will redirect user to specific page, that's it.

I am using below code to give redirection and it is working. It takes me to the desired page

<?php
function miscellaneous_form_alter($form, &$form_state, $form_id){
    switch($form_id){
        case 'user_register':
            $key = array_search('user_register_submit', $form['#submit']);
            if ($key !== FALSE) {
                unset($form['#submit'][$key]);
            }
            array_unshift($form['#submit'],'miscellaneous_user_register_submit');
        break;
    }
}

function miscellaneous_user_register_submit($form, &$form_state) {
    drupal_set_message(t("Miscellaneous module is invoked"));
    $form_state['redirect'] = 'thank-you-for-registering';
}
?>

It redirects the user to the desired page but as I have unset main "user_register_submit" it doesn't create a new user :D

So how can I create the user from miscellaneous module?

Or is there any other way to accomplish this? (I don't want to edit user.module file)

Categories: Drupal

viewing contents on hovering over a tab

Drupal Module Development - Fri, 2010-06-11 06:53

i wanna have module that displays content if we hover on the corresponding referring tab..help plz..

Categories: Drupal

viewing contents on hovering over a tab

Drupal Module Development - Fri, 2010-06-11 06:47

hey..i wanna show n change content by hovering over the tab that references that content..is there any module available for it..??

Moved per forum guidelines by VM

Categories: Drupal

Ladybug

Drupal Themes - Fri, 2010-06-11 06:37

This theme has the sharp and large picture of a ladybug in the header. The picture comes from a Joomla theme (GPL.)

The Drupal version of the Ladybug theme is based on the Sky theme.

Features

The theme is fixed at 960 pixels.

It supports simplemenu and is supposed to work with the AdminMenu too.

The Primary menu appears in the green rectangle below the header. The menu uses superfish to make it a dropdown menu.

The theme supports a logo, large title, and slogan (all optional.)

You can have a left and right sidebar (optional.)

There are a content top and a content bottom areas where you can insert blocks.

There is a footer area where your footer information is shown. You can also include blocks.

Sponsors

Made to Order Software Corp. created the Drupal version of this theme. Note that it has nothing to do with the Joomla version, other than the header image.

Sky theme by Jacine.

Themza for the header images (a Joomla GPL theme.)

Categories: Drupal

uploading image problem

Drupal Module Development - Fri, 2010-06-11 06:00

m not able to upload image in my site..wht can be the possible reasons..plz help fat its urgent..!!

Categories: Drupal

Luxury theme

Drupal Themes - Fri, 2010-06-11 03:04

1. General description

The theme has one mandatory content type 'news'. Read the requirements below.

2. Colors

Ash and light blue palette.

read more

Categories: Drupal

How does one overite a template in a module?

Drupal Module Development - Fri, 2010-06-11 00:07

I want to be able to rearrange the user registration form by making it two column instead of one and add more fields.

Categories: Drupal

Add additional fields to user_register form and have them in a two column setup instead of one..how?

Drupal Module Development - Thu, 2010-06-10 23:47

I have the following functional code but I am lost in how to add additional fields that would go in a 2 column setup. I know I may have to over right a template in my module but how? I have been struggling with this for hours now

<?php

/**
* Implementation of hook_menu().
*/

function modulename_menu() {
$items = array();
$items['student/registration'] = array(
      'title' => 'Register Now',
      'page callback'    =>'modulename_student_register',
      'access arguments' => array('access content'),
      'type' => MENU_CALLBACK           
    );

return $items;
}//end of the function



function modulename_student_register(){

return drupal_get_form('user_register');

}//end of the function


function modulename_form_alter(&$form, $form_state, $form_id)
{
   if ($form_id == 'user_register')
   {


//print_r($form);

// modify the "#submit" form property by prepending another submit handler array
$form['#submit'] = array_merge(
      array('modulename_registration_submit' => array()),
      $form['#submit']
    );

   }
}



function modulename_form_submit($form_id, $form_values) { // IS THIS FUNCTION NAMES PROPERLY ?
 
  //save extra fields in form to another table
}

Categories: Drupal

It is amazing how difficult it is just to make a normal form in Drupal even after you follow tutorials

Drupal Module Development - Thu, 2010-06-10 21:24

Error I get is : Skipping broken view

Contents of my Module file:

function modulename_menu() {
$items = array();
$items['some/place'] = array(
      'title' => 'Some title',
      'page callback'    =>'quiz_page',
      'type' => MENU_CALLBACK           
    );

return $items;
}//end of the function

function quiz_page () {
  return drupal_get_form('quiz_form');
}



function quiz_form ($form_state) {
  $form = array();
 
  //make a texfield
  $form['name'] = array (
    '#type' => 'textfield',
    '#title' => t('Please enter your name'),
    '#required' => TRUE,
  );
 
  //a pair of "radio buttons"
  $form ['toast'] =array (
    '#type' => 'radios',
    '#title' => t('Do you like toast?'),
    '#options' => array (t('No'), t('Yes')),
  );
 
  //a "submit" button
  $form['submit'] = array (
    '#type' => 'submit',
    '#value' => t('Make it so...'), 
  );
 
  // If you forget this line your form will never exist
  return $form;
}

Categories: Drupal

Multilingual Sites work good in Firefox, but error in IE, Opera, and Chrome

Drupal Module Development - Thu, 2010-06-10 20:58

I'm building a multilingual site, with English and Indonesia.
But what I look the result is so surprising me. All the things looks good in Firefox but not on other browsers.
The site is http://www.lintas88.com
I set the contents and blocks in English (default), then In firefox when i hover the one of default (english) primary links, it show no id (indonesia). In other browsers except firefox, there is still id, such as http://www.lintas88.com/id/node/xx. So my block in left sidebar which I set up in English don't follow the content languange, it still id block. It doesn't happen in Firefox.
Anybody can give me a clue ?. Your input would be appreciated.
Sorry for my bad english.

Categories: Drupal

Lost On Galleria (help please)

Drupal Module Development - Thu, 2010-06-10 20:16

Have downloaded Galleria and all necessary supporting modules. Have enabled them, configured permissions. Where do I go from here? I am trying to create a gallery with a scrolling carousel beneath. Please help, new to Drupal, and feeling in over my head. :P

Categories: Drupal

Executing custom code after system_settings_form_submit()

Drupal Module Development - Thu, 2010-06-10 19:46

Can someone point me to a documentation page which explains the workflow for changing admin settings? Something like http://drupal.org/node/165104 is what I'm after, although I realise that there is no standard route. Specifically I'd like to know what function I can use which gets executed after system_settings_form_submit().

A typical sequence I have seen in several modules is:

  1. admin/settings/mymodule is defined as a 'page callback' calling drupal_get_form with argument 'mymodule_admin'
  2. mymodule_admin() defines the $form, and can optionally register additional functions $form['#submit'][] = 'mymodule_submit'. It returns system_settings_form($form)
  3. mymodule_admin_validate() - this does not need to be registered in the form, it gets executed if it exists.
  4. mymodule_submit() is executed if registered in the form
  5. system_settings_form_submit() in /moduesl/system/system.module - this saves the settings

My problem is that I need to call menu_rebuild() after the settings have been changed, because they affect certain tabs which may be turned
on or off by the admin. Calling menu_rebuild() in steps 3 or 4 above is too early, it needs to be called after step 5 but I do not know
what function or hook I can put it in to get it executed there.

Hope someone can help.

Jonathan

Categories: Drupal

File upload not working in form

Drupal Module Development - Thu, 2010-06-10 19:42

I am struggling with a file upload form that isn't working. So I tried the default form that Drupal presents when I navigate to node/add/upload and that also isn't working so I think the problem isn't with my code but with the uploading in general. They both have the same behavior...I am able to choose a file but when I click on the submit button, the browser says it is loading but it just spins and spins and spins...

I do have the Drupal core Upload and CCK FileField modules enabled and permission for this user's role to create upload content.

Also, I have the form validate and submit functions with a print statement but it never seems to get to either one.

Does anyone know what the problem is or how I can debug this?

All help is greatly appreciated!

Mona

Categories: Drupal

giving a date field a default value [solved]

Drupal Module Development - Thu, 2010-06-10 19:33

$form['birthday']= array(
'#type' => 'date',
'#title' => t('Birthday'),
'#required' => $field->required,
'#default_value' => '02-03-2010',
);

I'm trying to give my date field a default value. This didn't work and I have tried a bunch of variations. Does anyone know the answer to this?

Categories: Drupal

Form file upload error

Drupal Module Development - Thu, 2010-06-10 19:25

I have developed a module with a form, one of the fields is a file upload. It all works correctly including saving the file to disk but Drupal shows this error message:

warning: Invalid argument supplied for foreach()...

I am uploading a jpg which is one of the allowed file types. Can someone point me in the right direction to remove the message?

Thanks!

Categories: Drupal

Drupal Studs help me with my form_alter hook ( I am almost there)

Drupal Module Development - Thu, 2010-06-10 19:21

So I think I am almost there conceptually but need some missing pointers.

Objective is to add a few more fields to the normal user registration form, style it a little, then submit it with storing the extra fields in a table.

This is what I have so far. Can someone give me the final nudge and get me going. Please help me. Also how do I apply some minor styling like aligning the new form fields ?

Thank you so much !!!!!!!!!

function module_menu() {
$items = array();
$items['school/registration'] = array(
'title' => 'Upgraded Registration Form',
'page callback' =>'module_school_register',
'type' => MENU_CALLBACK
);

return $items;
}//end of the function

function module_school_register(){
return drupal_get_form('form_school_register');
}//end of the function

function module_school_form_alter(&$form, $form_state, $form_id)
{

dsm($form_id);

if ($form_id == 'user_registration_form')
{
// modify the "#submit" form property by prepending another submit handler array
$form['#submit'] = array_merge(
array('_module_registration_submit' => array()),
$form['#submit']
);

}
}

function _module_registration_submit($form_id, $form_values) {
// store extra data in different table
}

function module_registration_validate($form, &$form_state)
{

read more

Categories: Drupal

Which Views hook to modify View results?

Drupal Module Development - Thu, 2010-06-10 18:48

Hi Folks, What Views hook do i call for this situation:
1. The Views query has been executed,
2. I want to tweak the View result (also known as $view->result)
3. I want the modified View result to available in the Services module (using the views.get web services call). Thus, hook_views_pre_render won't work here (I tried).

Thanks!

Categories: Drupal

Newbie... kick me if this is the wrong place to ask about elements I need...

Drupal Module Development - Thu, 2010-06-10 17:45

I'm versed in building old-style non-interactive html websites using just css files. I've basically built such a site with the LOOK I want, but I need the interactivity of Drupal so new Participant vendors can each have yearly-paid access to a pre-formatted set-sized division (think of a directory introducing a growing number of Participant vendors displaying their company splash as you scroll down the page).


I need each Participant vendor to have right of access only to his/her own (new Participant Drupal-assigned) pre-formatted "division" so they can submit, say, a 300x300 jpg on the left and some max amount of intro text and / or logo on the right, plus a button linking to their own entire page on the same website which they would also have tools to set up with more freedom as they wish, preferably drag and drop for their jpgs and auto-formatting textboxes easy for non-techies.


So each vendor has his own (what I always called) css predefined table to fill in within tight parameters on a front page to keep a fairly uniform site appearance. Each new table or division created gets added to the existing scrolling "list" of divisions, automatically inserted alphabetically by the Participant vendor's company name.


This is for a website introducing independent perfumers' fragrance lines, so I need a deep-toned zen-like high-fashion look, not bloggish.

read more

Categories: Drupal

module development code flows

Drupal Module Development - Thu, 2010-06-10 17:26

Hello

I have been reading tutorials about developing modules but none was for me. Strange sort of tutorials are there. Never code flows explained. It is never explained how you can write your html in module. how that html can ineract with javascript. how Php will work with this html. what is meant by $items. Everything just bull-shit. Can any buddy help me develop my custom modules I really need that.

thank you

Categories: Drupal