Externals plugins Incompatibility

User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Externals plugins Incompatibility

Post by axew3 »

... the question remain: how to know if we are onlogin with this kind of plugins, where even the $_POST is empty, so we can't just add vars to WP_w3all for the auth to check, and in these cases it is so necessary to use a trick like the above?

... i also think: why the hell, these plugins rewrite default things? And this is a common wrong behavior on many.
ricardovicente
User w
User w
Posts: 6
Joined: Fri Dec 09, 2016 6:35 pm

Re: Externals plugins Incompatibility

Post by ricardovicente »

Very interesting, I'll try these and another things, and I'll return later (maybe tomorrow) with results.

Regarding your questions, it's absolutely the same thing I feel. And why they change default things? Because many of them just think in his own ... ( maybe I shouldn't say that word :? ).

They don't think in the user's friendly experience on first place, because they just overwrites anything in the name of "safety" I guess. And they don't think in the another developers in the second place, like you for example. That type of hard code makes a lot of conflicts and force us to clean they mess.

[/raging mode off]
ricardovicente
User w
User w
Posts: 6
Joined: Fri Dec 09, 2016 6:35 pm

Re: Externals plugins Incompatibility

Post by ricardovicente »

Update: On ajax php file that have the authentication lines, after some conditional login strings (about errors), I've found the last conditional line, So I've tried:

Code: Select all

 else {		
                   /* a good login */
		   userpro_auto_login( $user->user_login, $rememberme ); 
		   $an_external_login = true; <-- the trick
		   
		   if (isset($form['force_redirect_uri']) && !empty($form['force_redirect_uri']) && $form['force_redirect_uri']!=0) {
						$output['redirect_uri'] = 'refresh';
						
					}

Results: Even before the redirect, the trick didn't work (just for note, I added the function and add_action in wp_w3all.php after 'wp_w3all_phpbb_logout' like you said to do). I've also tried to declare the var $an_external_login on other lines (digging deep to find every situations that maybe calls login actions), but no success.

So, 3 hours later after tests, I've found some lines that maybe indicates the php file isn't doing all the login/logout process alone. The form submit needs to be validated by jQuery.ajax (inside of scripts.min.js). Maybe the solution is in another way.
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Externals plugins Incompatibility

Post by axew3 »

Perhaps the var you setup is inside a function, so it is not globally available. $an_external_login = true; will never be recognized as true.
Use a define instead, change:

Code: Select all

$an_external_login = true; <-- the trick
with:

Code: Select all

define("MYW3EXTLOGIN", true);
and check against:

Code: Select all

   function wp_w3all_ext_login( $user_user_login, $user ) {

    if ( defined('MYW3EXTLOGIN') ){

        $phpBB_user_session_set = WP_w3all_phpbb::phpBB_user_session_set_res($user);
     
     endif;
   
   }
             
add_action( 'wp_login', 'wp_w3all_ext_login', 10, 2 ); 
p.s The first post more above with first example has been corrected due to wrong function call (that maybe you had see and fix already).
By the way, this second solution is the good one to get the value, that can be defined inside or outside a function, available everywhere.

p.s I've think to a trick to resolve all in once these incompatibility problems with some external plugin: the joke explained in few words will try to use a WP filter on login, and another executed after, to check. If not wrong, this should be the correct way to resolve. Fire a filter and set something, check after with another. Hope at least these plugins are passing for the right WP process to login users into WP, or also this common way will not work for all.
Locked