Jump to content

External Database Login: additional clause doesn't work

Genadii Skaraev

Recommended Posts

In external database I have users who I do not want to have access to forum. There is a column named 'status', and it has values from 1 to 9 for active users and 0 or -1 for not activated and banned users.

When I write "status > 0" in field Additional clause:


happens nothing.... Banned and not active users from external database can still authorise on forum.

Tried different spellings, for example:

`status` > 0 

status = 1 

status = 9999
Nothing can stop banned users from logging in. Even creating new field `active` in external database, filled with 0 (and writing "active=1" in  additional clause, like in field description) doesn't help.

Maybe someone had similar problems? How to handle it?

Link to comment
Share on other sites

It's a bug. Submit a ticket.

17 hours ago, Genadii Skaraev said:

How to handle it?


Replace _getRowFromExternalDb method with

	public function _getRowFromExternalDb( $usernameOrEmail )
		/* Build where clause */
		$where = array();
		switch ( $this->authType() )
				$where[] = array( "{$this->settings['db_col_user']}=?", $usernameOrEmail );
			case \IPS\Login::AUTH_TYPE_EMAIL:
				$where[] = array( "{$this->settings['db_col_email']}=?", $usernameOrEmail );
				$where[] = array( "({$this->settings['db_col_user']}=? OR {$this->settings['db_col_email']}=?)", $usernameOrEmail, $usernameOrEmail );
		if ( $this->settings['db_extra'] )
			$where[] = array( $this->settings['db_extra'] );
		/* Fetch */
		return $this->_externalDb()->select( '*', $this->settings['db_table'], $where )->first();


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...