The MU forums have moved to WordPress.org

wp-activate.php - bug (12 posts)

  1. simplistik
    Member
    Posted 4 years ago #

    I've seen a few of the other threads about wp-activate.php not working. I want to sorta put more detail. Originally I thought that the wp-activate.php page wasn't pulling in the functions.php cause I noticed that the page stopped loading at a specific point that required a custom function from my functions.php file. But after looking at the half loaded page I could see that it was pulling the load file which calls functions.php, it however is not pulling any dependencies from installed plug-ins, I also checked my php logs and saw that it was trying to pull a non-existent class that is available at all other times.

    By default wp-activate.php page includes both the header.php and the footer.php. I found that if you have any functions being executed in the header that require a plug-in be activate, the page will fail and registration will not go through. Resulting in the half loaded page that many other people have gotten.

    So as a test, I did:
    functions.php

    function foo () { echo 'bar'; };
    function a() { // load some function that's dependent on a plug-in }

    When I ran all these functions in the header.php the results were this:

    1. foo(); - success
    2. a(); - fail
    3. gravity_form(1); - fail

    gravity_form() is a function available w/ the gravity forms plug-in put directly into the header.php, and was not located in my functions.php.

    As a temporary stopgap I had to do:

    if ( basename($_SERVER['PHP_SELF']) != 'wp-activate.php' ) include('foo.php');

    which keeps the section that had previously had my functions in it from loading if it's trying to activate.

    Anyway, I hope this helps someone figure out how to actually fix this issue.

  2. tmoorewp
    Member
    Posted 4 years ago #

    You should file this in Trac if you haven't already.

  3. nuwomb
    Member
    Posted 4 years ago #

    what file do we try and add that bit of code to? the wp-activate?

  4. lokers
    Member
    Posted 4 years ago #

    hey, this is very interesting topic. I am trying to change few things in this page (wp-activate.php) and i need to call some functions and I would LOVE to have plugins installed and ready to call here too. I couldn't find anything on the web that will help to solve it. Did someone have any luck?

  5. lokers
    Member
    Posted 4 years ago #

    ok, I removed the first line and it worked:

    define( "WP_INSTALLING", true );

    I hope it will help anyone too ;)

  6. simplistik
    Member
    Posted 4 years ago #

    @nuwomb you have to add this part of code in either the header.php or the footer.php since that's where the bug gets holed up at. You "wrap" it around any functions that need a plug-in to be executed. The include portion of that code is just pseudo code of course. You could just as easily do

    if ( basename($_SERVER['PHP_SELF']) != 'wp-activate.php' ) gravity_form(1);

    or

    if ( basename($_SERVER['PHP_SELF']) != 'wp-activate.php' ):
      gravity_form(1);
      somepluginfunction();
      andanotherfunction();
    endif;

    @lokers only problem with this method is that when you upgrade WP you'll have to change it again, and again ... and yet again LoL. And unfortunately since it's a constant you can't unset it in the functions.php which does get called after that line.

  7. jazgold
    Member
    Posted 4 years ago #

    @simplistik : i know it's horrible to modify core files.

    but I'm making an exception here. it's only one file... easy to remember to drop into updates... it's pretty much independent from other items... and it's necessary for my cause.

    basically i have a plugin that needs to hear about the "user_register" event. registration.php would normally be firing the action, and of course it's not because none of the add_actions are being called. plugins just don't exist. but i need this to work.

    so there you go. i'm breaking the cardinal rule, but i deem it a necessary evil, and thanks lokers for stumbling upon the solution (i'm assuming a lot of trial and error).

  8. eddiemoya
    Member
    Posted 4 years ago #

    I am wondering if there was in fact a ticket submitted to Trac for this? My theme is completely failing on wp-activate because it depends heavily upon plugin functions.

  9. andrea_r
    Moderator
    Posted 4 years ago #

    You could try loading functions in a file called sunrise.php & place it in wp-content.

  10. eddiemoya
    Member
    Posted 4 years ago #

    I have found the trac ticket for this. It does not appear as if any progress as been made.

    http://trac.mu.wordpress.org/ticket/1151

    andrea_r, I am not sure how you mean this. I tried just creating a file called sunrise.php and dropping it in wp-content, the placing some functions in there, but they did not function in wp-activate either.

  11. eddiemoya
    Member
    Posted 4 years ago #

    Found another ticket regarding this issue. They seem to have worked out a solution that will be available in 3.0

    http://core.trac.wordpress.org/ticket/12166

  12. eddiemoya
    Member
    Posted 4 years ago #

    Ok, so scratch that. #12166 is NOT related to this problem. But http://core.trac.wordpress.org/ticket/12140 seems to be.

About this Topic

  • Started 4 years ago by simplistik
  • Latest reply from eddiemoya