I am using the profile2 module and when I edit a profile page and save I get:

Notice: Undefined index: legal_accept in legal_user_update() (line 471 of /var/www/mirp/profiles/mirp/modules/contrib/legal/legal.module).

This is because the legal agreement checkboxes aren't on that page.

Comments

rooby’s picture

Status: Active » Needs review
StatusFileSize
new467 bytes

Here is a patch to fix this.

schultetwin’s picture

StatusFileSize
new831 bytes

Need to add another check. This patch should be applied as well.

rooby’s picture

You're right, that should be moved.

Although the patch should have the changes in both patches together in one patch.

schultetwin’s picture

Patch rerolled.

rooby’s picture

Thanks for replying so fast, however I don't think I thought it through properly before.

I am going just by looking at the code at the moment but I think moving that piece of code is not the best idea.

If you are viewing someone else's account you can see the legal field but you cannot edit it (because a user can only agree for themselves). When it comes to save the page and do legal_user_update() those values are in the $edit variable.
So if it isn't the user account for the currently logged in user we want to clear the legal values as you cannot change someone else's legal agreements, which is what all the setting values to NULL is for. So my moving that if statement you are missing that step.

So I'd say this should be left as is, but if you really want it changed you should open a new issue as it would be separate to this one.

This issue should still be solved by the patch in #1.

schultetwin’s picture

Okay, I can accept that. But the issue is not solved by the first patch, I still received this specific error after applying this patch. This patch should fix it.

rooby’s picture

StatusFileSize
new706 bytes

Ah I see now.

Here is the same patch with a slight change to avoid potential undefined variable messages.

schultetwin’s picture

Status: Needs review » Reviewed & tested by the community

Ah, much cleaner, thank you.

david387’s picture

rooby's patch in comment #7 worked great!

itz_andr3’s picture

ignore

seworthi’s picture

Patch in #7 worked great, but I also applied same code to "legal_user_login()" function.

benjf’s picture

#7 works for me also

thanks!

IWasBornToWin’s picture

Has this patch been committed to the latest dev version?

simon georges’s picture

@IWasBornToWin: no, it hasn't.

robert castelo’s picture

Status: Reviewed & tested by the community » Fixed

Thanks.

Patch #7 committed to dev

Status: Fixed » Closed (fixed)

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

nicolasdiogo’s picture

sorry for the bad news.

i have just updated my Drupal installation

and it has shown the above error.
drupal - 7.16

regards,

stevieb’s picture

I also get the error with the update to 7.17

maximpodorov’s picture

Status: Closed (fixed) » Active

The same fix as in #7 is required for legal_user_insert() function. Currently, creating users by Rules produces PHP notice:
Notice: Undefined index: legal_accept in legal_user_insert()

maximpodorov’s picture

StatusFileSize
new743 bytes

The patch for legal_user_insert() function.

maximpodorov’s picture

Status: Active » Needs review
d0t15t’s picture

was having a similar error - this fixed it!

simon georges’s picture

Status: Needs review » Reviewed & tested by the community
mrsimonelliott’s picture

Patch in 21 good for me

spyderpie’s picture

I have the same issue .. is this in Dev yet?

julie

robert castelo’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in dev with #21, will include in next release.

spyderpie’s picture

Thank you ;)

Status: Fixed » Closed (fixed)

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