Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
I need to reference external Avatar source, please help?
My main website has profile photos for every forum user already so I want to use those for avatar images. The path of these profile pics are simple too: www.website.com/avatar/vanillaUsername.jpg
I've been looking at applications/vanilla/views/discussion/discussion.php which I assume is the best place to make the modification.
Please can you advise how I can change the Vanilla avatar path to use the new path above?
0
Comments
Look at other avatar plugins to see how you could do that . But don't edit core files .
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
You want to make a simple plugin that overwrites the global
userPhotoUrl()
function. Maybe something like this:Thanks for helping here. I dumped your code at the end of class.testingground.plugin.php but it didn't change anything.
Is there a way without a plugin like using bootstrap.before.php?
@w1ckedsick
You can't just add that code to a file. You need to make it part of a plugin
See here: http://docs.vanillaforums.com/developer/plugins/quickstart/
Hello @whu606
That's what I did - TestingGround was a plugin template I had used previously for another bit of custom code and it worked well. So I went with the same thing here but it didn't result in any change. The particular file that has the code is class.testingground.plugin.php and you can see it at the bottom:
You can indeed add it to the bootstrap.before.php file, but I would also recomment to attach it below a plugins class. That way you can easily enable/disable it.
You would need a custom
userPhoto
function. This is basically the same code as you will find in the functions.render.php file, I only made changes around line 38 for some external url. You would have to modify that:That's awesome, thanks. I got it almost working but the img src is looking inside Vanilla's avatar location when I need it looking closer to root (website.com/avatars/). I think that's because of line 51. Can you help me fix that bit?
I found a way around that which worked... here's the slightly modified code that is working perfectly now:
Thanks everyone