WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: SP Authors] Bug on Sp-authors (3 posts)

  1. hopeac
    Member
    Posted 5 years ago #

    hi,
    I am not sure if I am the only one having the problem. When I selected the display name in the admin form, it does not save in the database.

    The values submitted in the admin tool are displayed names, and the function to get the ID for the user is expecting the login name. Therefore if the display name and login are not the same, the ID cannot be retreived.

    I have resolved the issue, hopefully my solution can help someone else.

    In function sp_authors_save_post_meta($new_post_id, $post)

    Change
    $author_id = _get_author_id_by_login(trim($co_author));
    to
    $author_id = _get_author_id_by_display(trim($co_author));

    Insert the following function

    function _get_author_id_by_display($login) {

    global $wpdb;

    $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users
    where display_name='$login'
    ");

    return $user_id;
    }

    http://wordpress.org/extend/plugins/sp-authors/

  2. diosney
    Member
    Posted 4 years ago #

    Hi!

    Thanks for the tip!

  3. leticia
    Member
    Posted 4 years ago #

    Hello

    Thanks for the report. The code is updated as hopeac suggest.

    Regards
    Leticia

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags