Affiliate Profile Picture Integration

Posted in

Somehow I need to integrate an upload field for affiliates to display their profile picture which needs to be generated by shortcode. If there was someway to just have the affiliates facebook profile image display based on their profile url that would be good also but I think that might be too difficult to do.

What can you recommend me for this issue?

How can I pull this off?

Thanks

6 Responses to Affiliate Profile Picture Integration

  1. George June 19, 2017 at 8:23 am #

    Hi Derek,

    The easiest way to implement would be with a shortcode by using the get_avatar(…) function. This would display the same way as it is displayed in the user profile page.

    Kind regards,
    George

  2. Derek June 19, 2017 at 1:19 pm #

    Hi,

    Yeah I could just use a simple plugin to display an avatar with a shortcode but I need the avatar displayed to be the avatar of the affiliate who is the referrer. Like I’ve just clicked an affiliate link and it directs me to the website displaying my referrer along with the avatar of that affiliate. So how do I tie get avatar to affiliate id?

    Thanks

  3. George June 19, 2017 at 5:04 pm #

    I see.

    You can get the user_id with affiliates_get_affiliate_user and then retrieve the avatar for that user.

    Cheers,
    George

  4. Derek June 23, 2017 at 4:49 am #

    Hey George,

    I’ve still not succeeded in making this work. Here’s what I’ve tried.

    add_action( ‘init’, ‘show_affiliate_info’ );
    function show_affiliate_info( $data) {

    $pretext = “You come referred by “;
    if ( !is_admin() ) {
    if (!class_exists(“Affiliates_Service”))
    include_once( AFFILIATES_CORE_LIB . ‘/class-affiliates-service.php’ );

    $affiliate_id = Affiliates_Service::get_referrer_id();

    if ( $affiliate_id ) {
    if ( $affiliate_id !== affiliates_get_direct_id() ) {
    if ( $user_id = affiliates_get_affiliate_user( $affiliate_id ) ) {
    if ( $user = get_user_by( ‘id’, $user_id ) ) {
    echo get_avatar( $id_or_email, affiliate_id);
    }
    }
    }
    }
    }
    }

    But it sort of breaks things. I’m not great at php stuff. So I’m wondering how much I have to pay you guys to make this work for me? Let me know about that.

    Thanks

  5. George June 23, 2017 at 9:56 am #

    Thanks for sharing Derek, i will have a look at this and post an updated version of this.

    Cheers,
    George

  6. George June 23, 2017 at 1:25 pm #

    Hi Derek,

    I modified slightly your snippet and made it a shortcode.
    You can find it at Referring Affiliate’s Avatar – example shortcode and you can use it if you place [referring-affiliate-avatar] in your affiliate area page, preferably enclosed in the shortcode block [affiliates_is_affiliate]…[/affiliates_is_affiliate]

    Cheers,
    George

Only authorized members can comment on this topic.

Log in