2006-10-28 07:43:08
BlogJournal Access for Admins
Not sure if i've missed something but i cant find a way to enable any administrator access to the blogs. Under the manage section of my site there is no link for blogs?
With this in mind i've gone to try and find a way to make the blogs list out for the course admins so that they can read the students entries. My SQL abilities aren't that great i'm afraid - i was able to remove the restrictions of only showing it if the members id matches the session and make it so that my admin login can see all course blogs. But i was wondering if someone could help me rewrite or make another if/else option that would only display the blogs related to the course your logged into while an admin.
in blogs/index.php i changed line 19'ish to be the following to allow me as member 1 to see all blogs listed when i went to the blogs index page.
[php]if ($_SESSION[member_id] == 1) {
$sql = "SELECT G.group_id, G.title, G.modules FROM ".TABLE_PREFIX."groups G INNER JOIN ".TABLE_PREFIX."groups_members T USING (group_id) ORDER BY G.title";
} else {
$sql = "SELECT G.group_id, G.title, G.modules FROM ".TABLE_PREFIX."groups G INNER JOIN ".TABLE_PREFIX."groups_members T USING (group_id) WHERE T.member_id=$_SESSION[member_id] ORDER BY G.title";
}[/php]
I'm assuming the statement has to be rewritten to check the Group_types table to check which course it belongs to and then only display all if the member_id is a admin/teacher for that courses.
I'm not sure why there hasn't been any admin access to the blogs previously - or if there is how you go about giving the teachers access to all the blogs, but any help would be greatly appreciated.
Cheers,
David