WordPress.org

Ready to get started?Download WordPress

Forums

Author Bio Shortcode
[resolved] Uses Deprecated Function in 3.6 - Broken (5 posts)

  1. Matt Jackson
    Member
    Posted 1 year ago #

    This was a great, lightweight plugin for WP < 3.6

    It relies on get_user_id_from_string which is deprecated in 3.6 and produces this error:

    Fatal error: Call to undefined function get_user_id_from_string() in /wp-content/plugins/author-bio-shortcode/author-bio-shortcode.php on line 63

    WP now requires use of get_user_by instead. Plugin needs some revision to use this.

    http://wordpress.org/plugins/author-bio-shortcode/

  2. Shenson
    Member
    Posted 1 year ago #

    I have the same issue. Please fix this asap.

  3. cyceron
    Member
    Posted 1 year ago #

    Fix:
    find:

    function pj_abs_shortcode($atts){
    	extract(shortcode_atts(array(
    		'id' => NULL,
    		'username' => NULL,
    		'email' => NULL,
    		'avatar' => NULL,
    		'avatar_size' => 96,
    		'name' => NULL,
    		'name_container' => 'h3',
    		'name_class' => 'name',
    		'name_pre' => '',
    		'name_post' => '',
    		'name_link' => NULL,
    		'container_element' => 'div',
    		'container_class' => 'author_bio_shortcode',
    		'avatar_container_element' => 'div',
    		'avatar_container_class' => 'avatar',
    		'bio_container_element' => 'div',
    		'bio_container_class' => 'bio',
    		'bio_paragraph' => true
    
    	), $atts));

    and insert before:

    function get_user_id_from_string( $string ) {
    	_deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' );
    
    	if ( is_email( $string ) )
    		$user = get_user_by( 'email', $string );
    	elseif ( is_numeric( $string ) )
    		return $string;
    	else
    		$user = get_user_by( 'login', $string );
    
    	if ( $user )
    		return $user->ID;
    	return 0;
    }
  4. philipjohn
    Member
    Plugin Author

    Posted 1 year ago #

    I am aware of this and will update the plugin with a fix as soon as I have a moment.

    Phil

  5. philipjohn
    Member
    Plugin Author

    Posted 1 year ago #

    v2.3 fixes this issue.

    For clarity to other users, please don't implement @cyceron's suggestion. The appropriate fix is to use the get_user_by() function as first suggested by YahSureMan (thank you).

    Cheers,
    Phil

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.