[dokuwiki] Re: using WordPress 2.5 authentication system

  • From: "Arthit Suriyawongkul" <arthit@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 3 Apr 2008 17:00:51 +0700

Using suggestion from
http://jawe.net/2008/04/01/wordpress-upgrade/
to change from wp_get_cookie_login() to get_currentuserinfo()
now I can make DokuWiki 2008-03-31 works with WordPress 2.5
on http://cc.in.th/wiki/ -- thank you! :D

Anyway, changing so will do the work only half-way.
i.e. When user logged in using WordPress, DokuWiki can recognized it.
but user cannot use the login screen of DokuWiki itself
(it will always reported that the username/password is incorrect).

So, following an example used by jawe.net wiki itself,
I decide to override the login/logout button of DokuWiki by WordPress's one.

To doing so, in DokuWiki's /lib/tpl/default/main.php,
(if you not use default template, adapt it ;) )
replace

        <?php tpl_button('login')?>

with

        <?php
          global $lang;
          $html = '<form class="button btn_login" method="get"
action="/wp-login.php">';
          $html .= '<div class="no">';
          $html .= '<input type="hidden" name="redirect_to"
value="'.$_SERVER["REQUEST_URI"].'" />';
          if($_SERVER['REMOTE_USER']){
            $html .= '<input type="hidden" name="action" value="logout" />';
            $html .= '<input type="submit"
value="'.$lang['btn_logout'].'" class="button" />';
          } else {
            $html .= '<input type="submit"
value="'.$lang['btn_login'].'" class="button" />';
          }
          $html .= '</div></form>';
          print $html;
        ?>

This will make login/logout button uses WordPress's login/logout screen instead.
(the user will bring back to his/her original page before login/logout,
by sending redirect_to value to WordPress script)

The url in "action" should be change to reflects your WordPress
installation directory.
(I install WordPress at / and DokuWiki at /wiki so my action is
"/wp-login.php").


Thank you everyone the collectively made this possible :)

cheers,
Art

--
KIND Lab, SIIT, Thammasat University
http://kindml.siit.tu.ac.th/

bact' is a name
http://bact.blogspot.com/
-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: