Skip to:
Content
Pages
Categories
Search
Top
Bottom

Single SignOn MediaWiki – User Capitalization


  • LPH2005
    Participant

    @lph2005

    @boonebgorges — or anyone with good coding experience –

    The AuthWP.php ran into a snag today.

    The admin account in wpuser was changed to match my initials (all in capital letters). When the browser is pointed to the mediawiki install then the user id is changed from all capitals to the first being a capital letter and the following are all lowercase. How can this behavior be stopped so that my wpuser account in capitals is matched up with my mediawiki account that is all in capital letters?

    Can AuthWP.php be modified so that the code for matching my userid is inserted.. if $wpuser==LPH (wp-user database) then use LPH (from mediawiki user database – user_id==1)?

    Something like:

    `if($wpuser==LPH)
    ID == LPH
    return true;`

    This would be added to:

    `function AuthWPUserLoadFromSession($user, &$result) {

    // Is there a WordPress user with a valid session?
    $wpuser=wp_get_current_user();
    if(!$wpuser->ID)
    return true;

    $u=User::newFromName($wpuser->user_login);
    if(!$u)
    wp_die(“Your username ‘”.$wpuser->user_login.”‘ is not a valid MediaWiki username”);
    if(0==$u->getID()) {
    $u->addToDatabase();
    $u->setToken();
    }
    $id=User::idFromName($wpuser->user_login);
    if(!$id) {
    wp_die(“Failed to get ID from name ‘”.$wpuser->user_login.”‘”);
    return true;
    }
    if($id==0) {
    wp_die(“Wikipedia ‘”.$wpuser->user_login.”‘ was not found.”);
    return true;
    }
    $user->setID($id);
    $user->loadFromId();
    wfSetupSession();
    $user->setCookies();
    $user->saveSettings();
    $result=true;

    return true;
    }`

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Single SignOn MediaWiki – User Capitalization’ is closed to new replies.
Skip to toolbar