HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Notifications Poplist Avatar Icon

Hi Team,

I managed to change the photo avatar img src path using public function userPhoto & userPhotoUrl. It's working ok on category & discussion list however the on the notifications & inbox poplist it's still pulling img src from the local "...uploads/userpics/..." path.

I believe the poplist is generated through global.js. Any idea on how do I hook to change it's img src?

TIA

Comments

  • R_JR_J Ex-Fanboy Munich Admin

    It is fetched with JavaScript, but you can also open the page simply by visiting /profile/notifications

    So it is the ProfileControllers notifications() method which is showing the view. Inside that method you find $activities = $this->ActivityModel->getNotifications($session->UserID, $offset, $limit)->resultArray(); and so our journey continues to the ActivityModels getNotifications() method...

    In the getNotifications() method you find the user photo mentioned:

    Gdn::userModel()->joinUsers(
        $result->resultArray(),
        ['ActivityUserID', 'RegardingUserID'],
        ['Join' => ['Name', 'Photo', 'Email', 'Gender']]
    );
    

    On to the UserModels joinUser() method! Searching there for the photo brings up those lines:

    if ($column == 'Photo') {
        if ($value && !isUrl($value)) {
            $value = Gdn_Upload::url(changeBasename($value, 'n%s'));
        } elseif (!$value) {
            $value = UserModel::getDefaultAvatarUrl($user);
        }
    }
    

    And then we are at the url() method of Gdn_Upload - we are there again, if I remember correctly :wink:


  • Thanks for all the help. I fixed it by overriding the activity/popin.php using the helper_function I created to replace img src.

Sign In or Register to comment.