Home Forums WC Vendors Free Support Vendor avatar picture on Seller info tab

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #16352
    dfaldin
    Participant

    Hello,

    I want to display vendor avatar picture also on single product page (on Seller info tab).
    I put the line of code as below in class-vendor-shop.php:

    /**
    	 *
    	 */
    	public static function seller_info_tab_panel()
    	{ <strong>echo get_avatar($vendor_id, 200); ?><br /> <?php</strong>
    		echo self::$seller_info;
    	}

    Because I will lose this in case of WC Vendors update please can you suggest me if there is any simple but wiser
    way to do this. 🙂

    Thanks

    #16353
    dfaldin
    Participant

    Sorry, the code is without

    /**
    	 *
    	 */
    	public static function seller_info_tab_panel()
    	{ echo get_avatar($vendor_id, 200); ?><br /> <?php
    		echo self::$seller_info;
    	}

    #16355
    WC Vendors Support
    Participant

    If you look in the code where you added that, you will see two filters:

    wcv_before_seller_info_tab

    wcv_after_seller_info_tab

    ….so using one of those two filters and then outputting the avatar code in your themes functions.php file would be upgrade safe and the proper way to do it. 🙂

    #16356
    dfaldin
    Participant

    the code is without strong

    #16358
    dfaldin
    Participant

    OK. I am not some coding expert, but I hope I will succeed to do that. 🙂

    Thanks
    Regards

    #16408
    dfaldin
    Participant

    Hello,

    I am here again. 🙂

    With this code I can get avatar on the right place:

    /* Add avatar before the Seller Info tab text */
    add_filter( 'wcv_before_seller_info_tab', 'avatar_wcv_before_seller_info_tab' ,10, 1 );
    function avatar_wcv_before_seller_info_tab( $message ) {
        $message = (get_avatar($vendor_id, 200)); ?><br /><?php
        return $message;
    }

    But I can not get break line after that. ?><br /><?php does not work that job.

    #16409
    WC Vendors Support
    Participant

    $message = get_avatar($vendor_id, 200) . '<br>';

    #16412
    dfaldin
    Participant

    Thanks
    This is resolved. 🙂
    Regards

    #16766
    dfaldin
    Participant

    Hello,

    I have still one unexpected problem here:
    I am trying to put the shop name below avatar. I have tried $message = get_avatar($vendor_id, 200) . '<br>' . get_user_meta( $vendor_id, 'pv_shop_name', true ) . '<br>' . '<br>';
    and $message = get_avatar($vendor_id, 200) . '<br>' . $shop_name . '<br>' . '<br>';
    But none of them work.

    Please do you have a solution for this?

    Thanks

    #16767
    WC Vendors Support
    Participant

    You have to define $shop_name first. You’re just showing an empty undefined variable.

    $shop_name = get_user_meta………. and then echo it out. 🙂

    #16798
    dfaldin
    Participant

    Hello,

    Thanks for your answer.

    I have tried this combination:

    /* Add avatar before the Seller Info tab text */
    add_filter( 'wcv_before_seller_info_tab', 'avatar_wcv_before_seller_info_tab' ,10, 1 );
    function avatar_wcv_before_seller_info_tab( $message ) { $shop_name = get_user_meta( $vendor_id, 'pv_shop_name', true );
        $message = get_avatar($vendor_id, 200) . '<br>' . $shop_name . '<br>' . '<br>';
        return $message;
    }

    But that does not work. I have missed something again 🙂

    #16823
    dfaldin
    Participant

    Hello,

    I added $user_id = get_current_user_id(); before $shop_name = get_user_meta( $user_id, ‘pv_shop_name’, true );, and now it seems it is OK 🙂

    #16825
    WC Vendors Support
    Participant

    get_current_user_id will get the ID of whoever is logged in. So if I am logged into your website, it would show MY avatar not your Sellers avatar. 🙂

    You’d probably want to change that line to something like:

    $user_id = get_the_author_id();

    ….and then the Vendors ID will be used, not whoever is logged in or nobodies. Since the Vendor is the post_author of the product, the get_the_author_id will do just what it sounds like. 🙂

    Have fun

    #16829
    dfaldin
    Participant

    OK. I have done that way and it works. 🙂

    Thanks for your help.
    Regards

Viewing 14 posts - 1 through 14 (of 14 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.