# Auto-populating image with user's profile picture

**URL:** <https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475>\
**Category:** Ask the community\
**Tags:** wix-members-area, code, wix, question\
**Created:** [November 10, 2024, 1:07am UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475 "2024-11-10T01:07:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![austinmdiamond](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/austinmdiamond/32/84276_2.png) [@austinmdiamond](https://forum.wixstudio.com/u/austinmdiamond)\
**Post date:** [November 10, 2024, 1:07am UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475/1 "2024-11-10T01:07:46Z")

</div>

**Question:**  
Hi! I am building a personalized site where I would love to construct the pages so that each page a user goes to, their profile picture is the one automatically shown in the center page. (See attached). So, fo

 ![Screenshot 2024-11-09 at 5.03.10 PM](https://us1.discourse-cdn.com/wix/original/3X/c/1/c11f4eb2e55868ac0a1d2b0460c46fae4d7c7f51.jpeg)  
r example, the boy here (“John”) is shown to John as he navigates between the Learn, Live, and other pages; but if “Jenny” was visiting these pages, her own picture would be shown instead.

**Product:**  
Wix Editor

**What are you trying to achieve:**  
I want to do this to provide as personalized an experience as possible. It’s always lovely seeing your own face, rather than someone else’s!

**What have you already tried:**  
I’m familiar with dynamic pages, but if I used dynamic pages I would need to manually change the images myself for every member, and on every set of dynamic pages, which would be impossible due to the time! I would like to find out if there is a code solution to make the page “auto-populate”, as mentioned, with the user’s profile photo.

**Additional information:**  
Thank you! 🙂

---

<div class="post-metadata">

**Author:** ![onemoretime](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/onemoretime/32/104023_2.png) [@onemoretime](https://forum.wixstudio.com/u/onemoretime)\
**Post date:** [November 10, 2024, 4:08am UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475/2 "2024-11-10T04:08:10Z")

</div>

Hi, austinmdiamond !!

If you can use Velo code, you should be able to implement this by retrieving the currently logged-in user’s information after the page loads, then obtaining their profile image URL from that data, and applying the retrieved image URL to the image element on the page. 🙌

---

<div class="post-metadata">

**Author:** ![austinmdiamond](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/austinmdiamond/32/84276_2.png) [@austinmdiamond](https://forum.wixstudio.com/u/austinmdiamond)\
**Post date:** [December 2, 2024, 9:07am UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475/3 "2024-12-02T09:07:38Z")

</div>

Hi, I am just now seeing your reply!

Could you please describe more clearly/even provide the code, if you’re up for it! 🙂 of how exactly to do this?

What you’re describing sounds like exactly what I’m after, but I don’t know how to actually do it… 🤔

---

<div class="post-metadata">

**Author:** ![austinmdiamond](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/austinmdiamond/32/84276_2.png) [@austinmdiamond](https://forum.wixstudio.com/u/austinmdiamond)\
**Post date:** [December 2, 2024, 10:19pm UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475/4 "2024-12-02T22:19:37Z")

</div>

bump! I am so close now, I can’t let this go!! 😃 I will give whoever answers this the biggest virtual fist bump in the world 🙂

---

<div class="post-metadata">

**Author:** ![Pratham](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pratham/32/119586_2.png) [@Pratham](https://forum.wixstudio.com/u/Pratham)\
**Post date:** [December 3, 2024, 11:30am UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475/5 "2024-12-03T11:30:04Z")

</div>

There you go:

```javascript
import { authentication, currentMember } from "wix-members-frontend";

$w.onReady(function () {

    const isLoggedIn = authentication.loggedIn();
    if (isLoggedIn) {
        fetchMemberData();
    } else {
        authentication
            .promptLogin({ mode: 'login', modal: false })
            .then(() => {
                fetchMemberData();
            })
            .catch((error) => {
                console.error(error);
            });
    }

});

function fetchMemberData() {

    currentMember
        .getMember({ fieldsets: ['FULL'] })
        .then((member) => {

            $w('#image1').src = member.profile.profilePhoto.url;

        })
        .catch((error) => {
            console.error(error);
        });

}

```

Just remember to change **#image1** with the ID of your image element (:

---

<div class="post-metadata">

**Author:** ![austinmdiamond](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/austinmdiamond/32/84276_2.png) [@austinmdiamond](https://forum.wixstudio.com/u/austinmdiamond)\
**Post date:** [December 3, 2024, 6:49pm UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475/6 "2024-12-03T18:49:25Z")

</div>

Hi there, thanks for your help. It’s not working. Please see screenshot. When I run it, it says that there are errors, and this girl (who I just put as the placeholder image and called #memberimage) is supposed to be replaced by the logged-in user’s profile picture (a boy with goggles on, currently). 🙂

 ![Screenshot 2024-12-03 at 10.47.33 AM](https://us1.discourse-cdn.com/wix/original/3X/d/e/de0048d449d5f1d242dfa79c7016834ee323cc22.jpeg)

---

<div class="post-metadata">

**Author:** ![Pratham](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pratham/32/119586_2.png) [@Pratham](https://forum.wixstudio.com/u/Pratham)\
**Post date:** [December 4, 2024, 6:18am UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475/7 "2024-12-04T06:18:16Z")

</div>

Hey Austin, looks like you didn’t copy paste the whole code from my previous post.

Make sure the whole code is copied, there are a few more lines below Line 27.

---

<div class="post-metadata">

**Author:** ![austinmdiamond](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/austinmdiamond/32/84276_2.png) [@austinmdiamond](https://forum.wixstudio.com/u/austinmdiamond)\
**Post date:** [December 4, 2024, 7:18am UTC](https://forum.wixstudio.com/t/auto-populating-image-with-users-profile-picture/64475/8 "2024-12-04T07:18:06Z")

</div>

Oh, you absolutely rock!!! 😃

Since you figured that out, would you happen to know the answer to this other question of mind regarding member blogging?

> [@Confused about member blog](https://forum.wixstudio.com/t/confused-about-member-blog/65337):
>
> Question: Hi! I’m confused about the member blog capabilities. I clicked Member Manage Pages and added the My Posts page that says “Let members create their own posts and drafts”. When I log in as a member, I get the Blog Posts (My Posts) page, but when I click Create Post, it takes me to We Couldn’t Find This Page. (See screenshot) My goal was to have each member be able to create their own personal blog on my website (and then share it if they want to). What am I missing here? Thanks! Austi…

Thanks! 😃
