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.

Forum Module

Discuss the Forum Module.

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

[solved] Latest posts custom function


3 Posts   1003 Views


13 August 2009 at 12:35pm (Last edited: 14 August 2009 7:09am), Community Member, 144 Posts

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??


13 August 2009 at 5:59pm Forum Moderator, 5511 Posts

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


14 August 2009 at 7:10am (Last edited: 14 August 2009 7:10am), Community Member, 144 Posts

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