In admin/config/people/user_readonly page the system still showed a notice, despite the patch in #8.

Comments

itivet’s picture

Get this error message after doing it

Parse error: syntax error, unexpected ')', expecting ']' in /homez.31/cliniqued/www/sites/all/modules/user_readonly/user_readonly.module on line 77

So I deleted the '[' to have this line
if(isset($element[$element_value_name][0]["#field_name"])) {

afterwhile I get this error message

Warning : Invalid argument supplied for foreach() dans form_type_checkboxes_value() (ligne 2233 dans /homez.31/cliniqued/www/includes/form.inc).

any idea??

itivet’s picture

I get also this error message when I'm on user account
Notice : Undefined index: #field_name dans user_readonly_form_alter() (ligne 242 dans /homez.31/cliniqued/www/sites/all/modules/user_readonly/user_readonly.module).

coderintherye’s picture

You should take note that the OP's post has an error in the code, it should be:

 if(isset($element[$element_value_name][0]["#field_name"])) {
Niremizov’s picture

Thx for solution tip. I have used this code above and error was fixed. But then one more notice appeared on the users page

Notice: Undefined index: #field_name in function user_readonly_form_alter() (line 238 inside file \htdocs\git\personal\sites\all\modules\user_readonly\user_readonly.module).

To fix it the same changes were made inside user_readonly_form_alter() function, line 237

      if (isset($data[$value][0]["#field_name"])) {
      ...
stephenrobinson’s picture

I added a new user field, which doesn't show up on the config page for user_readonly, and get this error whenever someone goes to edit their profile:

Notice: Undefined index: #field_name in user_readonly_form_alter() (line 238 of /www/htdocs/sites/all/modules/contrib/user_readonly/user_readonly.module).
sachbearbeiter’s picture

Issue summary: View changes

same problem - please mark this module abandoned - so that others don't run on old errors ...

jyloss’s picture

I had the same problem: undefined index : #field_name ... and it's working now.

After analysis, the problem was for 2 new fields defined as 'Integer' (the other was defined as 'text' or 'List (text)'.

I removed the 2 'Integer' fields and I create new ones with the same name but with the type 'Text'.
-> It's working now:
- No error when I opened the confguration of the user_read_only module and I can see the 2 fields (not visible before)
- I can configure the permission for those 2 fields (visible for admin and not for the user having other role)
- When I edit an user, no error displayed and the 2 fields matches the user_read_only configuration.

Remark : In my case, there is no difference if I configure those fields as 'Text' in place of 'Integer'.
I understand that it can give a problem for other project.

logii’s picture

Attached patch for convenience sake.

  • deekayen committed 9f64b5a on 7.x-1.x authored by logii
    Issue #1253440 by logii, itivet, coderintherye, jjsanz, Niremizov,...
deekayen’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

scott.olipra’s picture

Issue summary: View changes
StatusFileSize
new799 bytes

I received the same error, "undefined index" (several instances, and repeatably) in admin/config/people/user_readonly .

I looked at the patch in #8.
It appears to me that the same should be done in another place, to match; up in the function user_readonly_admin_settings().

I'm attaching a second patch here.