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

Get Form Variables

Hi Drupal- Users.

I am a total Drupal Newbee and at the moment i am try to develop a little form with the new form api, but i can't work with the sended form variables.

Here is my code:

Converting _nodeapi (4.6->4.7) and 2 text fields on one line

Dear Drupal Community,

After digging through the Converting 4.6 modules to 4.7, the hook_nodeapi for 4.6 and 4.7 API pages, the hook_nodeapi('form x', ...) replaced by form api section, the hook_user, and a multitude of searches along the lines of “HowTo convert a 4.6 module to a 4.7 module,” I'm stumped. I've managed to learn/thieve/borrow enough other code to get the other 700-800 lines of this modified AdSense module to work as desired, but the proper method for converting these two items continues to baffle me:

- Converting "function adsense_nodeapi(&$node, $op, $teaser, $page)"
[moved to separate thread in this post as this one got long with the Form Updater tidbits.]

- Placing two form text fields on a single line.
In the example below "Version 4.6.x: foreach(range(1,200)..." , while it has all the inherent drawbacks of embedded hardcoding, it did produce two text boxes on the same screen line. Is there anyway within the regular "$form['name'] = array(..." methodology to archive the same thing?

Can I impose on some nice coder to review/fix what I tried? Even if you would post an RTFM with a link to something that gives a concrete example on what exactly should be changed, I'd be happy.

Thanks,

M.J. Taylor
(And no, I didn't write the original code...)

PS: As an aside from my questions, and mostly for anyone stumbling on this thread, the Form Updater on lullabot.com http://www.lullabot.com/formupdater is a very useful tool. A couple of notes are in order though, when it mentions you will have to wrangle with fieldsets, it's not kidding. The field set element should be placed at the top of your grouping, and there needs to be a rolling Form tagging as you go. An Example:

Version 4.6.x

foreach(range(1,200) as $channel) {

$output .= '

Adsense '
. 'ID '"> & Readable Name #' . $channel . '' .
'

Q: Create page from module?

Say I have a node called "mynode". I want to display the content created from the node accross multiple pages. For instance:

www.url.com/mynode

would also have the pages

www.url.com/mynode/images
www.url.com/mynode/summary
www.url.com/mynode/extra

Does anybody know how I could achieve something like this?

New Field Type "Upload: File Name" in module Views

This include file for module Views (/modules/views/modules/views_upload.inc) implements views functionality on behalf of upload.module. Enjoy!

privatemsg.module menu problem

i have downloaded "privatemsg.module". i can't find the "privatemsg" on the menus, it is lost. i can enter the code like "http://www.blocparty.org/?q=privatemsg " but it isnt on the menus. what can i do? please help.

Userchange Module Help

I made this module from another forum topic. The purpose is to disable the changing of a user name and password. It does a great job at that. The only problem I have is when I want to create a new user as an administrator I have to disable this module. It is blocking any of the form fields included in the userchange module code, these fields are obviously crucial for making a user.

Does anyone know any drupal speficic code that can make this module be null for an administrator on the site? If not, does anyone know how to automatically disable this code when an administrator logs in?

<?php
function userchange_help($section) {
  switch ($section) {
    case 'admin/modules#description':
           return t('This prevents office users from changing their user name and password.');
  }
}

function userchange_user($op, &$edit, &$user, $category = NULL) {
  switch ($op) {
    case 'validate':
      //lets validate the user info
      if ($_POST['edit']['name'] != $user->name) {
          form_set_error('name', t('You cannot change your user name right now. Only an administrator can perform that task.'));
      }
	if ($_POST['edit']['pass1'] != $user->pass1) {
          form_set_error('pass1', t('You cannot change your password right now. Only an administrator can perform that task.'));
      }
	if ($_POST['edit']['pass2'] != $user->pass2) {
     }
      break;
  }
}
?>

Pages

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