• Resolved ofmarconi

    (@ofmarconi)


    Hello
    I’m integrated with JetEngine

    I need to know which metakey is responsible for storing the Profile image path, I want to change it via another plugin and also call Metakey elsewhere on the site.

    It is possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Daniel Tara

    (@danieltara)

    There is a little bit of explaining needed here. Because the avatar is associated with user meta and the user meta table is shared in multisite installations, the meta key includes the table prefix and blog id followed by user_avatar. On non-multisite installations the blog id is omitted.

    For example, for a default, unaltered, non-multisite installation for which the table prefix was left as wp_ the meta key is wp_user_avatar.

    If say the table prefix was changed to mysite_ the meta key becomes mysite_user_avatar.

    If this were a multisite installation and the blog id is 4 the meta key becomes mysite_4_user_avatar.

    Because this is associated with the user meta table, the function to retrieve the avatar is get_user_meta(). The easiest way to retrieve the meta key is to use the $wpdb->get_blog_prefix() method.

    Note that the meta value stores the avatar id and not the path. For this reason you need to use the wp_get_attachment_image_src() function to retrieve the avatar URL.

    Here is a working example:

    global $wpdb, $blog_id;
    $avatar_id    = get_user_meta( $user_id, $wpdb->get_blog_prefix( $blog_id ) . 'user_avatar', true );
    $avatar_image = wp_get_attachment_image_src( $avatar_id, 'full' );
    $avatar_url   = $avatar_image[0];
    
    Thread Starter ofmarconi

    (@ofmarconi)

    Wow!

    A great explanation!

    Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘I’m integrated with JetEngine’ is closed to new replies.