Update failure - Call to a member function getUserByUsername() on a non-object

I was updating FreePBX and got this error and was unable do anything else. Any suggestion on how to fix this would be appreciated.

Whoops \ Exception \ ErrorException (E_ERROR)
HELP
Call to a member function getUserByUsername() on a non-object
/var/www/html/admin/modules/userman/Userman.class.php
1481. * @param string $username The User Manager Username
1482. * @return bool
1483. /
1484. public function getUserByUsername($username, $directory=null) {
1485. if(!empty($directory)) {
1486. $user = $this->directories[$directory]->getUserByUsername($username);
1487. } else {
1488. $user = $this->globalDirectory->getUserByUsername($username);
1489. }
1490. return $user;
Server/Request Data
SCRIPT_URL /admin/config.php
SCRIPT_URI http://192.168.0.11/admin/config.php
HTACCESS on
HTTP_HOST 192.168.0.11
HTTP_CONNECTION keep-alive
CONTENT_LENGTH 35
HTTP_CACHE_CONTROL max-age=0
HTTP_ORIGIN http://192.168.0.11
HTTP_UPGRADE_INSECURE_REQUESTS 1
HTTP_USER_AGENT Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
CONTENT_TYPE application/x-www-form-urlencoded
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,
/*;q=0.8
HTTP_REFERER http://192.168.0.11/admin/config.php
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_ACCEPT_LANGUAGE en-US,en;q=0.8
HTTP_COOKIE lang=en_US; PHPSESSID=8vu2bqrvv6e5shrf1a662u5vp4; _ga=GA1.1.1338671844.1498717944; _gid=GA1.1.856855747.1498717944
PATH /sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE Apache/2.2.15 (CentOS) Server at 192.168.0.11 Port 80
SERVER_SOFTWARE Apache/2.2.15 (CentOS)
SERVER_NAME 192.168.0.11
SERVER_ADDR 192.168.0.11
SERVER_PORT 80
REMOTE_ADDR 192.168.0.32
DOCUMENT_ROOT /var/www/html
SERVER_ADMIN root@localhost
SCRIPT_FILENAME /var/www/html/admin/config.php
REMOTE_PORT 53075
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD POST
QUERY_STRING
REQUEST_URI /admin/config.php
SCRIPT_NAME /admin/config.php
PHP_SELF /admin/config.php
REQUEST_TIME 1498772266
GET Dataempty
POST Data
username 2000
password Xxxxxxxx
Filesempty
Cookies
lang en_US
PHPSESSID 8vu2bqrvv6e5shrf1a662u5vp4
_ga GA1.1.1338671844.1498717944
_gid GA1.1.856855747.1498717944
Session
langdirection ltr
module_name
module_page
Environment Variablesempty
Registered Handlers
0. Whoops\Handler\PrettyPageHandler

I’ve seen that before, but I can’t remember how to duplicate it. You should be able to fix it by logging in via ssh and running ‘fwconsole ma upgradeall’

1 Like

Thanks, that fixed it. Running ‘fwconsole ma upgradeall’ installed the missing dependancy, userman.

I’m having the similar issue post update.
If I try to edit any users in userman I see the same error as Stuart.

fwconsole ma upgradeall didn’t fix it.

Restored pre update backup and it works.
update again and stuck again.

Can you send us your backup?

Unfortunately not.

I restored a linode backup.

You can make a backup in FreePBX

I’m dead too… running updates and got this:

Whoops \ Exception \ ErrorException (E_ERROR)

Call to a member function getUserByUsername() on a non-object

/var/www/html/admin/modules/userman/Userman.class.php

	 * @param string $username The User Manager Username
	 * @return bool
	 */
	public function getUserByUsername($username, $directory=null) {
		if(!empty($directory)) {
			$user = $this->directories[$directory]->getUserByUsername($username);
		} else {
			$user = $this->globalDirectory->getUserByUsername($username);
		}
		return $user;

I need a backup to progress further.

Thanks! Fixed my issues!

1 Like

I updated last night and now have the following error, can anyone point me in the right direction ? Thanks

After running updates last night I have this issue this morning. I’m new to FreePBX and Asterisk and could really use some help. Below is the message I’m getting when trying to edit an extension.

Also if I go to User Manager it just says loading please wait but nothing loads.

I decided to try I have ran the fwconsole update , below is what I got but nothing has changed.

[root@localhost ~]# fwconsole ma upgradeall
No repos specified, using: [standard,extended,unsupported,commercial] from last GUI settings

Upgrading: arimanager, fax, userman
Upgrading arimanager…
Starting arimanager download…
Processing arimanager
Verifying local module download…Verified
Extracting…Done
Module arimanager successfully downloaded
Unable to install module arimanager:

  • Requires engine asterisk (>= 12), you have: asterisk 11.25.1
    Updating Hooks…Done
    Upgrading fax…
    Starting fax download…
    Processing fax
    Verifying local module download…Verified
    Extracting…Done
    Module fax successfully downloaded
    Moving simu_fax feature code from core…done
    Updating simu_fax in miscdest table…done
    Checking if legacy fax needs migrating…already done
    Migrating all fax users to usermanager
    PHP Fatal error: Call to a member function updateUser() on a non-object in /var/www/html/admin/modules/userman/Userman.class.php on line 2071
    Whoops\Exception\ErrorException: Call to a member function updateUser() on a non-object in file /var/www/html/admin/modules/userman/Userman.class.php on line 2071
    Stack trace:
  1. () /var/www/html/admin/modules/userman/Userman.class.php:2071
    Upgrading userman…
    Starting userman download…
    Processing userman
    Downloading…
    216992/216992 [============================] 100%
    Finished downloading
    Extracting…Done
    Module userman successfully downloaded
    Generating CSS…Done
    Module userman successfully installed
    Updating Hooks…Done
    All upgrades done!
    Updating Hooks…Done

Run the command again

Thank you will do.

Second time running the command

[root@localhost ~]# fwconsole ma upgradeall
No repos specified, using: [standard,extended,unsupported,commercial] from last GUI settings

Upgrading: arimanager, fax
Upgrading arimanager…
Starting arimanager download…
Processing arimanager
Verifying local module download…Verified
Extracting…Done
Module arimanager successfully downloaded
Unable to install module arimanager:

  • Requires engine asterisk (>= 12), you have: asterisk 11.25.1
    Updating Hooks…Done
    Upgrading fax…
    Starting fax download…
    Processing fax
    Downloading…
    117506/117506 [============================] 100%
    Finished downloading
    Extracting…Done
    Module fax successfully downloaded
    Moving simu_fax feature code from core…done
    Updating simu_fax in miscdest table…done
    Checking if legacy fax needs migrating…already done
    Migrating all fax users to usermanager
    PHP Fatal error: Call to a member function updateUser() on a non-object in /var/www/html/admin/modules/userman/Userman.class.php on line 2072
    Whoops\Exception\ErrorException: Call to a member function updateUser() on a non-object in file /var/www/html/admin/modules/userman/Userman.class.php on line 2072
    Stack trace:
  1. () /var/www/html/admin/modules/userman/Userman.class.php:2072
    All upgrades done!
    Updating Hooks…Done
    [root@localhost ~]#

Can you go to userman and take a screenshot of the directories tab?

Ok now do this and return the results:

mysql
use asterisk;
select * from userman_directories;
select username,auth from userman_users;