Support » Plugin: Author Bio Shortcode » Uses Deprecated Function in 3.6 – Broken

  • Resolved Matt Jackson

    (@yahsureman)


    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/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have the same issue. Please fix this asap.

    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;
    }

    Plugin Author Philip John

    (@philipjohn)

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

    Phil

    Plugin Author Philip John

    (@philipjohn)

    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Uses Deprecated Function in 3.6 – Broken’ is closed to new replies.