WordPress.org

Ready to get started?Download WordPress

Forums

User Photo
Image URL only (2 posts)

  1. NicotineLL
    Member
    Posted 1 year ago #

    Hey guys,

    I need a way to get only the image URL like http://whatever.com/uploads/userphoto/1.jpg for example. Anyone know how to do this?

    http://wordpress.org/extend/plugins/user-photo/

  2. NicotineLL
    Member
    Posted 1 year ago #

    I did manage to achieve the goal, but I had to hardcode the plugin.

    I know it is not the best solution, but it will do for now. Here's how I did it if somebody is wondering:

    user-photo.php line 155 to 173 changed

    $img = '';
    $img .= $before;
    $img .= htmlspecialchars($src) . '"';
    if(empty($attributes['alt']))
    $img .= ' alt="' . htmlspecialchars($userdata->display_name) . '"';
    if(empty($attributes['width']) && !empty($width))
    $img .= ' width="580"';
    if(empty($attributes['height']) && !empty($height))
    $img .= ' height="300"';
    if(empty($attributes['class']))
    $img .= ' class="photo"';
    if(!empty($attributes)){
    foreach($attributes as $name => $value){
    $img .= " $name=\"" . htmlspecialchars($value) . '"';
    }
    }
    $img .= ' />';
    $img .= $after;
    return $img;

    to

    $img = htmlspecialchars($src);
    return $img;

    user-photo.php line 285 changed

    echo userphoto__get_userphoto($userid, USERPHOTO_FULL_SIZE, $before, $after, $attributes, $default_src);

    to

    return(userphoto__get_userphoto($userid, USERPHOTO_FULL_SIZE, $before, $after, $attributes, $default_src));

    Now you can call the URL with

    userphoto($wp_query->get_queried_object());

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic