1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Setting profile image to URL

Discussion in 'XenForo Development Discussions' started by leperwdup, Nov 13, 2015.

Tags:
  1. leperwdup

    leperwdup New Member

    Hi, I would like to use a URL pointing to images I have hosted on Amazon S3 for user's profile pictures. Users have control over their profile pics disabled - the only way to alter them will be from our main site where we have our own profile pic management.

    I'm using the RESTFUL API:
    https://xenforo.com/community/resources/xenapi-xenforo-php-rest-api.902/

    It would be nice to find out how to do this through that API, but worst case scenario I can hack at the API source to make my own entry point.

    What fields is the profile pic URL stored in the database? How can alter this data correctly in a non-hacky way?

    Thanks,
    Grigory
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    The URL isn't stored in the database. The files are stored directly on the file system and it is easy to infer what they are based on the user ID of a user, e.g. the user with user ID 1234 will have their avatar (if they have uploaded one) found at data/avatars/1234.jpg. If they haven't uploaded one then they will fall back to using either gravatar (if enabled) or a default avatar. If a user has uploaded an avatar, the date that it was uploaded is stored in the xf_user table in the avatar_date field.

    The code which controls all of this is in library/XenForo/Template/Helper/Core.php

    You will likely need to extend or overwrite the code here to achieve what you want.
     

Share This Page