Support » Plugin: User Photo » Problem with echo and return

  • Hello,
    First of all, thanks for your plugin. I really like it.

    I have used the function userphoto() to define a custom shortcode.
    But I had problem with the integration of this function : the result jumps everytime out of my div structure.

    The shortcode function is very simple :
    function photo_shortcode( $atts, $content = null ) {
    extract( shortcode_atts( array(
    ‘username’ => ”,
    ‘class’ => ”,
    ), $atts ) );
    return userphoto($username, ‘<div class = “‘ . $class . ‘”>’, ‘</div>’, array(‘alt’ => $content));
    add_shortcode( ‘photo’, ‘photo_shortcode’ );

    Then I could use it like that :
    [photo username=”myusername” class=”alignleft”]My Alt description[/photo]

    I didn’t understand why it jumps out of my div structure until I went and see into the code of the file user-photo.php of your plugin.
    I know that it should be avoided but I have replaced in each function the “echo” with “return”. I don’t understand why it has been decided to “echo” the result. It broke the dom structure. If I want “echo” it I can do ‘echo userphoto(…)’, don’t you think ? So since I have done this replacement, everythink works fine.

    So now I am just affraid of future update of your plugin. So I have just few simples questions ; did you code the echo result in purpose ? And do you think the echo replacement by “return” in foolish and no possible for next versions ?

    Thanks in advance


  • The topic ‘Problem with echo and return’ is closed to new replies.