I'm using the Content Profile module and I enabled Userpoints CCK Field so I could reward users for doing things like uploading a profile picture. However, I have a very simple signup form and I hide all the things beyond name, email, and location during the initial signup process.

This wasn't an issue until I created a block view with user profile information that displays in the sidebar of every page. The view comes back "empty" unless I include the Content Profile form in the signup field (though I still keep it hidden in order to maintain the streamlined signup process).

Doing this triggered an issue where non-required forms that don't get filled in creat an error with Userpoints CCK Fields. I'm not sure if it's just my use case, or if any form with a non-required field left blank also throws an error. I'm pretty new to the Drupal stuff... but I just thought I'd let y'all know about the bug. Here's the specific error:

warning: Invalid argument supplied for foreach() in /home/phlunk/public_html/sites/all/modules/userpoints_field/userpoints_field.module on line 247.

Let me know if you need anymore details.

Comments

DickSwart’s picture

same issue here

kawal’s picture

Status: Active » Closed (fixed)

Hi,
I too recently used this module and found out the bug and fixed it as follows

Before line 247:
We need to check whether $field exists
So from line 246 the code in "default" case should be

if ( $field )
 {
     foreach ( $field as $instance ) {
        if ( trim( $instance[ 'value' ] ) != '' )
          $num_values++;
  }
}

Hope this helps!

wikibi’s picture

Thanks, worked for me!