Conditional Custom Page Content
Is the User Registered?
Simply use the iMEMBER definition in a PHP block.
if (iMEMBER) {
echo 'Registered';
} else {
echo 'Unregistered';
}
?>
Checking Group Membership by Id
Use the checkgroup(id) function.
if (checkgroup(2)) {
echo 'Member of group 2';
} else {
echo 'Not a member of group 2';
}
Checking Group Membership by Name
You need to workout the group's id first then use the checkgroup(id) function again.
$allgroups = getusergroups();
$myGroup = 0;
foreach ($allgroups as $g) {
if ($g[1]=='My Group') {
$myGroup=$g[0];
break;
}
}
if ($myGroup) { // group id was found
$myGroup=checkgroup($myGroup);
}
if (checkgroup($myGroup)) {
echo 'Member of "My Group"';
} else {
echo 'Not a member of "My Group"';
}
Note: this code assumes non-membership if the group's id wasn't found.
6 comments:
sepertinya tambah bahasan tentang cara ngoprek program program baru dan tips2 menarik seputar dunia komputer akan lebih meramaikan blog ini BRO
sukses yach atas app dari paman google :-P
MOHON BANTUANNYA TERUS UNTUK PERkembangan SITUS http://papuaxxx.wordpress.com
salam hangat dari anak papua
...please where can I buy a unicorn?
no es necesario probar todo seguidamente http://nuevascarreras.com/tag/cialis-online/ cialis 20 Credo che si sbaglia. Sono sicuro. Dobbiamo discutere. Scrivere a me in PM. cialis 20 htjhzfczvl [url=http://www.mister-wong.es/user/COMPRARCIALIS/comprar-viagra/]viagra cialis[/url]
Ihr Gedanke einfach ausgezeichnet viagra wirkung dauer viagra kaufen apotheke [url=http//t7-isis.org]viagra kaufen[/url]
Power corrupts and absolute power corrupts absolutely.
Post a Comment