The MU forums have moved to WordPress.org

Hack: Main Site Only Plugins (43 posts)

  1. mram48
    Member
    Posted 16 years ago #

    OK. OK...like I said.. I'm no php programmer and have never even secretly lied about it to anyone ;) Not even with my fingers crossed.. I guess this went right on over me..nothing new there and I pretty much said I was very likely way off back in my original post.. SO SUE me then explain what else this plugin does so I might actually understand it a little better... No, wait..don't. I won't understand it until I spend a few months relearning stuff I knew much better five years ago, but totally forgot when I lost all my internet access for so long. What can I say? Bad health and time will do that to an old man..I'm not that old, but to most of you I probably am ancient...50?? Is that old? Not to me, but then again I AM 50.

  2. gumdrop
    Member
    Posted 16 years ago #

    I am 52 dude.

  3. suleiman
    Member
    Posted 16 years ago #

    wowzers, 50 is definitely not old, though you're admittedly double my age.

    Internet-savvy doesn't really have much to do with age friend. MU is definitely a large beast to tackle. A furry loveable beast, but a beast at that.

    I wouldn't worry myself too much about this particular plugin. Not because it isn't excellento--thanks again, Luna--but because from the sounds of it you need to read up a bit more on the stuff you knew better 5 years ago.

    Best of luck!

  4. SAFFLEUR
    Member
    Posted 16 years ago #

    Works great. Thanks Luna.

  5. lunabyte
    Member
    Posted 16 years ago #

    Sure thing. ;)

  6. aliakbar
    Member
    Posted 16 years ago #

    Maybe I'm an idiot. Someone or lunabyte wanna Email me: aliunt@yahoo.com

    I tried this about one hundred times and it's a no go.

  7. aliakbar
    Member
    Posted 16 years ago #

    Ok I know hardly anything about PHP but the hours have been good to me : VICTORY!

    I simply just changed the permission of the menu!!! Now users cannot get to the immediately to the page. I'll soon figure out how to block them from the page altogether!

    Ali
    aliunt@yahoo.com

  8. lunabyte
    Member
    Posted 16 years ago #

    What does a menu have to do with this hack?

  9. suleiman
    Member
    Posted 16 years ago #

    i have no idea what he is talking about.

  10. KKWangen
    Member
    Posted 16 years ago #

    I just want to let you know that you can set this hack in a single php file you can upload to your mu-plugins folder - so you don't need to edit wp-settings.php to make it work. The code in the php file will look something like this:

    <?php
    define( 'MAINPLUGINDIR', 'wp-content/my-plugins' );
    if ( $blog_id == 1 ) {
    $plugins2 = glob( ABSPATH . MAINPLUGINDIR . '/*.php' );
    if( is_array( $plugins2 ) ) {
    foreach ( $plugins2 as $plugin2 ) {
    if( is_file( $plugin2 ) )
    include_once( $plugin2 );
    }
    }
    }
    ?>

    You can save the file my-pluginsdir.php or something in that direction so you know what it is.

  11. lunabyte
    Member
    Posted 16 years ago #

    Um, we mentioned that in like the first couple of posts.

    The downside is that mu-plugins are stopped in the middle of being loaded to load the main-site only ones. Also, that's another file in mu-plugins.

    The code will be read in no matter where you put it, but it's one less file inclusion if you just hack it in.

    IMHO, putting mu-plugins on hold while you load, parse, and execute the main site plugins, then go back to parsing mu-plugins is a little out of place.

  12. KKWangen
    Member
    Posted 16 years ago #

    I'm sorry, I was so sure I've read this thread carefully before posting..

    But thanks for telling me the downside of putting this is the mu-plugins folder.

  13. lunabyte
    Member
    Posted 16 years ago #

    Just depends on how you want it parsed. Not that it doesn't work, it does. I can't say for sure that there is really any real performance hit, but it wouldn't be logically out of the question for there to be a minor one.

    I've even taken this a step further and made a special plugin directory in the admin area, and put stuff that is admin-side only in there. Adding in similar code to admin.php so that those particular plugins are only read when in the back. Works like a charm, and allowed me to move several plugins from mu-plugins into this new area.

    When it comes to MU, every little bit helps.

About this Topic

  • Started 17 years ago by lunabyte
  • Latest reply from lunabyte