Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Blog poster avatars


Reply


5 Posts   1271 Views

Avatar
MrMuddy

Community Member, 13 Posts

18 March 2011 at 12:29am

Hi All,

I've been doing a bit of searching around and can't seem to find what I'm after (so please feel free to post a link to the right place !)

I've got the Blog module installed and running, with multiple contributors. They will only ever be Administrators or Content Authors on the site, so I'm not fussed about new member registrations or anything like that.

What I'm after is for Silverstripe to automatically fill in the author field when they post (like this thread : http://www.silverstripe.org/blog-module-forum/show/16216) but also for each of them to have an avatar which is displayed in the template next to their post.

Now... I'm guessing I probably need to extend the Member class ? But before I go chopping around, I'd like a bit of reassurance that I'm doing the right things.

Can anyone provide a couple of pointers as to how to add per-user avatars in the CMS ?

Many thanks

Avatar
MrMuddy

Community Member, 13 Posts

18 March 2011 at 12:51am

OK... in the course of working through this I found a thread here :

http://www.silverstripe.org/archive/show/4317

Which looks like it gets the avatars attached to the members... so that's a big start.

Just need to get them in the template and I'll be there. (and make sure the right user is being assigned to the post)

Avatar
Capt. Morgan

Community Member, 30 Posts

22 March 2011 at 3:56am

Hi MrMuddy
I just did smth similar few days ago on http://www.moviedeek.com/. The template you need to override is PageComment_instance I think. In my case I just included the picture provided by WillR's facebook connect module, but it seems like you already decorated your Member class with a profile image.

good luck

Avatar
MrMuddy

Community Member, 13 Posts

22 March 2011 at 4:02am

Hello,

Thanks for the post. I got round it in the end by adding a function in the BlogHolder controller. With the member class suitably decorated as per the above thread), this function performs a custom SQL query to look up using the ID of the blog post to get the poster name and their avatar (along with a couple of other bits of info I added).

I call it from the BlogSummary template include, so it works at BlogHolder and BlogTree level.

I don't know if it's the "right" solution... but it seems to work OK !

Cheers

Tim

Avatar
Capt. Morgan

Community Member, 30 Posts

25 March 2011 at 9:08pm

I had misunderstod you. For some reason I thought you were talking about comments, not bloggers.
Good to hear you got it solved :)