I've put together a membership site for a small society and extended the member profile module to add in addtional fields and functionality to facilitate this. Members want to be able to contact other members of the site so I have a member list page only accessible to members. All members have been loaded into the database and to protect the details only those that have logged into their member profile should be shown on this listing. I figure the easiest way of doing this is to check 'NumVisit' in the database for a value of '0', if the condition is true then remove these members from the loop to only show members that have signed in.
However I've tried a number of different ways that I can think of to check for these conditions but it still continues to pull all the members from the database apart from admin - weird.
I only picked up SS a month ago so any help greatly appreciated!
This is the current attempt
class MemberList extends Page {
function pullMembers(){
$members = DataObject::get('Member');
foreach($members as $member){
$sqlQuery = new SQLQuery(
"SUM(NumVisit)",
"Member");
if('NumVisit' == '0'){
$members->remove($member);
break;
}
}
return $members;
}
}