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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Forum Module /

Discuss the Forum Module.

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

[solved] Latest posts custom function

Go to End

3 Posts   1409 Views


Community Member, 148 Posts

13 August 2009 at 12:35pm

Edited: 14/08/2009 7:09am

Hi, I want to include the latest forum posts on a page outside the forum.

this gets me the actual post data I need (title, content,create date):

public function LatestIdeas() {

  	return DataObject::get("Post","","ID desc","",5);


But I also want to include the Author name along with this....can anyone help with this??


Forum Moderator, 5523 Posts

13 August 2009 at 5:59pm

A post has a relationship with a member namely a author ID. So you can do $Author in the template gets you the Author object then you can do things like $Author.Nickname to get their nickname


Community Member, 148 Posts

14 August 2009 at 7:10am

Edited: 14/08/2009 7:10am

Thanks will.
It all seems so straightforward when someone else spells it out for you....:)