Hi,
this is tricking me for 2 hours now. I can´t find any solution and I´m feeling like an idiot.
For a few weeks I´m tweeking the PrivatMessaging-Module. To send a message, you choose a nickname from a dropdown menu:
//Nicknames of all members is passed into an array
$members = DataObject::get("Member", "", "Nickname");
$allMembers = array();
foreach($members as $member) {
$allMembers[$member->ID] = htmlentities($member->Nickname);
}
$me = Member::currentUser();
return new Form($this, "PostMessageForm", new FieldSet(
new ReadonlyField("From", _t('PrivateMessagePage.FROM', 'From'), "$me->Nickname"),
new DropdownField("ToID", _t('PrivateMessagePage.CHOOSERECEIVER', 'Choose receiver:'), $allMembers),
new TextField("Subject", _t('PrivateMessagePage.SUBJECT', 'Subject')),
new TextareaField("Body", _t('PrivateMessagePage.TEXT', 'Text'))
The thing is, I want only members from the "forum members" group to appear in that menu. Members and groups have a many many relation. For that reason the group isn´t a class property of a member. The relation between members an groups is saved in an own database table. This means that I can´t use the method DataObject::get() to solve this issue.
I appreciate any help or hint.