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

Hot to create a new module from scratch

Hi,

I have working experience with drupal, also used few modules(installation only). Never customized anything related to drupal. Now, I am looking to builde a module which need to have a better understanding of rhow to develop modules for drupal. I am looking for information which can help me to get a better idea to develop a module.
here is what i am going to do with that module:

1. When a user comes to our Drupal site and requests to set up an account we require them to enter a code that was given to them by Admin. (Admin would have entered that code into the database table).

2. Once the user clicks submit and Drupal begins processing we take the code that the user has entered and look it up against into the table.

a. If the code exists we set up an account for them in Drupal and with permissions that will vary based on the code the user entered. If they entered a code from

i. codeA - they will become a user of type codeA and be able to access the restricted section and get a special link in the email that is sent out to them.

ii. codeB - they will become a user of type codeB and be able to access the restricted section.

cPanel Integration Module (CEMail)

Upon high request of a module to be upgraded from 4.7 to 5.x, and it not happening, I created a new module that adds, and removes e-mail accounts upon creation and deletion of user accounts in Druapal. This module directly connects to the cPanel, and creates these e-mail accounts so you don't have to, and when you remove a user from the Drupal User manager panel, it automatically deletes the e-mail account so you dont have to. I hope this helps some of you out.

Getting the values selected in a multi-select list

Hi,

I'm creating my first custom node module usin Forms API for 4.7.4. I've included a multi-select dropdown list (lets say.. value2) as a form element.

Is it possible to identify/check all the options in the list that were selected ?? I would like to insert a separate record into a table for each option selected from the list. Each record.

For example, if the user enters 'cs20a' for form item value1 and selects 1,2,3 as multiple values in list value2, I would like to insert the following records into table test...

table test

Module.Profile ... best way to defeat security

Greets,

Question: What is the best way to store user specific custom data fields to be used by php content pages to produce reports, yet not allow the user to change/edit those fields? (Data to be set my admins)

Background:

Desiring to use Drupal to handle php reports (as content) and leverage the Authentication and Menu system. I have installed both "nodeaccess" and "menu by role" and they work great and life was good and then the hero rode off into the sunset.

Then I needed to being able to define "custom fields" in a user profile that can be used by different php reports (content) to limit/expand information in the reports. I turned on the Module.Profile and set some user fields, set access to Private, and accessed them in the reports and they worked great and life was good and then the hero rode off into the sunset.

Then I woke up and realized that the users can themselves change those fields ... then the earth shook and dark clouds formed ... so I set the privs on the fields to "Hidden Profile" and the user was denied access ... Geat! But the PHP Content reports were denied access as well ... Bad :-(

Problems with simple form

Hi,

I'm new to Drupal and I'm looking to create a customized field that can plug into an existing content type. I'm basically trying to set up a list of input field rows with 3 columns and I'm encountering a few problems for little things that seem like they should be simple enough.

I have the following to implement the hook_widget() to build up my form for user editing:

<?php

function ingredients_widget($op, &$node, $field, &$items, $delta = NULL) {
switch ($op) {
case 'form':

$form = array();
$form[$field['field_name']]['#tree'] = TRUE;
$form['#attributes'] = array('class' => 'container-ingredients');
$form['#theme'] = array('ingredients_form_fieldgroup');

$form[$field['field_name']]['value'] = build_ingredient_input_fields();
$form[$field['field_name']]['#title'] = $field['widget']['label'];

return $form;
}
}

function build_ingredient_input_fields() {

$form['ingredients']['quantity'] = array(
'#type' => 'textfield',
'#title' => t('Quantity'),
'#maxlength' => 8,
'#size' => 8,
);

$form['ingredients']['units'] = array(
'#type' => 'select',
'#title' => t('Units'),
'#options' => array(0 => t('option 1'), 1 => t('option 2')),

How to create HIERARCHICAL menu of groups and subGrouops?

Hi,
i'm using the og Groups module, and the related modules (subgroups, block_visibilty), i have à view of the list of groups, but this list don't display an HIERARCHICAL menu of groups:(
Anyone hav a ideia to do that?
thanks

Pages

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