Hi,
First of all why do you need to login without a password?
In adminers documentation, I have found this
https://github.com/vrana/adminer/blob/master/adminer/sqlite.php
In your code there is \ for different namespace… I don’t know your folders and the namespace that you use. Have you tested that your function is executed?
And also
include_once PEXLECHRIS_ADMINER_DIR . '/inc/class-pexlechris-adminer.php';
include_once "./plugins/plugin.php";
include_once "./plugins/login-password-less.php";
these are included successfully?
You could try to do something like this…
function extend_configuration() {
function adminer_object() {
include_once PEXLECHRIS_ADMINER_DIR . '/inc/class-pexlechris-adminer.php';
class AdminerLoginPasswordLess extends Pexlechris_Adminer{
/** @access protected */
var $password_hash;
/** Set allowed password
* @param string result of password_hash
*/
function __construct($password_hash) {
$this->password_hash = $password_hash;
}
function credentials() {
$password = get_password();
return array(SERVER, $_GET["username"], (password_verify($password, $this->password_hash) ? "" : $password));
}
function login($login, $password) {
if ($password != "") {
return true;
}
}
}
class AdminerCustomization extends AdminerLoginPasswordLess {
function loginFormField($name, $heading, $value) {
return parent::loginFormField($name, $heading, str_replace('value="server"', 'value="sqlite"', $value));
}
function database() {
return WP_CONTENT_DIR . '/database/.ht.sqlite';
}
}
return new AdminerCustomization();
}
}
add_action('pexlechris_adminer_before_adminer_loads', 'extend_configuration', 999);
but I think you dont need to include AdminerLoginPasswordLess plugin because I have its methods in my class Pexlechris_Adminer
And also have in mind that adminer’s hook customizations can be placed in a mu-plugin or a custom plugin. If you try to place to your child theme, the code will not work
I thank you for fast response. But, unfortunately, this setup does not work. I have used this hook in functions.php in currently active theme. Actually, it seems this hook is never fired, I cannot output some data to debug.log π
I’m using Bedrock setup with SQLite database as mu-plugin.
Yes ffrom theme dont fired.
You nneed to Place it either in a must use plugin or in a custom plugin.
Instructions on how to create a mu plugin you can find here https://www.pexlechris.dev/how-to-add-php-hooks-in-your-wordpress-site/
Have iin mind that display errors is disabled even WP_DEBUG_DISPLAY is set to true
Thank you! I will try later.