Page 1 of 1

External registration

Posted: Mon Apr 27, 2015 8:18 pm
by denvy
Hi all, this is my first post and started to explore the phpBB world and was looking for some advice on something I was looking to do. I have built a Laravel app which is my main site, I have installed phpBB on a subdomain at a different server location. Both working fine separately, registration on phpBB I want disabled and accounts to be only created and disabled through my main site, when account is created or deleted.

My question is how do I
1. Send a newly created account on main site to phpBB
2. Delete account on main site to phpBB

I found these but they seem to be answering different questions. These are for authenticating.
https://wiki.phpbb.com/Authentication_providers
and
viewtopic.php?p=4016875#p4016875

At the present moment in time, I am not too concerned with authentication and session login between the two apps. All I want is to be able to send created and deleted accounts to phpBB and for now happy for users have to login when visiting phpBB.

Can someone kindly please advise me how this can be achieved, creating and deleting accounts via external requests?

Re: External registration

Posted: Mon Apr 27, 2015 9:53 pm
by Wolfsblvt
You mean you want to create an account in your phpBB board when someone registers on your main site?

Re: External registration

Posted: Mon Apr 27, 2015 10:00 pm
by denvy
Wolfsblvt wrote:You mean you want to create an account in your phpBB board when someone registers on your main site?
Hi thanks for getting back to me yes that's right

Re: External registration

Posted: Mon Apr 27, 2015 11:20 pm
by Wolfsblvt
There is a function called user_add(), wich can be used to add a user to phpBB.

A sample function how a call to this method could loke like can be seen in this test framework method.

You need the real objects from container thought, not the mocks, but I think you can get an overview how you could use that method,

Re: External registration

Posted: Mon Apr 27, 2015 11:39 pm
by denvy
thanks for that, I think I need a little more guidance how this works. Where would this piece of code reside on my Laravel app or in phpBB root folder? In order to send a request from my app to phpBB must I include necessary phpBB files such?

At the moment I am struggling how to make the initial connection between my app and phpBB, this is before creating a user.

Can you advise how this is done? I'm trying to include all the files as explained here http://mrkirkland.com/adding-a-user-to- ... al-script/
but no matter what i have tried results all in errors about including necessary files

Re: External registration

Posted: Tue Apr 28, 2015 12:20 am
by Wolfsblvt
On Laravel, I would say. Otherwise it would be a bit more complicated.
What you also could do is check on phpBB side regularly for new users on your app, but that would not redirect your users directly to phpBB, that's the other way round.

And yes, if you make that connection, you need to include files to setup phpBB at the beginning.
I would guess it should be very similar to the lines on top of each php file

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup(); 
You should modify this (for example the root path) to your need, and try maybe that.

But I am not so far into integrating phpBB, so I can just guess, and this is all I can give you for this topic :-/

Re: External registration

Posted: Tue Apr 28, 2015 12:54 am
by denvy
Thanks for your help anyway. I tried that and the error came up with "Call to a member function header() on null " as soon as the session code is added along with "You must use the request class or request_var() to access input data." in the PHP log, I was hoping that there would be an easy way of accessing the app externally. But seems like that it is not. I see alot of threads where people struggled but none with full solutions.

Re: External registration

Posted: Tue Apr 28, 2015 1:30 am
by denvy
Excellent!! After 12 hours of searching, hit the jackpot. One post talking about why phpBB wouldn't co-operate when trying to connect externally. As soon as I added the code bam, everything's working along with several other functions such as checking for user too etc. The rest should be easy to code hopefully.

Right back to coding but bed time for now. Thanks Wolfsblvt for your help

Re: External registration

Posted: Tue Apr 28, 2015 3:38 pm
by Lumpy Burgertushie
please supply a link to the jackpot you hit.


thanks,
robert

Re: External registration

Posted: Fri Feb 05, 2016 10:42 pm
by guypat
denvy wrote:Excellent!! After 12 hours of searching, hit the jackpot. One post talking about why phpBB wouldn't co-operate when trying to connect externally. As soon as I added the code bam, everything's working along with several other functions such as checking for user too etc.
What "code barn" ??? Please share the link to the post that helped you....

Re: External registration

Posted: Wed Feb 24, 2016 7:06 am
by austin881
A poem for denvy
denvy was a member for just one day
He hit the jackpot and ran away

Joined: 27 Apr 2015, 14:00
Last active: 28 Apr 2015, 17:44

denvy... Please share the link to the post that helped you!

Re: External registration

Posted: Wed Oct 18, 2017 2:56 pm
by Cohaven
Not sure if this is the thread he was talking about, but it helped me:
viewtopic.php?f=71&t=2287546