remur
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Theme My Login] PHP fatal error in custom redirection module, and fixI’ve found he same problem in the registration form if enabled custom password.
If you have two instances (ie registration + login) and if you get an error in the second instance (ie password blank) the first instance get php error for $template==null.It’s because the program try to load the current instance (2) while processing the first instance.
I wrote a fix for this issue. I don’t know if it is the best way, but for the moment it works.
file: class-theme-my-login.php
put this code at the beginning after
public $request_instance;/** //rrr * Holds current instance being worked * * @since 6.0 * @access public * @var int */ private $current_instance;
add this function:
/** * set active instance * //rrr * @since 6.3 * @access public * * @set Instance field */ public function set_current_instance($set_instance) { $this->current_instance = $set_instance; }
change this function:
public function get_instance( $id = 0 ) { if ( isset( $this->loaded_instances[$id] ) ) return $this->loaded_instances[$id]; //rrr elseif ( isset( $this->loaded_instances[$current_instance] ) ) return $this->loaded_instances[$current_instance]; else return $this->loaded_instances[0]; }
change this function:
public function load_instance( $args = '' ) { $args['instance'] = count( $this->loaded_instances ); $instance = new Theme_My_Login_Template( $args ); if ( $args['instance'] == $this->request_instance ) { $instance->set_active(); $instance->set_option( 'default_action', $this->request_action ); } $this->loaded_instances[] = $instance; //rrr $this->set_current_instance(count($this->loaded_instances)-1); return $instance; }
Viewing 1 replies (of 1 total)