Note that there are some explanatory texts on larger screens.

plurals
  1. POWordPress 3.5 Changed User.php Which Breaks Plugin, Can this function be the issue? Can it be fixed?
    primarykey
    data
    text
    <p>A plugin provides login for a WordPress multi-site network. This plugin now fails under WP 3.5 because the user.php file was changed. The old lines in /wp-includes/user.php can be added back in and the plugin would work. Obviously this is not a long term solution.</p> <p>This is the old code from user.php</p> <pre><code>if ( empty( $user ) ) $user = wp_get_current_user(); else $user = new WP_User( $user ); if ( ! isset( $user-&gt;ID ) ) return false; </code></pre> <p>This is the new code from 3.5</p> <pre><code>if ( empty( $user ) ) $user = get_current_user_id(); if ( ! $user = get_userdata( $user ) ) return false; </code></pre> <p>I'm a beginner trying to learn php and so I'm not sure on all of the meanings. However, I think this is the code in the plugin causing issue:</p> <p>function get_userdata( $user_id ) { global $wpdb;</p> <pre><code>if ( ! is_numeric( $user_id ) ) return false; $user_id = absint( $user_id ); if ( ! $user_id ) return false; $user = wp_cache_get( $user_id, 'users' ); //check to see if the cache object already has the user if ( $user ) { return $user; //it was in the cache } $user = new StdClass (); global $XF; XF_User_Data::fillUserData($XF-&gt;visitor, $user, $user_id); update_user_caches($user); return $user; </code></pre> <p>}</p> <p>The new StdClass can be commented out and the error is removed but then no one can login.</p> <p>How could I re-write this function to not cause the error?</p> <p>*Fatal error: Call to undefined method stdClass::has_prop() /wp-includes/user.php*</p> <p>The developer of the plugin is 'on vacation' and hasn't updated. He's waiting for some other changes, however, this needs to be fixed. </p> <p>Any suggestions on fixing the code? Am I looking in the wrong place? Are other details needed before someone can help?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload