WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Add Local Avatar] Problems with upload Avatars (13 posts)

  1. BongoUser
    Member
    Posted 5 years ago #

    Hi,

    when users upload there own avatars then it wrong entry in database:
    All links ends with a "dot".

    Example:
    User: BongoUser | Avatar: http://mydomain.de/ava/avafile.jpg.
    I have to change it to http://mydomain.de/ava/avafile.jpg

    I can't found the error in PHP File, please help ;)

    Thanks

  2. peterwsterling
    Member
    Posted 5 years ago #

    Hi BongoUser

    I can't see that error anywhere else! You must be doing something wrong I think...

    Cheers,
    Pete.

  3. BongoUser
    Member
    Posted 5 years ago #

    Hi,

    i can't see what users can make wrong?
    They only upload there ava's ....

    I have test it with new 6.3 release ... same error.
    Value in Local Avatar is: "/images/avatars/bongo_avatar.jpg."
    I have to remove the dot before it works.

  4. peterwsterling
    Member
    Posted 5 years ago #

    Very strange. Perhaps another plug-in is clashing?

  5. Check your functions.php file for any filters you may have put in for other things.

  6. noyz319
    Member
    Posted 5 years ago #

    I just installed this plugin today and am getting the same error as BongoUser. The extra dot appears after the file extension, this is added right to corresponding meta_value entry in the database.

    I found this error only occurs when I check the "Resize uploads" box. if the avatar isn't re-sized then it works fine, but i'd definitely like them resized if possible.

  7. noyz319
    Member
    Posted 5 years ago #

    I've tried deactiviating all plugins and dumping the contents of my functions.php file, no luck yet though.

  8. noyz319
    Member
    Posted 5 years ago #

    Okay, I found the error in the plugin's avatars.php file:

    In the "// Resize required?" section change this line:

    $file = basename($resized_file, '.' . $parts['extension']) . '.' . $parts['extension'];

    to this instead:

    $file = basename($resized_file, '.' . $parts['extension']) . $parts['extension'];

  9. noyz319
    Member
    Posted 5 years ago #

    Also, to make the plugin's output code validate I had to make these other changes.

    Changed these lines:

    $avatar = "<img alt='' src='{$src}' class='{$class} avatar-{$size} avatar-default' height='{$size}' width='{$size}' />";
    
    	// If not in admin pages and there is a URL, wrap the avatar markup with an anchor.
    	if(!empty($url) && $url != 'http://' && !is_admin()) $avatar = "<a alt='Avatar' href='" . attribute_escape($url) . "' rel='nofollow' title='" . (empty($name) ? '' : "Visit $name&rsquo;s website.") . "' " . ($avatar_options['snapshots'] == 'on' ? '>' : "class='snap_noshots'>") . $avatar . "</a>";

    to this:

    $avatar = "<img alt='{$name}' src='{$src}' class='{$class} avatar-{$size} avatar-default' height='{$size}' width='{$size}' />";
    
    	// If not in admin pages and there is a URL, wrap the avatar markup with an anchor.
    	if(!empty($url) && $url != 'http://' && !is_admin()) $avatar = "<a href='" . attribute_escape($url) . "' rel='nofollow' title='" . (empty($name) ? '' : "Visit $name&rsquo;s website.") . "' " . ($avatar_options['snapshots'] == 'on' ? '>' : "class='snap_noshots'>") . $avatar . "</a>";

    Which added the user name as the alt text in the image tag, and i deleted the alt reference that was in the anchor tag.

  10. noyz319
    Member
    Posted 5 years ago #

    sorry, double post

  11. BongoUser
    Member
    Posted 5 years ago #

    $file = basename($resized_file, '.' . $parts['extension']) . $parts['extension'];

    Great, it works :)
    Thanks !!

  12. peterwsterling
    Member
    Posted 5 years ago #

    Ah ha!

    Well spotted, but not quite the real problem. But thanks for the pointer... ;-)
    I have now fixed and will release a new version tonight.

    With respect to the alt tag; yeah fine. Have fixed that too.

  13. BongoUser
    Member
    Posted 5 years ago #

    Thanks.
    Peter, how can i make a german translation of your project?
    It's a lot of work to translate all strings after updates.

  14. peterwsterling
    Member
    Posted 5 years ago #

    German; yes a proper internationalisation would be useful, but a lot of work. Something I might look into... Do you wanna translate and send to me (contact details on my site)?

  15. BongoUser
    Member
    Posted 5 years ago #

    Ok, i send you the translatet file after weekend :)

Topic Closed

This topic has been closed to new replies.

About this Topic