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

Save to db from module Settings page

On my module settings page, I need the user to enter data that will be saved directly to a custom db table.

Normally we use form_select to create the select field, and the 3rd value of that is typically variable_get(a,b). But that value updates to the {variables} table; I really do want to put my values in a separate table.

Is there a way to do this with form_select? If not, can anyone give me a few pointers on how to approach this?

Requirement for modules to have child/parent relationships (one to many)

I have a requirement to create some custom modules to manage a Project that has multiple Tasks associated with it, (think of a Brochure with multiple sections that are tasks), im thinking of making the "tasks" out of flexinode so its easy to create new ones and maybe even the Project (or "Brochure") itself out of flexinode, but -

How do I run an external program

Ok, I feel really stupid when reviewing existing modules. I have spent several days now on trying to learn some php and module development and I have hacked existing modules to try to accomplish what I want. I know it isn't right, but need some guidance.

All I want to do is to run a program as a node. phpATM specicifically. I am not een looking to hand off accounts or anything, just run it. Here is my module code, but I just get a blank screen:

<?php
// $Id: phpatm.module

function _phpatm_all() {}

/**
* Implementation of hook_help
*/
function phpatm_help($section) {
switch($section) {
case 'admin/modules#description':
return t('Integration with phpATM');
}
}

/**
* Implementation of phpatm_perm
*/
function phpatm_perm() {
return array('access phpatm');
} // function phpatm_perm

/**
* Implementation of hook_menu
*/
function phpatm_menu($may_cache) {
$items = array();

if ($may_cache) {
$items[] = array('path' => 'phpatm',
'title' => t('phpATM'),
'callback' => '_phpatm_all',
'access' => user_access('access gallery'),
'type' => MENU_NORMAL_ITEM);
}

return $items;
}

/**
* Main phpatm display page
*/
function phpatm_page() {
require_once('/phpATM/index.php');
drupal_set_html_head(implode("\n",$css));

why hook_form_alter instead of hook_nodeapi with $op='form' ?

Hi,

I recently made a nodeapi centric module. While I started working on it I was expected
to find a 'form' as $op which will simply merge the returned form with the one created
by other modules using hook_form .

Can someone explain why instead this has been implemented with the hook_form_alter?

Thanks
Fabio

Review Module

Hello all,

Does any of you guy know of a music review module? I've seen book review modules - and movie reviews, but not a music reviews!

Has anyone heard about such a module?

JonasB

Change default field values on user registration screen

I'm trying to implement a payment system using 2Checkout. (Yes, I tried the e-commerce mod and it didn't do what I needed.) Everything is working great except that I can't figure out how to set the default field values on the user registration screen. What I want to do is take the data from their transaction over on 2checkout's site and populate the fields on the drupal registration screen with email and name. 2Checkout passes all the field values to my server when the customer is finished.

I think I know how to use php to grab the values ($_POST['username_from_2checkout']). What I need to know is where to put that value in drupal to have it show up on the registration screen in the Username: field.

I thought it would be in user.module around line 1025-26:

$default = form_textfield(t('Username'), 'name', $edit['name'], 30, 64, t('Your full name or your preferred username; only letters, numbers and spaces are allowed.'), NULL, TRUE);
$default .= form_textfield(t('E-mail address'), 'mail', $edit['mail'], 30, 64, t('A password and instructions will be sent to this e-mail address, so make sure it is accurate.'), NULL, TRUE);

But it is not obvious to me where to put it. When I view source I see:

Clearly, there is a call on this somewhere else that formats the true html.

Pages

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