Support Forum

Avatars display question

CF Conrad_Farlow
Conrad_Farlow
Member

Not sure if I should ask customisation questions for themes here at this stage so feel free to tell me to go away for a while if you are too busy but……..

I would like the avatar display size at the top of the Group view, forum and topic view and topic view to be different from that used at the side of the posts. How would I best go about this?

My thinking is that I don’t want to use up much real estate at the top of pages but I like decent sized avatars for the actual posts in topic view.

Conrad

21 Answers

New Answer

LH Lee H
Lee H
Member

Check out function sp_UserAvatar() in 

wp-content/plugins/simple-press/forum/content/sp-common-view-functions.php

This function accepts arguments, including the size. If no size is specified, the function will use the size you set in your admin backend.

LH Lee H
Lee H
Member

For example:

The avatar located in the top left code is in your templates spHead.php.

    # Start the 'userInfo' section
    # ----------------------------------------------------------------------
    sp_SectionStart('tagClass=spPlainSection', 'userInfo');
        sp_UserAvatar('tagClass=spImg spLeft');

We then alter it to add the size argument (I set it at 32), or will default to the options size.

    # Start the 'userInfo' section
    # ----------------------------------------------------------------------
    sp_SectionStart('tagClass=spPlainSection', 'userInfo');
        sp_UserAvatar('tagClass=spImg&size=32 spLeft');

If you refer to the actual function we are calling that I referenced in the last post, you can see what arguments it will accept, and the defaults it will choose if you don’t specify anything.

CF Conrad_Farlow
Conrad_Farlow
Member

Great stuff Lee, is this stuff documented anywhere or did you just find it by poking around? I’ve set it to 50 in spHead for my theme and I reckon that its perfect now.

Conrad

LH Lee H
Lee H
Member

No docs yet Smile

But, in my case it’s the best way for me to learn. Keeps me from reading everything, and absorbing little. If I actually have to figure out and understand, it sticks.

YS Yellow Swordfish
Yellow Swordfish
Member

This WILL be documented. Not the most fun part but absolutely necessary..

NI nirok
nirok
Member

This is an awesome forum software, just moved from phpbb. I’m looking at the avatars at the moment, are there any automatic resizing options yet to fit the different areas on the forum? If not i’m wondering if timthumb would work well here? I just played around with the avatar uploading and noticed that the user needs to get the picture the right size which is an annoying issue we had with phpbb untill I installed a mod which automatically resized and never rejected a users image… 

YS Yellow Swordfish
Yellow Swordfish
Member

Not yet no. This might make good plugin material for V5 however and shouldn’t be too hard to implement.

NI nirok
nirok
Member

I’ve install V5 and looking at adding it as a custom function. Is there a function which calls the uploaded avatars that I could use to echo the uploaded image file directory? I’m looking through the sp-common-view-functions.php file at the moment

NI nirok
nirok
Member

Well I added it to the main functions but it would be obviously better if I added it as a custom function due to updating etc etc, but it’s quite a cool small feature especially when you want to do a bit of template customisation. I’ve made it so you can just add your width and height to the function to determine the size you want the image in the different parts of the template. The other way of improving the upload image might be to use a jquery image upload and resize plugin… but that might be to complex, I think Timthumbs a good quick solution. But still would be cool to make this into a custom timthumb function

NI nirok
nirok
Member

Thought I’d show a quick screen shot of the tim thumb script i’ve added:

 

MP Mr Papa
Mr Papa
Member

so you modified an existing function in core?  you should hook into the api we make available…  assume you are referring to sp_UserAvatar();??

you can filter the image size if you want, but that will just change the size and not actually resize the image which I think you are doing…

and you can always filter the $avatarData array which contains the image…

but not sure I can add more currently without knowing what you actually did…

NI nirok
nirok
Member

Yes you are right I did edit the core, mainly to see how it would work… I know this isn’t the correct way of doing this since there is upgrade issues etc etc. I’m just working on a function now in the custom function area of my template to see if I can get it working that way. Essentially all I want to do is call avatars that are displayed through this function so I can adjust them on my template size wise, since they are all the same size at the moment. I’ll look at the avatardata array

 

Thanks

MP Mr Papa
Mr Papa
Member

feel free to ask questions as you proceed… glad to help since we dont have our full api docs ready for 5.0 yet…

NI nirok
nirok
Member

I pasted the code that i edited in the core file and pasted it in my new custom function, just changed the function name…