Notice: Trying to get property of non-object in profile2_category_access() (line 513 of E:\wamp\www\sites\all\modules\profile2\profile2.module).

Comments

bachbach’s picture

i'm working on a migration with migrate and migrate extra, and i have many rollback, that give me the same message

kaizerking’s picture

If you have custom modules, check the modules, for custom field/fields for incorrect creation and updates. I have found that in one of my custom modules, though the code and arguments are correct, one of the fields was not correctly defined.So while creating the functions run correctly but while deleting . the fields are not recognised to be deleted and since entity controller cannot find all the fields and it will not be able to delete the fields and since fields still exists for the entity, you get the error and will not be able to delete the profile. check your contrib modules for this

Anonymous’s picture

I think it has something to do with the deleted profile continues on some cache? I've cleared my cache and now the notice has gone!

matt.rad’s picture

Status: Active » Closed (fixed)

Same issue. Clearing the cache in admin/config/development/performance solved it for me too!

ssoulless’s picture

Status: Closed (fixed) » Needs work

Well actually this is a bug, it should not be happening, this is a bug and needs work, ill see if i can make a commit to the actual version, and begin with my developer contributions in drupal =D

cord1’s picture

Issue summary: View changes

This is a bug.
I solved it by enclosing an if around return like this

if ($type_name != "(deleted typename)") {
return ($account->uid > 0 && $profile->type()->userCategory && profile2_access('edit', $profile));
}

spleshka’s picture

Status: Needs work » Postponed (maintainer needs more info)

Guys, can't reproduce this bug. Can someone write down steps to reproduce it?

vintorg’s picture

Confirmed clearing cache fixes problem.

@Spleshka - Create a new profile type. Add some fields, then use it in some way. Then delete it.

DrCord’s picture

Yeah, I can confirm this bug as well, exactly as vintorg says.

spleshka’s picture

I am using the latest dev release. I tried:
1. Create a new profile type
2. Add two fields to the profile type
3. Add data for those two fields
4. Delete profile type
And I see no php warning.

A also tried:
1. Create a new profile type
2. Add two fields to the profile type
3. Add data for those two fields
4. Delete field from the profile type
Still no warnings.

So please, if you want me to fix this issue, provide a detailed information about the issue. Give me a clear steps to reproduce the issue, and the number of release you are using.

Leave this issue in the "Postponed" state, because I still need additional information.

kopeboy’s picture

This is happening to me since ages.

Everytime I just view a View which has enabled some bulk operations with a rule component doing anything with a user account field I get this (repeated more than once)

Notice: Trying to get property of non-object in profile2_access() (line 694 of /srv/bindings/bde2e1dc85df4b15b052058e9e181d97/code/sites/all/modules/profile2/profile2.module).

Just updated to Profile2 and VBO latest dev, and latest stable releases of: entity api, panels, ctools, views
flushed and rechecked. Still the same notices.

It is not causing any actual error (at least that I can notice) but is very annoying..

Steps to reproduce:

  1. create a rule component with a provided entity (my case is a commerce_product)
  2. put some condition or action acting on a field inside a profile or even simply the site current user
  3. create a view page showing the entity type of the component, display fields
  4. add a bulk operations field and activate the created component
  5. save and visit the view page

UPDATE: steps to fix this:

  1. go to the rule component
  2. under settings, check the "Configure access for using this component with a permission."
  3. give permission to the user roles who will see the VBO view.
  4. notices on the view page are gone

But:

  • That shouldn't be needed (if I am administrator or any role that can edit the component).
  • Why profile2 should show me notices on a page that has nothing to do with a profile2?
abhinya’s picture

This happened after i removed the main profile from the profile 2 config page.
Clearing the Cache removes the notification.