The MU forums have moved to WordPress.org

BM Custom Login Hack (24 posts)

  1. NoReason
    Member
    Posted 14 years ago #

    I'm running Wordpress Mu 1.3.3 on a custom server, mixing custom domains and subdomain blogs. I wanted a custom login that would look different for each blog, without a lot of hassle.

    So, I hacked up Binary Moon's Custom Login for Wordpress:
    http://www.binarymoon.co.uk/projects/bm-custom-login/

    At first, I tried calling $current_site->id into the plugin, but that didn't work. So I took the 'echo' out of the function and got rid of the plugin all together.

    So, I went into wp-login.php and right after the globals call on line 30 I put:

    $bm_site_id = $current_site->id;

    Then, right before the end of the <head> tags I put:
    <?php echo '<link rel="stylesheet" type="text/css" href="' . get_settings('siteurl') . '/wp-content/plugins/bm-custom-login/' . $bm_site_id . '.css" />'; ?>

    Then, in the plugin folder, I just named css files 1, 2 etc based on the site id.

    I'm sure there's a cleaner way of doing it, but that's what I got.

    You can view it at:
    http://www.noreasoncomics.com/wp-login.php
    http://thewatchtowerpodcast.com/wp-login.php

  2. demonicume
    Member
    Posted 14 years ago #

    nice. now lets make it a pop up!

  3. NoReason
    Member
    Posted 14 years ago #

    Why would we do that?

  4. demonicume
    Member
    Posted 14 years ago #

    i kid, brother.

  5. andrea_r
    Moderator
    Posted 14 years ago #

    Nifty. :)

  6. lunabyte
    Member
    Posted 14 years ago #

    While Demon kids up there, I did that with mine. Well, ajax through a lightbox, but whatever. lol

  7. NoReason
    Member
    Posted 14 years ago #

    Ohh. Funny stuff. ;P

    Whenever I've run into a problem, I've always found the solution in here (here being the forums) - so as I find solutions to problems (read: that I create for myself) on my own, I think it's only fair I post it here. I hope it helps.

  8. jwesseldyke
    Member
    Posted 14 years ago #

    I thinks I'm missing something here... I grabbed the BM plugin, very cool... As far as I can see, because it goes in the plugins directory it must be turned on by individual blog owners...

    Is there a way to, as easily as this (and without a lot of coding skills) make a custom login page that is the same for every blog across the network? Not custom to each individual subdomain/blog but just different from the WP login screen?

    I'm certain I'm making this more difficult than it needs to be, but I can't seem to figure out how to change the wp-login appropriately, or even where the logo and colors are determined in the code...

  9. andrea_r
    Moderator
    Posted 14 years ago #

  10. beaulebens
    Member
    Posted 14 years ago #

    I got a little jQuery happy with mine and changed things up a bit. I also have a hacked together "system" for logging in via email address rather than username, so I use that on my login page:

    http://mybabyourbaby.com/wp-login.php

    :-)

    Yay jQuery!

  11. jwesseldyke
    Member
    Posted 14 years ago #

    Thanks for the info, Andrea... Easy to implement... Now if I just a had design skills to make a nice box... LOL...

    Ahh... The life of a wannabee... Not quite coder, not quite designer... Ideas that require both...

  12. jwesseldyke
    Member
    Posted 14 years ago #

    OK... Here's the latest with this...
    I crashed and lost everything...

    Now when I went to re-download the plugin, it appears to be different than the one I downloaded last week... An update for 2.5 I guess...

    Anyway... Does anyone have either, the previous version or the step-by-step to make the new one work?

    Grr... I hate technology when it doesn't know what I want and don't want to do...

  13. andrea_r
    Moderator
    Posted 14 years ago #

    Are you *sure* you got the one from here?
    http://www.binarymoon.co.uk/projects/bm-custom-login/

    Cuz it's the same as it always was. you have to make a graphic for your site though, and do a minor edit for it to work in the mu-plugins folder.

  14. jwesseldyke
    Member
    Posted 14 years ago #

    Well, I got email from Ben, who said it was updated on 3/31 to work with 2.5...

    In your step-by-step you mention changing the php file to reflect the path /mu-plugins/ instead of /plugin/

    I did that and it worked just fine... Then when I lost everything and downloaded the plugin again, the code looked different... I may be wrong but it seems different... here's the only snippet with anything regarding path...

    function bm_custom_login() {

    $blog_version = get_bloginfo( 'version' );
    If ( $blog_version >= 2.5 ) {
    echo '<link rel="stylesheet" type="text/css" href="' . get_settings( 'siteurl' ) . '/wp-content/plugins/bm-custom-login/bm-custom-login-2.css" />';
    }else {
    echo '<link rel="stylesheet" type="text/css" href="' . get_settings( 'siteurl' ) . '/wp-content/plugins/bm-custom-login/bm-custom-login.css" />';
    }

    }

    I don't recall changing the path twice in the installation I had working in the first place, although, like everything else, I try so many things before getting stuff to work that it all runs together...

    In any case, I uploaded the bm plugin to the mu-plugins directory, changed the path in the above snippet to /mu-plugins/ and nothing happened...

    Not sure if I'm hallucinating or what's going on, but either way, I can't seem to get it to work again...

  15. lunabyte
    Member
    Posted 14 years ago #

    "Then when I lost everything and downloaded the plugin again, the code looked different."

    Well, if it was updated for 2.5, it may not work with 2.3. Isn't there a link somewhere to the previous version?

    /aside... On occasions like that, Time Machine saves the day. :D

  16. jwesseldyke
    Member
    Posted 14 years ago #

    Andrea saved the day by sending me the previous version... Thanks again, Andrea...

    Ben mentioned in an email that he was going to be updating the plugin again and perhaps could come with something...

    I'm going to go back and look at it with a fresh, non-sleep deprived set of eyes and see if I had a typo somewhere or something... Stranger things have happened...

  17. andrea_r
    Moderator
    Posted 14 years ago #

    there was another custom login screen plugin released recently. Maybe you got 'em mixed up?

    Although I can't see why it wouldn't work in MU if it works on WP 2.3.

  18. Mattz
    Member
    Posted 14 years ago #

    Weird that I can't get this working anymore on MU 1.5.1, I had this worrking on the older version.

    Something changed ?

  19. dsader
    Member
    Posted 14 years ago #

    Here an mu-plugin I use in wpmu1.5.1

    function ds_login_css()
    {	$css_login = "<style type=\"text/css\">
    h1 a {
    background: url(http://newlogo.png) no-repeat center;
    }
    .login form {
    background: url(http://newback.png) repeat-x;
    }</style>";
    print($css_login);
    }
    add_action('login_head', 'ds_login_css');
  20. Trent
    Member
    Posted 14 years ago #

    Beauty! I will be using that one dsader! Thanks!

    Trent

  21. andrea_r
    Moderator
    Posted 14 years ago #

    maybe it doesn't work anymore becasue the whole admin & login area of 1.5.5 is changed?

  22. Mattz
    Member
    Posted 14 years ago #

    Hi Andrea,

    I tried to make that sure here :)

    But dsader might have a good solution, thanks.

  23. gulflee
    Member
    Posted 14 years ago #

    hi,
    the function ds_login_css()
    should in php file and load on to mu-plugins folder ?

    is that dsader
    can anyone help!
    tq

  24. dsader
    Member
    Posted 14 years ago #

    Gulfee,
    Yes.

About this Topic