If teacher logged in {

If teacher logged in {

by Stephen Keep -
Number of replies: 4
Im sure this is simple but what is the code to determine if a teacher is logged in? I cant find any info on how to do it?

Thanks for your help.

Skeep
Average of ratings: -
In reply to Stephen Keep

Re: If teacher logged in {

by Mike Worth -
Where are you trying to determine if it is a teacher?

The usual way is to use has_capability() to check for a specific capabilty related to why you are checking

Mike
In reply to Mike Worth

Re: If teacher logged in {

by Stephen Keep -
Just want to check it on the front page and display some teacher specific links. Is this possible?
In reply to Stephen Keep

Re: If teacher logged in {

by Mike Worth -
Yes, sounds v.similar to a block I wrote.

You will need to assign system roles for staff (if you assign them as global teachers they will be listed as a teacher for every course) with at least 1 capability that students won't have. Then you can use has_capability on that capabilty

Mike
In reply to Mike Worth

Re: If teacher logged in {

by Ger Tielemans -
If your policy is that students never become teachers at your site - like we do - you could use:
ifisteacherinanycourse() {show what you wish;}

another approach is giving teachers and students different email-tails and then filter on that item. We use this:

..@mail.hetstedelijk.nl = student
..@stedelijk.nl = teacher
(we guard emailadresses with ldap)

 
$string = 'a_student@mail.hetstedelijk.nl';

if (eregi('@mail.hetstedelijk.nl', $string)) {
echo "a student!";
}