I'm receiving numerous repetitive instances of this error when editing my Profile2 fields:

Edit a field, save settings for that field, returns to Profile2 Manage Fields with this error:

Notice: Undefined offset: 2 in pcp_get_tagged_profile_fields() (line 292 of /.../sites/all/modules/pcp/pcp.module).

Comments

scottsawyer’s picture

same. I had 1.4 installed, disabled, uninstalled, installed dev-1.3, cleared cache, go to admin/structure/profiles, edit existing profile, I have multiple instances of the error.

BarisW’s picture

Status: Active » Postponed (maintainer needs more info)

Can you try the dev version and let me know if you still have these issues?
If not, I'll release a new version of the module ASAP.

AlfTheCat’s picture

Having this issue too. Don't have profile2 installed.

The error is printed in the watchdog several times after login. I think it's also causing a blank screen on login at /user/login (not a WSOD, on refresh the profile page does show.)

Using the latest dev of this module.

Anonymous’s picture

With 7.x.1.4 everything works fine. When i try to use dev, i get many instances of this error + pcp stops showing percentage correctly.

BarisW’s picture

I can't reproduce this. I'd love to fix it, but whatever I try, I never get these notices.

Could you tell me how to reproduce this using a step-by-step instruction?

Anonymous’s picture

I just copy the new files over the old ones and a bunch of errors occurs on the next site load.
Is there any option for debugging? Can't find anything in any log.

AlfTheCat’s picture

@BarisW
I'm getting this on several sites. I'm not sure what causes it but one thing all sites have in common is that they use the user_view panels template. Again, in my case, after logging in at /user the page blanks out when redirected to the user's profile page.

Have you tried to reproduce it by activating the user profile panels template and placing the PCP block in there?

Hope this helps.

BarisW’s picture

I haven't test it with Panels, will do ASAP. Let's hope I can reproduce it, so we can finally close this issue ;)

Anonymous’s picture

i don't use panels. here's a list of my enabled modules:

Package         Name                                           Type    Status         Version
 Chaos tool      Chaos tools (ctools)                            Module  Enabled        7.x-1.3 
 Core            Block (block)                                   Module  Enabled        7.23    
 Core            Color (color)                                   Module  Enabled        7.23    
 Core            Comment (comment)                               Module  Enabled        7.23    
 Core            Contextual links (contextual)                   Module  Enabled        7.23    
 Core            Dashboard (dashboard)                           Module  Enabled        7.23    
 Core            Database logging (dblog)                        Module  Enabled        7.23    
 Core            Field (field)                                   Module  Enabled        7.23    
 Core            Field SQL storage (field_sql_storage)           Module  Enabled        7.23    
 Core            Field UI (field_ui)                             Module  Enabled        7.23    
 Core            File (file)                                     Module  Enabled        7.23    
 Core            Filter (filter)                                 Module  Enabled        7.23    
 Core            Help (help)                                     Module  Enabled        7.23    
 Core            Image (image)                                   Module  Enabled        7.23    
 Core            List (list)                                     Module  Enabled        7.23    
 Core            Menu (menu)                                     Module  Enabled        7.23    
 Core            Node (node)                                     Module  Enabled        7.23    
 Core            Number (number)                                 Module  Enabled        7.23    
 Core            Options (options)                               Module  Enabled        7.23    
 Core            Overlay (overlay)                               Module  Enabled        7.23    
 Core            Path (path)                                     Module  Enabled        7.23    
 Core            RDF (rdf)                                       Module  Enabled        7.23    
 Core            Shortcut (shortcut)                             Module  Enabled        7.23    
 Core            System (system)                                 Module  Enabled        7.23    
 Core            Taxonomy (taxonomy)                             Module  Enabled        7.23    
 Core            Text (text)                                     Module  Enabled        7.23    
 Core            Toolbar (toolbar)                               Module  Enabled        7.23    
 Core            Update manager (update)                         Module  Enabled        7.23    
 Core            User (user)                                     Module  Enabled        7.23    
 Date/Time       Date (date)                                     Module  Enabled        7.x-2.6 
 Date/Time       Date API (date_api)                             Module  Enabled        7.x-2.6 
 Date/Time       Date Popup (date_popup)                         Module  Enabled        7.x-2.6 
 Development     Devel (devel)                                   Module  Enabled        7.x-1.3 
 Fields          Computed Field (computed_field)                 Module  Enabled        7.x-1.0 
 Fields          Email (email)                                   Module  Enabled        7.x-1.2 
 Fields          Field collection (field_collection)             Module  Enabled        7.x-1.0 
 Fields          Fieldgroup (field_group)                        Module  Enabled        7.x-1.1 
 Fields          Select (or other) (select_or_other)             Module  Enabled        7.x-2.1 
 Other           Auto Assign Role (autoassignrole)               Module  Enabled        7.x-1.0 
 Other           Entity API (entity)                             Module  Enabled        7.x-1.2 
 Other           Entity tokens (entity_token)                    Module  Enabled        7.x-1.2 
 Other           Libraries (libraries)                           Module  Enabled        7.x-2.1 
 Other           mailpdf (mailpdf)                               Module  Enabled        7.x.1.0 
 Other           Menu Token (menu_token)                         Module  Enabled        7.x-1.0 
 Other           Node Edit Protection (node_edit_protection)     Module  Enabled        7.x-1.0 
 Other           Profile2 (profile2)                             Module  Enabled        7.x-1.3 
 Other           Profile2 pages (profile2_page)                  Module  Enabled        7.x-1.3 
 Other           Standard (standard)                             Module  Enabled        7.23    
 Other           Token (token)                                   Module  Enabled        7.x-1.5 
 Other           Token Filter (token_filter)                     Module  Enabled        7.x-1.1 
 Pdf             TCPDF (tcpdf)                                   Module  Enabled        7.x-1.0 
 Profile         Profile Complete Percentage (pcp)               Module  Enabled        7.x-1.x 
 Rules           Rules (rules)                                   Module  Enabled        7.x-2.3 
 Rules           Rules UI (rules_admin)                          Module  Enabled        7.x-2.3 
 Views           Views (views)                                   Module  Enabled        7.x-3.7 
 Views           Views Flipped Table (views_flipped_table)       Module  Enabled        7.x-1.0 
 Views           Views UI (views_ui)                             Module  Enabled        7.x-3.7 
 Core            Bartik (bartik)                                 Theme   Enabled        7.23    
 Core            Seven (seven)                                   Theme   Enabled        7.23    
 Other           zen sub theme (zen_sub)                     Theme   Enabled              
kingfisher64’s picture

Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Active

Ahh, getting 21 of these messages (and I'm not bragging) using the latest dev.

Notice: Undefined offset: 2 in pcp_get_tagged_profile_fields() (line 289 of sites/all/modules/pcp/pcp.module).

@BarisW - Not sure what information I can give in addition to #9?

If it helps fix this I can give you a login to a copy of a site i'm working on with this displaying? It's a copy so you can fiddle around with the mod without consequence.

Need to use the dev as I believe 1.4 doesn't include rules integration? Wanting to do when a specific percentage is reached show a specific button in the user menu.

prezaeis’s picture

im getting same problem.
i had the module installed and it worked fine, i then upgraded it to the latest DEV version and now seeing this error which repeats like 25 times. I have profile2 which im using it for, but the block doesnt even show anymore

any fix for this?

prezaeis’s picture

FIXED IT

For anyone that may come across this, try this solution:

I upgraded (version 7) from the stable version to the Dev version today and got this error repeating several times on my site (Using it on profile2)

. Run update.php
. Clear Cache
. Edit the fields that you want to have set for the PCP module (You may have done this before but what i found is that after the upgrade the tick box on those fields was unselected, i then selected all the fields again and the error went away)

What i think happened is that after upgrade the fields were still saved in the database but for some reason in the edit page they were no longer selected, and this must have been causing a conflict or something.

But this error most likely will be solved by rechecking the fields for everyone.

bmango’s picture

Issue summary: View changes

I was having the same error message more or less. My error message was "Undefined offset: 0 in pcp_get_user_profile_values() (line 392 of /sites/all/modules/pcp/pcp.module). I was also using the Profile2 module.

I tried the solution in #12, but that didn't work. I checked line 392 where the error was occuring in the pcp.module, and it looked like there was a value missing from the $field array ($field['und'][0]['format']), so I simply added in a dummy value. I replaced the line:

$user_fields[$field_name] = $field['und'][0];

with

if (!isset($field['und'][0]['format'])) :
  $field['und'][0]['format'] = "hello";
endif;
$user_fields[$field_name] = $field['und'][0];

This got rid of all the error messages.

BarisW’s picture

Status: Active » Fixed
bmango’s picture

I tried updating to the latest dev. Unfortunately, the errors are still there. The actual errors I am getting are:

Notice: Undefined offset: 0 in pcp_get_user_profile_values() (line 389 of /sites/all/modules/pcp/pcp.module).
Warning: Invalid argument supplied for foreach() in pcp_get_user_profile_values() (line 389 of /sites/all/modules/pcp/pcp.module).

The error seems to be with a reference to a non-existent array key $field['und'][0]['format'] when it is looping through the values.

Status: Fixed » Closed (fixed)

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