Use the PHPBB Login to allow access to Menu Option, other Menu option uses WP Categories - Crashes page

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
Argos1958
Registered User
Posts: 24
Joined: Wed Jun 24, 2009 5:09 am

Use the PHPBB Login to allow access to Menu Option, other Menu option uses WP Categories - Crashes page

Post by Argos1958 » Sun Mar 11, 2018 4:42 pm

My Setup:
Mainsite - custom built by me - not wp, and not phpbb - mysite.com
Subfolder - /blog/ (wordpres 4.9.4)
Subfolder - /forum/ (phpbb 3.0.14 - the last release of 3.0)

On the main site I want to do the following;
1) Member's only Menu - so if you log into the forum you are considered a member. I use this on other pages (test subfolder within mysite.com), and it works great.
For example,
  • I check to see if they are registered - if so, I show them the list of events we have coming up.
    I check to see if the user is an Admin and if so, I give them access to create an event (php / mysql / etc...)
2) Blog Content Menu - I use the Categories from the Blog by calling the wp-load.php). It drives a list of the categories for the user to select from. It works well.

3) I decided to create the MEMBERS ONLY (those registered in the Forum) menu. I thought it would be simple following the recommendations from teh PHPBB board.

Code: Select all

define('IN_PHPBB', true);
$php_root_pat = 'forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
	$user->session_begin();
	$auth->acl($user->data);
	$user->setup();
	$user_name = $user->data['username'];

// allow access if the user is 'actually' registered - avoid the anonimous user.
if($user->data['is_registered']){
	   // echo 'logged in - you may do stuff here'
     $allowed = TRUE;
	}
	else{
	   //echo "not logged in!";
	   $allowed = FALSE;
	}  
This all works great as long as I don't put in the call to the wp-load.php. If I put it in, then the page does not display. It literally breaks at that poin.

If I add this code,

Code: Select all

<?php require_once($_SERVER['DOCUMENT_ROOT'] . '/ezine/wp-load.php');?>
The page breaks. I remove it, it works fine.

The same is true if I remove the PHPBB code, the page works great. I put it in, it breaks again.

I think - I'm not 100% certain, but I do think - that my root cause analysis is within the operation of the wp-load.php page; but I can't figure out what the conflict is - meaning: I'm not that good that I can figure this out.

I can simply let the pages with the code above reject the user and send them to a log in page; but I would prefer to make the menu MEMBERS ONLY show up when the members are logged in.

Does anyone know what the conflict is; and how I may resolve it (other than don't load wp-load.php)?

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 12 guests