Solved: 7 Years, 2 Months, 3 Weeks ago [General] {$mybb->user['avatar']}
#1
Solved: 7 Years, 2 Months, 3 Weeks ago
Hi,

I noticed that the user's uploaded avatar when shown in the theme's template, it doesn't provide the full address to the avatar but with a relative path like "./uploads/adasdasdasd.jpg"

So, basically, all the page that uses the template outside the forums directory that try to retrieve the user's uploaded avatar will fail because of the relative path.

Anyway I can make it use full path instead of relative path?
Reply
#2
Solved: 7 Years, 2 Months, 3 Weeks ago
Add $mybb->settings['bburl'] before it and remove everything before /uploads/ from $mybb->user['avatar'] [by using strpos() and substr() for example]
Reply
#3
Solved: 7 Years, 2 Months, 3 Weeks ago
(2015-02-20, 11:24 PM)Destroy666 Wrote: Add $mybb->settings['bburl'] before it and remove everything before /uploads/ from $mybb->user['avatar'] [by using strpos() and substr() for example]

how about people who use external URL for avatar?
Reply
#4
Solved: 7 Years, 2 Months, 3 Weeks ago
Just check if the URL is absolute/relative with a simple conditional first - for example if it starts with http:// or https:// (iIrc only these types of absolute links are allowed for avatar in MyBB).

EDIT: actually, checking $mybb->user['avatartype'] should be even easier. Its value is upload for uploaded ones.
Reply
#5
Solved: 7 Years, 2 Months, 3 Weeks ago
Thanks.

Fixed it using template conditional and $mybb->user['avatartype'].
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)