WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Add Local Avatar] Avatar-Link to user-profile page? (6 posts)

  1. Steve Delve
    Member
    Posted 4 years ago #

    Hey there!
    Thanks so much for sharing your plugin! I was just wondering if there is a way to set the avatar-link to a "user-profile" page (in my case generated by the forum-server plugin) and not to the default "user url"?

    This way i want to create more interaction between the users on my site, and not send them away onto a different url.

    I would really appreciate your help with that. I spend already days to figure out how to do it myself, but unfortunately i'm not very familiar with php.

    Regards,
    Stefan

    example profile: http://www.themichaeljacksonfiles.com/forum/?vasthtmlaction=profile&id=34

    http://wordpress.org/extend/plugins/add-local-avatar/

  2. mayuxi
    Member
    Posted 4 years ago #

    Ding! Same problem. Any solutions?

  3. mayuxi
    Member
    Posted 4 years ago #

    /add-local-avatar/avatars.php

    from line 122 to 140,

    if(is_numeric($id_or_email)) {											// Numeric - user ID...
    		$id = (int)$id_or_email;
    		$user = get_userdata($id);
    		if($user) {
    			$email = $user->user_email;
    			$name = ($avatar_options['name'] == 'on' ? $user->nickname : $user->first_name . ' ' . $user->last_name);
    			$url = '/author/'.$user->user_nicename;
    		}
    	}
    	elseif(is_object($id_or_email)) {										// Comment object...
    		if(!empty($id_or_email->user_id)) {									// Object has a user ID, commenter was registered & logged in...
    			$id = (int)$id_or_email->user_id;
    			$user = get_userdata($id);
    			if($user) {
    				$email = $user->user_email;
    				$name = ($avatar_options['name'] == 'on' ? $user->nickname : $user->first_name . ' ' . $user->last_name);
    				$url = '/author/'.$user->user_nicename;
    			}
    		}
  4. lecosmonaute
    Member
    Posted 4 years ago #

    Say I'm using the default (ugly) permalink structure (link should be 'domain.com/?author=1'), how would I go about doing that ?

  5. Ian
    Member
    Posted 4 years ago #

    great thread. Needed this. Thank you!

  6. mayuxi
    Member
    Posted 4 years ago #

    Say I'm using the default (ugly) permalink structure (link should be 'domain.com/?author=1'), how would I go about doing that ?

    Something like this:
    change in the code above $url = '/author/'.$user->user_nicename;
    to $url = '/?author='.$user->user_id;

    Sorry, I'm not real php programmer, so I can't optimize this code to work with two different permalink structure.

    I hope, that Peter will fix it up.

Topic Closed

This topic has been closed to new replies.

About this Topic