Allow super user to view private profiles

Permalink
Ok so I used a mod by Flight643 to make profiles private but this also blocks the super user and administrators so I am wondering how would I allow them to still see the other profiles?

Here is the code pasted in:

<?php 
   $u = new User();
   $g = Group::getByName("Administrators"); 
   if($u->getUserID() == $profile->getUserID() || $u->inGroup($g) ) {
// All of the profile page as normal
?>


and then at the bottom of the page close out the if statement and scold them for snooping around :)

<?php } else { echo 'You do not have permission to access this page.'; } ?>


The original is here:http://www.concrete5.org/community/forums/customizing_c5/enable-pro...

Also please keep in mind I am a php newb :)

 
Mnkras replied on at Permalink Best Answer Reply
Mnkras
As long as the Super user is in the admin group and admin group is named "Administrators" then that code should work fine. (by default the super user is not in the Administrators group)

Mike
merge replied on at Permalink Reply
That was it! I can't believe I didn't think to try that. Thanks