Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4572228
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:37:01+00:00 2026-05-21T19:37:01+00:00

I have a mediawiki and phpbb install that I integrated single sign on with

  • 0

I have a mediawiki and phpbb install that I integrated single sign on with successfully.

The problem was that they both had a user class, so in mediawiki, when I called on phpbb it gave a class redecoration error.

I got around this by checking if the file is being loaded by mediawiki. If it is, it called a complete copy of the user class called phpbb_user instead. But I’m wondering if there is a better way. This is how it currently works

if (!defined('FROM_MEDIAWIKI')){
    class User extends session{
    //user class code
    }

}else{
    class phpbb_user extends session{
    //exact copy of user class code
    }

}

Is there a better way to do this that does not require 2 copies of the user class?

I know you can not do this but can you do something like it?

$className = (defined('FROM_MEDIAWIKI'))? 'phpbb_user' : 'User';

class $className extends session{
    //user class code
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:37:01+00:00Added an answer on May 21, 2026 at 7:37 pm

    This is a bit of a hack, but you could have a base class, where everything if defined. Then you simply extend empty subclasses from that class, thus changing its name without having to keep duplicate code.

    class __user extends session {
        // user class code
    }
    
    if (!defined('FROM_MEDIAWIKI')){
        class User extends __user {}
    }else{
        class phpbb_user extends __user {}
    }
    

    I’d love to see a better solution, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mediawiki installation that I've customized with some of my own extensions.
We have created a manual library (MediaWiki) for a system that we have, and
everyone I have one problem here. My site is powered by Mediawiki, which means,
I have a personal website with a MediaWiki installation on a shared host. The
I have played with the idea of using a wiki (MediaWiki) to centralize all
Have you guys had any experiences (positive or negative) by placing your source code/solution
I would like to be send an email to an address that mediawiki can
I have a MediaWiki, and I don't think I want Google indexing the history
We have two mediawiki (like wikipedia) installations. One is public and one is internal.
We have a MediaWiki wiki in which we make extensive use of templates. These

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.