• I’m getting errors like the following on numerous sites:

    Fatal error: Call to undefined method WP_User::get_error_code() in /home/domain_name/public_html/wp-content/plugins/wordfence/lib/wordfenceClass.php on line 1707

    All these sites were set to automatically update Wordfence. On sites that have yet to update and are running Wordfence 6.2.3, all is well. I went in and proactively disabled Wordfence auto-update, but it appears that Wordfence is updating regardless. Maybe it’s because Wordfence uses some type of cronjob to update itself? Anyway, this needs to be fixed right away. At the very least, it’s critical to be able to turn off auto-update.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’m also getting a similar error when trying to login on all sites that auto updated to 6.2.4 :

    Fatal error: Call to a member function get_error_code() on a non-object in /home/domain/public_html/wp-content/plugins/wordfence/lib/wordfenceClass.php on line 1707

    Thread Starter yitwail

    (@yitwail)

    @bond138 and anyone else experiencing this,

    The line 1707 looked line this in 6.2.3:

    if(is_wp_error($authUser) && $authUser->get_error_code() == 'invalid_username'){
    

    It now reads like this:

    if(is_wp_error($authUser) && ($authUser->get_error_code() == 'invalid_username') || ($authUser->get_error_code() == 'invalid_email')){
    

    I believe it should look like this instead:

    if(is_wp_error($authUser) && (($authUser->get_error_code() == 'invalid_username') || ($authUser->get_error_code() == 'invalid_email'))){
    

    That fixes the error on the one site I tried it on. I encourage you to try it until the plugin gets updated. I know you can’t see the entire line of code, but you can copy/paste it into a text editor.

    • This reply was modified 8 years, 4 months ago by yitwail. Reason: formatting
    • This reply was modified 8 years, 4 months ago by yitwail.
    • This reply was modified 8 years, 4 months ago by yitwail. Reason: formatting
    Plugin Author WFMattR

    (@wfmattr)

    Hi,

    Sorry to hear you had trouble with the update. We are releasing an update to fix the problem shortly for older WordPress versions, very similar or the same as your temporary fix.

    For the inability to turn off automatic updates, it does use wp-cron, but that cron job should be removed when disabling the option. I confirmed that it works correclty on some of our test sites. Can you check if you’re able to update other Wordfence options?

    -Matt R

    Thanks @yitwail for your help. After modifying the code as you suggested I was able to login and update to 6.2.5.

    On a side note @wfmattr I’m running the latest version of WordPress 4.6.1 on all my sites not an old version.

    avanza

    (@prestamos-rapidoses)

    hi everyone, im also having this problem on one of my websites, i cannot enter(login) as it gives me this error.

    If i cant enter admin, how can i update wordfence?

    The solution someone posted, should i make the fix in cpanel touching worfence code as mentioned?

    Thanks

    Thread Starter yitwail

    (@yitwail)

    @prestamos-rapidoses, the other thing you can do is rename or delete the wp-content/plugins/wordfence directory then install & activate latest version of wordfence that fixes this problem.

    Plugin Author WFMattR

    (@wfmattr)

    @yitwail: Thanks for answering and for posting the temporary workaround earlier. If you still have any trouble disabling auto-updates or changing other options, check if your MySQL user has the “alter” privilege — it’s possible the Wordfence config table couldn’t be updated properly if that privilege was missing, which would affect saving of options.

    @prestamos-rapidoses: Renaming wp-content/plugins/wordfence as @yitwail mentioned is the fastest solution. Once you’ve logged in, you can rename the wordfence folder again, and update the plugin through WP Admin. If you’re not familiar with editing your sites’ files, the next automatic update (within 24 hours) should fix the issue for you also.

    -Matt R

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Wordfence 6.2.4 compatibility with older WP’ is closed to new replies.