Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing the way group avatars are fetched


  • Aditya Singh
    Participant

    @stuffsone

    I want to put the avatars for groups in a specific folder with their filename the same as the id of that particular group. [the motive is to skip the avatar uploading step while creation of group, and later on add the avatars just by putting in some image in that particular foldr with the same filename as the id/some-field of the group we want it to be attached to.]
    Any idea how to do it?

    [In case I dint make myself clear — lets say i created groups 1-20 without uploading the avatar image for any of them….now later on i just put 20 images having their names as group_{id_of_group}.png….and they automatically get fetched as the group avatars]

Viewing 5 replies - 1 through 5 (of 5 total)

  • r-a-y
    Keymaster

    @r-a-y

    Use a filter. Check out the filters in /bp-core/bp-core-avatars.php.


    Aditya Singh
    Participant

    @stuffsone

    Hi @r-a-y
    Its again you to my rescue! :)
    Thanks. Yeah I had looked up on Bp_core_fetch_avatar function in bp-core-avatars.php file, and that it has a parameter ‘object’ => with the comment that we can use it if we are using filter.

    Its just that I could not figure out how to do it. Tried few things unsuccessfully.

    Would it be possible for you to guide me here. Lets say I am uploading my avatars in the standard file-size in some folder in the format “grpavtr_(group_id).png”, then how do I do it…. Have been stuck with this problem (and one more) for a week now… :(
    I am sure I would go out and have a beer once I’m done with this…. :D


    Aditya Singh
    Participant

    @stuffsone

    resolved….
    i used a different approach but nevertheless, the problem is solved
    thanks anyway @r-a-y :) you’ve always been helpful


    Aditya Singh
    Participant

    @stuffsone

    oopsss…now a different issue…
    @r-a-y
    I made changes in bp-core-avatars to fetch avatars from uploads/group-avatars/[group-id] folder
    Removed the height property so that the images will be fetched and displayed as per their width and the height will be adjusted accordingly….the problem is that this is working fine for some groups, and not working at all for some others….
    the ones where it is working, the path of the image (when u see copy image url) — /uploads/group-avatars/[group-id]/[group-id].jpg

    the ones where it is not working, the path stops at —> /uploads/group-avatars/[group-id]

    Here is the code to the modified br-core-avatars.php I am using….
    http://pastebin.com/jvDuH362


    Aditya Singh
    Participant

    @stuffsone

    resolved…finally…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing the way group avatars are fetched’ is closed to new replies.
Skip to toolbar