We have moved to Github. Please open tickets there.

Opened 2 years ago

Closed 2 years ago

#3421 closed Defect (fixed)

isAdmin() error on registration

Reported by: ismayil.khayredinov Owned by:
Priority: normal Milestone: Elgg 1.7.9
Component: Core Version: 1.7
Severity: minor Keywords:
Cc: brett@… Difficulty: trivial

Description

I am building an alternative user validation functionality, but use of isAdmin() method in actions/register.php causes a fatal error. I am registering an event handler that disables the registered user depending on certain criteria.
It would be good to have the code check to see if the entity is still enabled before calling isAdmin().

Change History (5)

comment:1 Changed 2 years ago by cash

Is the fatal error = "calling method on a non-object"?

comment:2 Changed 2 years ago by ismayil.khayredinov

Yes, since the object was previously disabled through disable() in the event handler.

[Thu May 05 12:10:19 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function isAdmin() on a non-object in D:
Program Files
Wamp Test Server
www
elgg177
actions
register.php on line 53, referer: http://localhost/elgg177/pg/register/

I've found a workaround for now, but it would be good to allow for custom uservalidation methods.

comment:3 Changed 2 years ago by cash

  • Milestone changed from Needs Review to Elgg 1.7.9

comment:4 Changed 2 years ago by cash

  • Difficulty set to trivial

This should be as easy as changing

if (!$new_user->isAdmin()) {

to

if ($new_user && !$new_user->isAdmin()) {

1.8 should have a cleaner registration action because validation is not built into core the same way. Haven't check yet though.

comment:5 Changed 2 years ago by brettp

  • Resolution set to fixed
  • Status changed from new to closed

(In [svn:9122]) Fixes #3421. Checking for user entities before accessing methods during registration.

Note: See TracTickets for help on using tickets.