I get this error after installing:

Notice: Undefined index: use_page in profile2_page_profile2_type_update() (line 260 of modules/all/profile2/contrib/profile2_page.module).

it happens periodically.

Comments

the_g_bomb’s picture

I have noticed this in my syslogs after a cron run. Further investigation will happen at some point.

sadashiv’s picture

Status: Active » Needs review

I faced the same problem. I found a solution when I checked profile_type table.

Steps to replicate this issue are:
1) Create a profile type (with profile2 page module disabled).
2) Enable profile2 page module.

This will throw that error.

The reason behind this is that data value in profile_type table is not updated to save use_page value.

Temporary fix for this would be to edit the profile_type and click on save again so the value gets updated in the database.

Permanent fix for this issue would be profile2 page adds a .install file with following code

/**
 * Implements hook_enable().
 */
function profile2_page_enable(){
  $profile_types = profile2_get_types();
  foreach($profile_types as $profile) {
    if (!isset($profile->data['use_page'])) {
      $profile->data['use_page'] = 0;
      $profile->save();
    }
  }
}
/**
 * Implements hook_disable().
 */
function profile2_page_disable(){
  $profile_types = profile2_get_types();
  foreach($profile_types as $profile) {
    if (isset($profile->data['use_page'])) {
      unset($profile->data['use_page']);
      $profile->save();
    }
  }
}

Can be replicated in 7.x-1.3 release too.

Hth,
Sadashiv.

sadashiv’s picture

Priority: Normal » Major
spleshka’s picture

Issue summary: View changes
Priority: Major » Minor
Status: Needs review » Postponed (maintainer needs more info)

Tried on latest dev, but could not reproduce an issue. Please, tell me how to reproduce issue on a clean installation.
This issue has a minor prio, because it has no influence on module functionality.

andyg5000’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new815 bytes

I came across this when a profile type didn't have a value for $entity->data['use_page']. This profile type was created via features, so maybe that value is missing from a features export. Either way, it doesn't cause any problems and adding a !empty($type->data['use_page']) check to the update function solves this problem.

Sneakyvv’s picture

andyg5000's patch works, but like he said, the actual problem is that the use_page value is not exported via features. BUT this is only not being exported if the value is not in the database. If you save the profile type with the "use_page"-checkbox ticked, and then save it again with the checkbox unticked, a zero value will be in the database, and the value will also be in a features export.

guypaddock’s picture

It seems like this happens if you export a profile type with Features without "Profile2 Pages" being enabled, and then later enable "Profile2 Pages". That being the case, it really does seem like #5 is the correct approach.

  • Spleshka committed 6edbec0 on 7.x-1.x authored by andyg5000
    Issue #1675900 by andyg5000, Spleshka, SocialNicheGuru, GuyPaddock,...
spleshka’s picture

Status: Needs review » Fixed

I agree with @GuyPaddock and @Sneakyvy that the real issue is not in the module but in the correct site building process. Although I don't see any harm in commiting @andyg5000's patch to prevent php notices. Thanks everybody, the issue is resolved now.

Status: Fixed » Closed (fixed)

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

hamrant’s picture

I get this error in profile2 7.x-1.3, patch #5 helped me.
I wonder when will be the next stable release of the module?