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 module in SilverStripe 3.1 beta


Go to End


3 Posts   3152 Views

Avatar
Josua

Community Member, 87 Posts

25 January 2013 at 12:00am

Hi all!

The forum module work with Silverstripe 3.1 beta?
It produces errors:
Fatal error: Class declarations may not be nested in C:\wamp\www\forum\code\ForumHolder.php on line 227 (SilverStripe 3.1 beta from github)
[User Error] Couldn't find field GroupID in any of Member's tables (SS 3.1 beta from github)

Somebody has tried it with SS 3.1?

Is there any fix?

Thanks,
Regards,
Jose A.

Avatar
Tony Air

Community Member, 13 Posts

4 February 2013 at 11:35pm

Edited: 05/02/2013 6:53am

The same issue
fast and dirty solution is to replace 2 functions in ForumHolder.php

CurrentlyOnline()

function CurrentlyOnline() {
		$groupIDs = array();
		$where = '';
		if($forumGroup = Group::get()->filter('Code', 'forum-members')->first()) {
			//$groupIDs[] = $forumGroup->ID;
			$where .= ' "GroupID" = \''.$forumGroup->ID.'\'';
		}

		if($adminGroup = Group::get()->filter('Code', array('administrators', 'Administrators'))->first()) {
			//$groupIDs[] = $adminGroup->ID;
			if($where!=='') {$where .= ' OR';}
			$where .= ' "GroupID" = \''.$adminGroup->ID.'\'';
		}

		return Member::get()
			->leftJoin('Group_Members', 'Member.ID = Group_Members.MemberID')
			->where($where)
			//->filter('GroupID', $groupIDs)
			->filter("LastViewed:GreaterThan", DB::getConn()->datetimeIntervalClause('NOW', '-15 MINUTE'))
			->sort('Member.FirstName, Member.Surname');
	}

and getLatestMembers()

function getLatestMembers($limit = 1) {
		$groupIDs = array();
		$where = '';
		if($forumGroup = Group::get()->filter('Code', 'forum-members')->first()) {
			//$groupIDs[] = $forumGroup->ID;
			$where .= ' "GroupID" = \''.$forumGroup->ID.'\'';
		}
		if($adminGroup = Group::get()->filter('Code', array('administrators','Administrators'))->first()) {		
			//$groupIDs[] = $adminGroup->ID;
			if($where!=='') {$where .= ' OR';}
			$where .= ' "GroupID" = \''.$adminGroup->ID.'\'';
		}
		
		$latestMembers = Member::get()
			->leftJoin('Group_Members', 'Member.ID = Group_Members.MemberID')
			->where($where)
			//->filter('GroupID', $groupIDs)
			->sort('Member.ID DESC')
			->limit($limit);

		return $latestMembers;
	}

Avatar
Platypus

Community Member, 43 Posts

24 April 2013 at 4:15am

Thanks for this hint, it helped me very much with SS 3.1 and the forums module.