Change the profile photo when claimed

This topic contains 9 replies, has 3 voices, and was last updated by  Alex Rollin 6 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #437529

    Clayton Gibson
    Expired Member
    Post count: 84

    Is it possible to have a default listing owner image until the listing is CLAIMED? In other words, if admin adds a business, it doesn’t display the user photo on it.

    I already have this code

    function gd_custom_default_author_avatar( $avatar ) {
    global $post;

    if ( !empty( $post->ID ) ) {
    $avatar_src = get_stylesheet_directory_uri() . ‘/images/gravatar2.png’;
    $avatar = ‘‘;
    }

    return $avatar;
    }
    add_filter( ‘sd_detail_entry_author’, ‘gd_custom_default_author_avatar’, 100, 1 );

    but the unclaimed post has the same image as claimed…

    #437538

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #437562

    Kiran
    Moderator
    Post count: 7069

    Hello,

    Try this.

    
    
    function gd_custom_default_author_avatar( $avatar ) {
        global $post;
        
        if ( !empty( $post->ID ) ) {
            if ( ! (int)geodir_get_post_meta($post->ID, 'claimed', true) && ! empty($post->post_author) ) {
    			$avatar = get_avatar($post->post_author, 100);
    		} else {
    			$avatar_src = get_stylesheet_directory_uri() . '/images/gravatar2.png';
    			$avatar = '<img src="' . $avatar_src . '" height="100" width="100">';
    		}
        }
        
        return $avatar;
    }
    add_filter( 'sd_detail_entry_author', 'gd_custom_default_author_avatar', 100, 1 );

    Kiran

    #437687

    Clayton Gibson
    Expired Member
    Post count: 84

    This is not working..All is set on 1 image – claimed and unclaimed places..

    I want it to have a default image when claimed and other picture when unclaimed..

    #437689

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #437720

    Clayton Gibson
    Expired Member
    Post count: 84
    This reply has been marked as private.
    #437740

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #437855

    Clayton Gibson
    Expired Member
    Post count: 84

    Hi, it’s working but I don’t want the post author picture to be there…it should be the default image which is this /images/gravatar2.png….

    I tried coding them but it didn’t work…

    Please check..thanks

    #437857

    Clayton Gibson
    Expired Member
    Post count: 84

    I think I got it…thank you so much

    #437871

    Alex Rollin
    Moderator
    Post count: 27815

    Great, thanks for letting us know 🙂

Viewing 10 posts - 1 through 10 (of 10 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount