Problem with new registered users

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

Re: Problem with new registered users

Post by axew3 »

so, could you try out this solution, that maybe will be also added as default to prevent many other situations and also because the logic can be more complete in this way, but not completely.
open file
search for line:

Code: Select all

if ( ! $user_id  && $phpbb_user[0]->user_type != 1 ) { 
immediately BEFORE add this code:

Code: Select all

$wp_urole = implode(', ', $user_info->roles);
if( $phpbb_user[0]->user_type == 1 && !empty($user_info->wp_capabilities) ){ // activate this deactivated phpBB user
  $user_email_hash = self::w3all_phpbb_email_hash($user_info->user_email);
  $w3phpbb_conn->query("UPDATE ".$phpbb_config_file["table_prefix"]."users SET user_type = '0' WHERE user_email_hash = '$user_email_hash'");
}
should work. The user will be activated in phpBB when login the first time WP.
I say it is not a complete solution, in the sense that the user will not be able to login phpBB side, until will not login almost one time before, into WP.
The user need to login almost one time WP to be activated. This will be maybe what an user will d0 99% of cases. In the other case, when will try to login phpBB and will get no result, may will try to login WP side ... maybe
So we can say it is acceptable, and very ok, but not completely ok.
Let know
antoinegdln4
User www
User www
Posts: 70
Joined: Fri Nov 11, 2016 3:50 pm

Re: Problem with new registered users

Post by antoinegdln4 »

Okey !
This code must be added for wich file ?

For my website, user ALWAYS log-in in WP the first time.
Thanks by advance
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Problem with new registered users

Post by axew3 »

just re-download 1.6.9 now, it contain the code above, has been patched!

and page-forum.php has been patched yesterday, while overall_footer.html js code will patched in minutes after this post to fix scroll events (as more possible at moment)

p.s just patched
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Problem with new registered users

Post by axew3 »

and page-forum.php has been patched yesterday, while overall_footer.html js code will patched in minutes after this post to fix scroll events (as more possible at moment)

p.s just patched
so now finally, when i insert a new post, i'm not more scrolled top, but correctly redirected to the just inserted post.
by the way scroll need to be improved little more and definitively.
antoinegdln4
User www
User www
Posts: 70
Joined: Fri Nov 11, 2016 3:50 pm

Re: Problem with new registered users

Post by antoinegdln4 »

Hey !

I made the test with the new version, the user activation is working (including phpBB) at first connection ! :!: :D

BUT after the first user connection , it redirect the user to the WP Admin (on User Profil). I don't want that my users can go the WP Admin Panel...

And my custom redirection page doesn't work (because user is redirect to WP Admin, whatever was the previous redirection).

Thanks by advance !
antoinegdln4
User www
User www
Posts: 70
Joined: Fri Nov 11, 2016 3:50 pm

Re: Problem with new registered users

Post by antoinegdln4 »

So actually, after the user click on activation link (email),
the code working is

Code: Select all

add_action( 'bp_core_activated_user', 'wpse_70289_activated_user_redirect' );

function wpse_70289_activated_user_redirect() {

    $page = 'activation-reussie';//your page slug
    
    bp_core_redirect( site_url( $page ) );
}
After that, the user arrives on a page where says "Account Successfuly activated, please connect" with a connection button.
This button is doing a redirection to a specific page after connection.
:!: But this redirection doesn't work, user is redirect on this profil in WP Admin
:shock:
Post Reply