WordPress.org

Forums

my-hacks.php (27 posts)

  1. Matt Mullenweg
    Troublemaker
    Posted 11 years ago #

    http://wordpress.org/development/archives/60/
    Thoughts from any hack writers?

  2. Laughinglizard
    Member
    Posted 11 years ago #

    Sweet! This might be my ticket out of sticking with old versions. Now to wait for finals to end so I can look closely at this (and other items) :-P Thanks allusion!

  3. seraph
    Member
    Posted 11 years ago #

    Now this rocks. All this while, I was a little apprehensive about using hacks because of their unsupported nature; plugins are a nicer name really :D

  4. antifuse
    Member
    Posted 11 years ago #

    Ooooh, that's a most useful feature. A lot of the things people have mentioned to me about WP is that they don't like the lack of a plug-in functionality. This is a nice step in the right direction. :)

  5. jonanhold
    Member
    Posted 11 years ago #

    does this just include the file if it exists, or is there more to it that i'm missing?

  6. Matt Mullenweg
    Troublemaker
    Posted 11 years ago #

    Well there's an option you can turn on or off to prevent slowing down WP with unecessary stat calls. If the option is on then it checks for the file and includes it if it exists.

  7. jonanhold
    Member
    Posted 11 years ago #

    hmm. this is kinda neat, but all it really saves is adding one require call to the code..
    what'd be REALLY nice is if there were some hooks that got called upon certain events which hack writers could tie into... tell WP to call my function when a certain event hits, etc..
    something like.. I write a function I want to run every time a file is uploaded.. I push the function name into some hash or array, and then WP calls all the functions in a given event's array or hash whenever that event occurs..

  8. Matt Mullenweg
    Troublemaker
    Posted 11 years ago #

    Jaykul, you can't override base functions, but what your proposing is a good idea. The add_filter code could be adapted to add a number of event hooks throughout the WP code, allowing for some really interesting plugins or hacks. Let's say that's a version 1.1 feature.
    Most hacks I've seen and could envision writing do something like this. Add functions to a file, then add the function call in your template or through add_filter. Basically this gives you a stable place to put this code and not have it overwritten, and to simplify things for hackers writing installation instructions.
    So for beautifier support, you can put the add_filters in my-hacks.php, have the entire beautifier code in my-hacks.php or just include() the file, etc.
    Smilies can be configured in wp-config-extras.php, but that's not really something that is encouraged per se. But in theory you could have your custom smilie array in my-hacks.php and it would overwrite the default one.

  9. Lester Chan
    Member
    Posted 11 years ago #

    hmm thhat is good, but if you hacked alot..the file would be long..

  10. gfmorris
    Member
    Posted 11 years ago #

    I think that this is a very interesting idea.

  11. gfmorris
    Member
    Posted 11 years ago #

    I also would suggest renaming it my-plugins.php.

  12. FlashBang
    Member
    Posted 11 years ago #

    Why not stick with the naming scheme used throughout wordpress, and call it wp-plugins.php ? everyone would know it's "their" hacks, so the "my" doesnt really seem to be needed. Instead, it gives it an "official" touch if it's called wp-plugins, or wp-hacks..
    thoughts?

  13. Anonymous
    Unregistered
    Posted 11 years ago #

    I think renaming it wp-plugins or wp-hacks makes good sense.

  14. mamabean
    Member
    Posted 11 years ago #

    Oops, that last post was me. Sorry. LOL

  15. mrlarter
    Member
    Posted 11 years ago #

    I think I am a little lost. how exactly will this work? do yuo enter the hack code into this file and the script just knows exactly where its suppose to go? I guess waht I am looking for is a bit more explination about my-hacks.php

  16. Anonymous
    Unregistered
    Posted 11 years ago #

    Is this available in 1.0 ? And how do I use it? I don't want to change anything in the original source right now. That just doesn't work with upgrades and stuff like that.

  17. gfmorris
    Member
    Posted 11 years ago #

    Yeah, I could use some instruction as well. I have a function that I'd like to add [a quick XML-RPC ping], but I don't know where the hooks are to tell it what file should be edited. Specifically, I need to add the below into /wp-includes/functions.php:

    function pingWondergeeks() {
    // Rick King
    $client = new xmlrpc_client("/ping/pingme.php?name=geekking.com", "wondergeeks.net", 80);
    $message = new xmlrpcmsg("", array(new xmlrpcval("geekking.com")));
    $result = $client->send($message);
    if (!$result || $result->faultCode()) {
    return false;
    }
    return true;
    }

  18. Chris J. Davis
    Member
    Posted 11 years ago #

    I think some documentation with examples would be called for in this area, showing best practices for forming the wp-hacks.php document.
    Any takers?

  19. gfmorris
    Member
    Posted 11 years ago #

    I'll wing Matt an email and see what I can do.

  20. Matt Mullenweg
    Troublemaker
    Posted 11 years ago #

  21. jonanhold
    Member
    Posted 11 years ago #

    where can i get a list of filter actions?

  22. Jaykul
    Member
    Posted 11 years ago #

    Heeey! I have an idea ...
    Can we please have remove_filter ?
    Then I could remove the 'default' filters and add my own instead. That would be a big help as far as making 'my hacks' work for me.

  23. Matt Mullenweg
    Troublemaker
    Posted 11 years ago #

    I agree remove filter is needed.

  24. Anonymous
    Unregistered
    Posted 11 years ago #

    I also get "Headers allready sent" errors, each time, with each release.

  25. Matt Mullenweg
    Troublemaker
    Posted 11 years ago #

    SG, make sure you don't have any white space (blank lines) before or after the <?php ?> lines.

  26. southerngal
    Member
    Posted 11 years ago #

    Thanks Matt. I solved that problem by removing a hack that was giving me errors. :)
    I edited my initial post. Still wondering about the question though. :)

  27. southerngal
    Member
    Posted 11 years ago #

    Never mind, answered my own question. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.