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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Forum Module /

Discuss the Forum Module.

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

Forum Trunk API Changes


Go to End


19 Posts   7908 Views

Avatar
mattclegg

Community Member, 56 Posts

14 May 2010 at 1:16pm

Edited: 15/05/2010 12:32am

Hey Kalileo drye,

I was having the same trouble with subnested urls but wrote this fix;

	public function getForumThread() {
		if(preg_match('/(?!(show)(\/).*)([0-9].*)(?!(?).*)/', $_SERVER['REQUEST_URI'], $id))
			return DataObject::get_by_id("ForumThread", $id[0]);
		else
			return false;
	}

Im sure there's probably a cleaner way of doing it using SS functions -but it seems to work ok as a fix for 2.4

Avatar
Kalileo

Community Member, 127 Posts

15 May 2010 at 12:27am

Hi Matt, it wasn't me who has seen this problem, it was "drye" - but thanks anyway!

Avatar
drye

Community Member, 49 Posts

15 May 2010 at 12:31am

mattclegg,

Thank you for the fix. I've not tried it yet, but will very soon. I wonder if Will is working on a fix as well or if he would be willing to incorporate this fix into the code base.

Thanks again!

Go to Top