When user register in phpBB, can be added at same time into WP?

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: When user register in phpBB, can be added at same time into WP?

Re: When user register in phpBB, can be added at same time into WP?

by axew3 » Mon Jan 29, 2018 8:23 am

... yes i think will be very near to this, the definitive code!

p.s why you do not post as registered, so your posts not need to be moderated? :D
Only first post of registered are moderated. After first post validated, all is immediately published for any registered user.

Re: When user register in phpBB, can be added at same time into WP?

by azik1 » Sun Jan 28, 2018 10:16 pm

so this a newer version of the first response or its an addon to the code that you posted last week?

Re: When user register in phpBB, can be added at same time into WP?

by axew3 » Sun Jan 28, 2018 8:30 pm

This +- will be the definitive code added on documentation as i can. It still lack maybe of a simple addition: a var to detect if the coming redirect fired by this code (so recognized after in WP, for the redirect), isn't a request done by iframed phpBB (in case it is used also), but full not iframed.
Then will be really complete.

Code: Select all

// START w3all redirect to WP onlogin
	// Note: this snippet code on this redirect() function should not be used (added) if using iframe mode -> will be removed this on definitive snippet
	// see class.wp.w3all-phpbb.php -> // START w3all redirect to phpBB (onlogin to add user in WP)
	// Note: the passed URL to redirect to, is not containing the string portion after '&sid=' that is cut off
	// Note: If you want pass also phpBB sid on URL (because phpBB login work also without cookie active on browser, using sid) maybe you'll remove the line more below where 'REMOVE this line'
	
	
	// DO NOT ADD FINAL SLASH
	$wordpress_url = 'http://localhost/wp49'; // SET HERE the WordPress URL you want to point to - DO NOT ADD FINAL SLASH (or change the code below)
	//
	 global $request;
    if( $request->variable('mode', '') == 'login' ){
     $rurl = stristr(htmlspecialchars_decode($url), '&sid=', true); // 'REMOVE this line' to pass entire URL (with also sid var included) // stristr as of PHP 5.3.0 or > 
     if( strpos($rurl, '/') == 0 ){ $rurl = trim(substr($rurl, 1)); }
     $rurl = base64_encode(generate_board_url() . '/'. str_replace('./', '', $rurl));
     header("Location: $wordpress_url/?w3allAU=$rurl"); 
    exit;
   }
// END w3all redirect to WP onlogin

Re: When user register in phpBB, can be added at same time into WP?

by azik1 » Sun Jan 28, 2018 8:17 pm

thanks for the peace of code

Re: When user register in phpBB, can be added at same time into WP?

by axew3 » Thu Jan 25, 2018 6:21 pm

I would really appreciate it thanks in advance
Is obscure what's the meaning of this, most of the time :D

To detect redirect from a login, as on this case, in phpBB, may can be achieved checking the protected object redirect and redirect the user only in this case, in this way:

open: includes/functions.php
search for:

Code: Select all

function redirect($url, $return = false, $disable_cd_check = false)
{
	global $user, $phpbb_path_helper, $phpbb_dispatcher;
just after this, add the follow, changing the correct URL that point to your WordPress:

Code: Select all

global $request;
   $mode = $request->variable('mode', '');
    if($mode == 'login' ){
      header("Location: http://www.my-nice-wp.com/"); 
    exit;
   }
when user login, will be then redirected to the assigned URL on the function header, and after phpBB logged in cookies have been released: so if WP_w3all will be active, the user will be added on fly also into WordPress.

The Javascript code to achieve this is even more easy, but i suppose for consistence, you may prefer this php way.

Re: When user register in phpBB, can be added at same time into WP?

by azik1 » Thu Jan 25, 2018 3:48 am

Can please post the code snippet for redirect to Wordpress I would really appreciate it thanks in advance

Top