Jan 08 2009

external db authentication plugin now works with Wordpress 2.7

Category: UncategorizedCharlene @ 10:42 pm

A quick note – the latest version (3.07) of ext_db_auth now works with Wordpres 2.7.  It’s in the same place as usual.  This version, however, is NOT compatible with WPMU.  You’ll still need to use 2.05 with that.

Once WPMU hits 2.7 it may be broken again for that particular flavor; we’ll see.

Tags:

34 Responses to “external db authentication plugin now works with Wordpress 2.7”

  1. Bradford Knowlton says:

    Great plugin,

    I’m in the process of porting over from a old school CMS to a new Wordpress MU with buddypress social network. I’m using your plugin to allow for an easier transition between the two sites, and 2 databases.

    My Question is:
    I’m trying to decide the best way to modify your plugin so it will not overwrite wp data. I want people to be using the wordpress tools for password recovery, account creation, and such. I understand how your plugin works, just looking for some pointers of places I maybe able to comment out to prevent it overwritting data in WP tables.

    Thanks,
    Brad
    http://gorgeousgamers.com

  2. Charlene says:

    Hey Brad,

    You’re going to want to look around line 325 in the if statement. Essentially, the $userarray fields are grabbed from that parent DB. The thing is, though, is that the direction of this is Foreign DB –> WP DB. To go the other direction, which things like account creation and what-not would use I believe, you need a tool going the other way. Hope that helps/makes sense.

  3. Chris says:

    Hi Charlene… awesome plugin.

    Can you tell the most recent stable version of the plugin for MU?

    Best!

  4. Charlene says:

    Hi Chris,

    For MU 2.6.x it should be plugin version 3.05. Link is here

  5. Chris says:

    Thanks Charlene…

    I am trying to connect to a MySQL DB but the encryption is clear text… I’m not sure what php to enter in the the “other” field for the password2 variable. Can you possibly give me a code template?

    Sorry for being a bit dense…

  6. Charlene says:

    No worries. Most likely it’ll be $password2 = $password;

  7. Jörg Haas says:

    Warning: Cannot modify header information – headers already sent by (output started at
    Hi!

    I tried to integrate your external database bridge. I always received this error-messages? Nothing is working afterwards! Can you help me please. The external database is a moodle-database!

    Thank you!

    /www/htdocs/w00a8023/wordpress/wp-content/plugins/ext_db_auth.php:1) in /www/htdocs/w00a8023/wordpress/wp-includes/functions.php on line 698

    Warning: Cannot modify header information – headers already sent by (output started at /www/htdocs/w00a8023/wordpress/wp-content/plugins/ext_db_auth.php:1) in /www/htdocs/w00a8023/wordpress/wp-includes/functions.php on line 699

  8. Charlene says:

    Hmm. Which version of wordpress are you using? and which version of the plugin?

  9. Jay Mann says:

    Hello Charlene-
    FYI – I’m getting EXACTLY the same error as Jorg: two ‘cannot modify header’ errors – lines 698 and 699 that display on admin pages. This is a virgin/new WordPress installation. v2.7 and your plug-in is the first and only plug-in I have activated. I’ll look into it some..I haven’t troubleshot it yet at all.

    -Jay

  10. Jay Mann says:

    Okay..that was easy. Error actually said ‘output started a line 1 of ext_db_auth.php’. So this indicates a white space character (or more specifically.. UTF8 byte order mark) was at beginning of file. This might have happened during preview of code OR upload to my unix server. I deleted the first line of file and manually re-type it & saved. That corrected problem.

    Anyhow, plug-in works great (out-of-the-box)! Kudos to Charlene!

  11. Charlene says:

    Hi Jay,

    Thanks for the feedback – I did the same and re-committed the files just in case it was on my end. Glad you like it :)

  12. Erick says:

    This is a fabulous plugin and one that is much needed. Thanks!

    My request is that you please make this available for Postgres without requiring all the PEAR crap. Why bundle PG with other nonsense like MSSQL? PHP has fantastic support for PG now, all internal. Just like MySQL.

    I cannot use this plugin because I simply refuse to install all the PEAR drivel. Please please release a version for PG that works like MySQL. Even the function names are the same! mysql_connect is pg_connect, mysql_query is pg_query, and so on.

    Thanks for considering!

  13. Erick says:

    Also, could you please have a “Subscribe to comments” feature on the blog so we can track if you or someone else writes a followup to our comment. Thanks.

  14. Toby Powell-Blyth says:

    Hello Charlene,

    I’d like to submit a small code patch for your plugin, which makes things a little neater:

    <?php
    $roles = array(‘is’,'is not’, ‘greater than’, ‘less than’);
    $first=true;
    $chosenOption = get_option(‘ext_db_role_bool’);
    foreach ($roles as $role)
    {
    echo ”.$role.”;
    $first = false;
    }

    ?>

    For the selector. A further development might be to construct the DB search parameters from the same array…

  15. Toby Powell-Blyth says:

    Dang, no HTML allowed and no preview on comments…. try again

    -select name=”ext_db_role_bool”-
    -?php
    $roles = array(‘is’,'is not’, ‘greater than’, ‘less than’);
    $first=true;
    $chosenOption = get_option(‘ext_db_role_bool’);
    foreach ($roles as $role)
    {
    echo ‘-option’ . (($chosenOption == $role || $first==true && ”==$chosenOption)?’ selected=”selected”‘:”).’-’.$role.’-/option-’;
    $first = false;
    }

    ?>
    -/select-

    I’ve replaced HTML arrows with – symbols.. sorry

  16. Anonymous says:

    Hi,
    I am getting this error ( I saw Haas also had the same issue). My WP ver 2.7.1 and plugin version is Version: 3.1.

    Any pointers would be great.
    Thanks

    Warning: Cannot modify header information – headers already sent by (output started at /home/vic/wordpress/wp-content/plugins/ext_db_auth.php:1) in /home/vic/wordpress/wp-login.php on line 255

    Warning: Cannot modify header information – headers already sent by (output started at /home/vic/wordpress/wp-content/plugins/ext_db_auth.php:1) in /home/vic/wordpress/wp-login.php on line 267

  17. Driveros says:

    With WP 2.7.1 and Plugin v. 3.1, the login page throw me a white page, without redirecting me to the dashboard, why? Can you fix it?

  18. Urko says:

    Hey,

    @Driveros: I was having that empty screen problem (but with Wordpress MU 2.7), and I fixed it by doing what was suggested above:
    Delete the first line of ext_db_auth.php and type it in manually again. There are some strange invisible characters at the end that make it not work.

    I just did that, and it now lets me login and log out.

  19. Urko says:

    @Driveros and everyone else:
    Ok, I have done some more checking: Charlene is obviously developing this plugin on Windows (or at least it is in Windows format: CR and LF at the end of every line). This seems to create a problem when you run it on Linux. The best fix is to use an editor that can convert between Windows and Linux for line endings.

    In Linux, Geany can do it. Use the menu Document, then Set Line Endings.
    With Geany you can also enable the option that displays invisible characters, and you can see what I mean.
    In Windows, check Notepad++, it should also be able to do the conversion.

  20. Charlene says:

    @all: Sorry for delayed response – I’ve been out of the country and busy besides. I’ve since moved to Ubuntu and I ran dos2unix on the plugin file as well as tried deleting the first two lines of the plugin and retyped em in to get rid of the random character in there. I got it back off the server and tried it with no problems on this end – let me know if the issues persist.

  21. Christian says:

    I’still having problems with the encoding (wp 2.7 and plugin v 3.1). I cannot figure out why shows an empty login page. did you uploaded a new version? Thanks in advance :)

  22. chfiguer says:

    I fixed it!. The problem wasn’t the plugin, but my pear-mdb2 installation. After that it worked ok. Since my settings involve more than one table, i used a view which worked great.

    It would be ideal to have a ‘test configuracion button’ to check that the mdb2 directory exists and that db/table/fields are set correctly

  23. biziclop says:

    Hi! First, thank you for your lifesaver plugin! :)
    There is one missing thing (unless I looked over something) I had to fix: setting the mysql encoding after connecting:

    function db_functions($driver,$process,$resource,$query) {

    mysql_select_db(get_option(‘ext_db’),$resource) or die(mysql_error());
    mysql_query(“SET NAMES ‘utf8′”,$resource) or die(mysql_error()); //extra line to fix encoding problems, currently hardcoded utf-8

  24. Charlene says:

    @biziclop: Just to make sure, did it not work until that line was set? What was your database encoding originally? Curious as I tend to have default set as utf8_ci myself…

  25. Tom A says:

    Thanks for the great plugin – just wondering if now that WPMU 2.7 is out whether it works with that or if you have any plans to make it do so? (Looks like it might from a comment above!)

  26. Charlene says:

    @25: Yep it works.

  27. rusty says:

    Hi Charlene,

    Thanks for the great plugin. Very elegant. Works like a champ.

    I’m am in need of a similar authentication plugin. The authentication would happen based on an HTTP request and the response would be in the form of an XML document.

    We’re using WPMU 2.7.1.

    If you would be at all interested please contact me soonest and I’ll gladly send you a box of Luna Bars in the flavor of your choice. :)

    All kidding aside, this would be a paying job, and from the looks of the code you wrote already, shouldn’t be too heavy.

    Thanks in advance.

  28. Ryan says:

    Hi. Thanks for this delightful plugin. I’m using 2.7.1MU, and sqlserver. Authentication is working great, but Role field for validation, and other additional fields like name and email are not populating. It is strange but if i set the fields to fields that do not exist, they return errors (which would be expected). When the fields are properly configured, they always just seem to return blank (I am sure there is data in the table). Anyone have a similar problem?

  29. Ryan says:

    I figured it out. I had db fieldnames in my mssql db with uppercase letters in them(i never got over java naming conventions.) MDB2 would fetch the assoc’s as all lowercase fieldnames(I assume it was mdb2 doing this). All this plugin needs to authenticate is a rowcount, which it was getting. However, since I was configured to look for some uppercase fields, the lookup would fail and all my fields populated blank. Setting field names to all lowercase in the config cleared it right up (still found in mssql which is case insensitive, and now found in the fetched row).

  30. Steffen Zieger says:

    It seems as there is a bug in the authentication, as users are still getting authenticated, if they’ve clicked on “Remember Me”.
    This will save the login credentials in a cookie.

    But it seems, as ext_db_auth_check_login() isn’t used, if wp_validate_auth_cookie() is returning a user.

    Any idea for getting this fixed?

    Thanks in advance.

    Steffen

  31. adiallo says:

    Hi thanks for this pluging
    I install and specify everything but now i can’t login no more. The login page give a empty page. I don’t know if someone know where is the problem? am using worlpress 2.8.6 and the plugin version is 3.1

    Thanks
    adiallo

  32. Paragon says:

    Same here…blank login page.

  33. Rama Rao says:

    Hi Can somebody help to get this working with WordPress 3 and Joomla 1.5?

    I tries but with no success.

  34. Joe says:

    I thought I had everything setup and working, although nobody else manages to login via wordpress. It worked for myself but that’s it, not sure if the config has messed up or something but I’ve tried everything I can think of. (remove plugin, re-type details) etc

    Any help please

Leave a Reply