WordPress.org

Plugin Directory

Changeset 500283


Ignore:
Timestamp:
02/04/12 19:16:32 (2 years ago)
Author:
sivel
Message:

Support PHP versions below 5.3.0, by not using lambda function creation in add_action for admin_notices

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wordpress-reset/trunk/wordpress-reset.php

    r496815 r500283  
    111111        } 
    112112 
    113         if ( array_key_exists( 'reset', $_GET ) && stristr( $_SERVER['HTTP_REFERER'], 'wordpress-reset' ) ) { 
    114             add_action( 'admin_notices', function () { 
    115                 $user = get_user_by( 'id', 1 ); 
    116                 echo '<div id="message" class="updated fade"><p><strong>WordPress has been reset back to defaults. The user "' . $user->user_login . '" was recreated with its previous password.</strong></p></div>'; 
    117                 do_action( 'wordpress_reset_post', $user ); 
    118             } ); 
    119         } 
     113        if ( array_key_exists( 'reset', $_GET ) && stristr( $_SERVER['HTTP_REFERER'], 'wordpress-reset' ) ) 
     114            add_action( 'admin_notices', array( &$this, 'reset_notice' ) ); 
     115    } 
     116 
     117    // admin_notices action hook operations 
     118    // Inform the user that WordPress has been successfully reset 
     119    function reset_notice() { 
     120        $user = get_user_by( 'id', 1 ); 
     121        echo '<div id="message" class="updated fade"><p><strong>WordPress has been reset back to defaults. The user "' . $user->user_login . '" was recreated with its previous password.</strong></p></div>'; 
     122        do_action( 'wordpress_reset_post', $user ); 
    120123    } 
    121124 
Note: See TracChangeset for help on using the changeset viewer.