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

Add two fields from a User Profile-Node to the $user-object

Hello,

I created user a user profile for my site with the Node Profile module. This profile has
one field for the first name and one for the last name of the user.
I would like to add this piece of information to the $user-object.
My approach was to do this in a module via the "user_save()" function:


function uprofile_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
    .
    .
    .
case 'update': 
      if ($node->moderate && user_access('access submission queue')) { 
        drupal_set_message(t('The post is queued for approval')); 
      } 
      elseif ($node->moderate) { 
        drupal_set_message(t('The post is queued for approval. The editors will decide whether it should be published.')); 
      } 


     // I added this piece of code
     global $user;       
     if ($user->uid == $node->uid) {        // Only change something in $user-object of the profile's owner
       $firstname = array ('firstname' => $node->field_firstname[0]['value']);
       $lastname = array ('lastname' => $node->field_lastname[0]['value']);
       $fullname = array ('fullname' => ($node->field_firstname[0]['value'] . " " . $node->field_lastname[0]['value']));    
       user_save($user,$firstname);
       user_save($user,$lastname);
       user_save($user,$fullname);
      }


      break; 
    .
    .
    .

Solution for Unsupported operand types

I have got the following error

Fatal error: Unsupported operand types in C:\Program Files\xampp\htdocs\buzzintown\includes\form.inc on line 98

$form += _element_info('form');

blocks, form_ids, and hook_forms

Hey everybody,

I've having a small problem with form_ids that I can't seem to figure out.

I'm writing a module that allows the user to select the number of instances of a block that appear on any given page.
Each instance contains a form that can have custom properties. The problem is that since each form was creating using the same builder function, the forms all have the same "form_id", so the input from only the first form on the page is used in the submit function.

one content type - with another content type relation

i am using CCK to create the content type.

i have created two content type,
(1) request
(2) response

now i want to perform following task
(1) one user cas post a request using "request"
(2) another can give a response/reply to the posted request-"request".
i.e. on the post there is comment

i need same type of solution but it would be between two different content types.
so i can track that on one request how much response i have got.and on those response on which i have accepted and rejected.

how to link one content type with other

i am using CCK to create the content type.

i have created two content type,
(1) request
(2) response

now i want to perform following task
(1) one user cas post a request using "request"
(2) another can give a response/reply to the posted request-"request".
i.e. on the post there is comment

i need same type of solution but it would be between two different content types.
so i can track that on one request how much response i have got.and on those response on which i have accepted and rejected.

I need some help.. i cant get the value of my node id..

Hi im trying to make my own module and below is my code. When i insert into the database everything is there except for nid and vid.. id appreciate any help from you guys.. thanks..

module code:

<?php
// $Id$

/**
* @file
* Provides a "daily report" node type.
*/

/**
* Implementation of hook_node_info().
*/
//function dailyreport_node_info() {
// return array(
// 'dailyreport' => array(
// 'name' => t('Daily Report'), // Required.
// 'module' => 'dailyreport', // Required.
// 'description' => t('Submit or view daily reports'), // Required.
// 'has_title' => TRUE,
// 'title_label' => t('Module Name')
// )
// );
//}

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

// Do not cache this menu item during the development of this module.
if (!$may_cache) {
$items[] = array(
'path' => 'dailyreport',
'title' => t('Daily Reports'),
'callback' => 'dailyreport_front',
'access' => user_access('submit report'),
);
$items[] = array(
'path' => 'dailyreport/submit',
'title' => t('Submit Report'),
'callback' => 'submitform_page',
//'callback arguments' => array('dailyreport_entry_form'),
'access' => user_access('submit report'),
);
$items[] = array(
'path' => 'dailyreport/view',

Pages

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