node content not displayed anymore after update

olio - November 5, 2007 - 13:31
Project:Node Profile
Version:5.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,
I use the nodeprofile module since several months in conjunction with the nodefamily and usernode modules. Now, I suddenly noticed a strange behaviour of my nodeprofiles:
I deactivated "use as nodeprofile" for a content type and activated it again later. Afterwards, only the themed box with the title got displayed, but none of the fields. I tried it with other content types (cck and also module generated content types), same result. Reinstalled node profile, node family and subform modules, in vain.

One thing is curious: If I unmark these content types again, then mark them 'manually' (through nodefamily settings) as childs of usernode, they get displayed as supposed ! Btw: For display, I use the method described at the end of the nodeprofile module's readme file.
I suppose this has something to do with one of the module's updates, because up to now I never had this problem.

Please tell me if you need more information or if I should test something specific.
Thanks!

#1

fago - November 13, 2007 - 13:48

hm, which output variant are you using? Edit link enabled?
Please check the html source too, perhaps there is a css issue.

#2

fago - November 13, 2007 - 13:48
Status:active» active (needs more info)

http://drupal.org/comment/reply/189433/628604

#3

olio - November 14, 2007 - 14:05

Hi fago,
thanks for your reply and sorry for the delay.
I tested each possible output variant, without any effect.
But I noticed something else as I changed my usernode template file: I didn't use the $content variable of the usernode inside the template file to print out the nodeprofiles. My approach was to put the nodeprofiles in two columns in two variables ('nodeprofiles_col1', 'nodeprofiles_col2') inside the template.php (see below) and to print them out inside the usernode template file. When I print the $content variable, the nodeprofiles appear.
But the strange thing is, that up to now, my approach worked fine, and works again if I uncheck the 'use as nodeprofile' checkbox for each of the node types and mark them as childnodes of usernode via the userfamily module.
So, all in all, I think, it's not a bug, but maybe something has changed in how the nodeprofile module 'delivers' the nodeprofile contents ?
Here is what I put in the _phptemplate_variables() function inside template.php:

<?php
$variables
= array();
switch (
$hook) {
  case
'page':
    if (
arg(0)=='usernode' || arg(0)=='node' && is_numeric(arg(1))){
     
// Get the currently logged in user.
     
global $user;

     
$types_col1 = array();
     
$types_col2 = array();
   
     
$destination = drupal_get_destination();
   
     
//define where to display the different nodeprofile types (column 1 or 2 on the page)
     
$types_col1 = array(
       
'languageform',
       
'uprofile_business',
      );

     
$types_col2 = array(
       
'uprofile_contact',
       
'uprofile_personal'
     
);

     
//Get the node id of the parentnode ('usernode')
     
if (arg(0) == 'usernode'){
       
$nid = $usernode->nid;
      }
      if (
arg(0)=='node' && is_numeric(arg(1))) {
       
$nid = arg(1);
      }
     
$node = node_load($nid);

     
// Load all children of usernode ( = nodeprofiles ), sorted by content type.
     
$children = nodefamily_relation_load_by_type($nid);
   
     
//get nodeprofiles if they exist, else notify user and show "add <node type>" link
     
foreach($types_col1 as $type){
        if(isset(
$children[$type])){
         
$output_col1[$type] = array(
           
'#type' => 'nodeprofile_display_teaser',
           
'#title' => node_get_types('name', $type),
           
'#tabs' => array('edit'),
           
'#uid' => $node->uid,
           
'#content_type' => $type,
           
'#weight' => 0,
           
'#suffix' => '<br />',
          );
        } elseif (
$user->uid == $node->uid || user_access('administer content')) {
         
//Check if the current user the profile owner or does he has administration privileges ?
         
$typename = node_get_types('name', $type);
         
//Case 1: It's the profilenode of the current user
         
if ($user->uid == $node->uid){
           
$profiles_not_set1 .= '<div class="nodeprofile_not_set">' . t('Sie haben noch kein @typename erstellt.', array('@typename' => $typename)) . '<br />';
           
//If no nodeprofile of type $type exists, then do this:
           
$add_profile  = l(t($typename . ' erstellen'), 'user/' . $user->uid . '/edit/' . $type, array(), $destination, NULL, FALSE, TRUE);
           
$profiles_not_set1 .= $add_profile .'</div>';
          } elseif (
user_access('administer content')){
         
// Case 2: User has administration privileges; so let him create this node.
           
$profiles_not_set1 .= '<div class="nodeprofile_not_set">' . t('Der Nutzer hat noch kein @typename erstellt.', array('@typename' => $typename)) . '<br />';
           
//If no nodeprofile of type $type exists, then do this:
           
$add_profile  = l(t($typename . ' erstellen'), 'user/' . $node->uid . '/edit/' . $type, array(), $destination, NULL, FALSE, TRUE);
           
$profiles_not_set1 .= $add_profile .'</div>';

          }
        }
      }

      foreach(
$types_col2 as $type){
        if(isset(
$children[$type])){
         
$output_col2[$type] = array(
           
'#type' => 'nodeprofile_display_teaser',
           
'#title' => node_get_types('name', $type),
           
'#tabs' => array('edit'),
           
'#uid' => $node->uid,
           
'#content_type' => $type,
           
'#weight' => 0,
           
'#suffix' => '<br />',
          );
        } elseif (
$user->uid == $node->uid || user_access('administer content')) {
       
//Check if the current user the profile owner or does he has administration privileges ?
         
$typename = node_get_types('name', $type);
         
//Case 1: It's the profilenode of the current user
         
if ($user->uid == $node->uid){
           
$profiles_not_set2 .= '<div class="nodeprofile_not_set">' . t('Sie haben noch kein @typename erstellt.', array('@typename' => $typename)) . '<br />';
           
//If no nodeprofile of type $type exists, then do this:
           
$add_profile  = l(t($typename . ' erstellen'), 'user/' . $user->uid . '/edit/' . $type, array(), $destination, NULL, FALSE, TRUE);
           
$profiles_not_set2 .= $add_profile .'</div>';
          } elseif (
user_access('administer content')){
         
// Case 2: User has administration privileges; so let him create this node.
           
$profiles_not_set2 .= '<div class="nodeprofile_not_set">' . t('Der Nutzer hat noch kein @typename erstellt.', array('@typename' => $typename)) . '<br />';
           
//If no nodeprofile of type $type exists, then do this:
           
$add_profile  = l(t($typename . ' erstellen'), 'user/' . $node->uid . '/edit/' . $type, array(), $destination, NULL, FALSE, TRUE);
           
$profiles_not_set2 .= $add_profile .'</div>';
         
          }
        }
      }
   
     
$profiles_set1 = drupal_render($output_col1);      
     
$profiles_set2 = drupal_render($output_col2);
     
$vars['nodeprofiles_col1'] = $profiles_set1 . $profiles_not_set1;
     
$vars['nodeprofiles_col2'] = $profiles_set2 . $profiles_not_set2;
    }
...
?>

If nobody else should have the same kind of problem, then please don't waste time with this. I will use the nodefamiliy instead.
Anyway, thanks for your help (and your module!).

#4

fago - November 15, 2007 - 14:12
Status:active (needs more info)» fixed

ok, if it's not bug, then let's close it. However I'm not aware of any changes, which should affect this.

#5

Anonymous - November 29, 2007 - 14:23
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#6

activelyOUT - May 11, 2008 - 23:42

subscribing

#7

activelyOUT - May 11, 2008 - 23:43

subscribe

 
 

Drupal is a registered trademark of Dries Buytaert.