• chrispink

    (@chrispink)


    <? if (userphoto_the_author_photo() ) { ?>

    <? } ?>

    …echoes the photo as an object and returns FALSE.

    I would like to use my own code in this condition if it returns TRUE

    how do I test (returning TRUE or FALSE) whether there is an author photo without returning the object?

    https://wordpress.org/plugins/user-photo/

Viewing 1 replies (of 1 total)
  • Thread Starter chrispink

    (@chrispink)

    Just to add this geezer has written some well dodgy code. AVOID!

    This outputs the photo and returns FALSE

    <? if (!userphoto_the_author_photo() == "" ) { ?>
    
             <? echo "here" ; ?>
    
             <?  } ?>

    and because life is too short to go off looking for other solutions and the backend does work.

    this function;

    if (userphoto_exists(get_the_author_meta( 'ID' )) )

    I found in the plugin does the trick (note the necessary parameter).

    so the whole code;

    if (userphoto_exists(get_the_author_meta( 'ID' )) ) {
         get_avatar(get_the_author_meta( 'ID' ));
    }

    outputs the author photo (if one exists) and nothing (no gravatar) if not.

Viewing 1 replies (of 1 total)
  • The topic ‘Logic issue’ is closed to new replies.