Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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)
Comment | File | Size | Author |
---|---|---|---|
profile_browse.patch | 910 bytes | Ozeuss | |
Comments
Comment #1
Ozeuss CreditAttribution: Ozeuss commentedComment #2
Ozeuss CreditAttribution: Ozeuss commentedComment #3
Dries CreditAttribution: Dries commentedI 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.
Comment #4
Ozeuss CreditAttribution: Ozeuss commentedYes, 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
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'.
Comment #5
Dries CreditAttribution: Dries commentedYou're right. Committed to CVS HEAD. Thanks!