when viewing the profile page without further arguments (that is, viewing 'http://example/com/profile' with non-admin users, an error is thrown:

notice: Undefined property: stdClass::$visibility in /var/www/d7/modules/profile/profile.module on line 287.

This is because on profile.pages.inc the $field object is constructed out of a SELECT query without the visibility. In the patch it is added (i guess using SELECT * can be used as well)

CommentFileSizeAuthor
profile_browse.patch910 bytesOzeuss
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ozeuss’s picture

Title: undefined property: stdclass visibility » undefined property: stdclass visibility when viewing profile pages
Ozeuss’s picture

Status: Active » Needs review
Dries’s picture

I can't seem to reproduce this problem, nor can I seem to trace down the problem to the function that you patched. Care to provide some more information, or maybe a simpletest to go with this? Thanks.

Ozeuss’s picture

Yes, of course.
This notice is thrown only when viewing this page with users that do not have 'administer users' privileges, and only on the "example.com/profile" page (which shows the user list).
The chain is like this :
profile_browse is the menu callback in charge of showing this page, which makes the a query (the patched one) and issues a call to _profile_update_user_fields($fields, $account).
_profile_update_user_fields in turn calls profile_view_field, which is the source of the notice, due to the line

 && (user_access('administer users') || $field->visibility != PROFILE_PRIVATE)

Since the original query does not SELECT the visibilty field, it is non-existent.
if the user has the correct permissions, the notice is 'escaped'.

Dries’s picture

Status: Needs review » Fixed

You're right. Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

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