WordPress.org

Ready to get started?Download WordPress

Forums

Last Login
[resolved] Calling function stops page creation (3 posts)

  1. RayBernard
    Member
    Posted 2 years ago #

    I am using the Exec-PHP plugin, which allows me to execute PHP code in widgets. The following code works without the call to get_last_login_current_user(), but with the function call I get a blank page displayed. Page rendering stops and a fatal error message is generated:

    Fatal error: Call to undefined function last_login_time() in [path shortened...]/wp-content/plugins/last-login/last-login.php on line 100

    Here is the code I am using.

    I have uninstalled and reinstalled the plugin and error still occurs.

    I looked in the last-login.php file, and I see that no last_login_time() function exists in it.


    <?php
    echo  '<span class="last-logged-in-text">You last logged in: </span><span class="last-logged-in-date">';
       echo get_last_login_current_user();
       echo  '</span>';
    ?>

  2. richalt2
    Member
    Posted 2 years ago #

    Call to undefined function last_login_time() is a bug in get_last_login_current_user(). Line 100 should be a call to the proceeding function get_last_login().
    Change:
    function get_last_login_current_user($format='%c') {
    $current_user = wp_get_current_user();
    return last_login_time($current_user->ID, $format);
    }

    To:
    function get_last_login_current_user($format='%c') {
    $current_user = wp_get_current_user();
    return get_last_login($current_user->ID, $format);
    }

  3. RayBernard
    Member
    Posted 2 years ago #

    richalt2 - thanks! Of course that did the trick.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags