Browse Source

! And now we add in a new permission to make life easier elsewhere that won't show up in the permissions reports: is_not_guest. Like it says, it's a permission that only applies if the user isn't a guest and while normally there are measures for this (like is_not_guest()) it means we can keep the profile code as it rather than trying to refactor it or whatever. There's also similar phantom permissions for mods that expect the old permissions.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 years ago
parent
commit
7c2a3cf19d
1 changed files with 8 additions and 0 deletions
  1. 8 0
      Sources/Load.php

+ 8 - 0
Sources/Load.php

@@ -879,6 +879,14 @@ function loadPermissions()
 		}
 		else
 			$user_info['mod_cache'] = $_SESSION['mc'];
+
+		// This is a useful phantom permission added to the current user, and only the current user while they are logged in.
+		// For example this drastically simplifies certain changes to the profile area.
+		$user_info['permissions'][] = 'is_not_guest';
+		// And now some backwards compatibility stuff for mods and whatnot that aren't expecting the new permissions.
+		$user_info['permissions'][] = 'profile_view_own';
+		if (in_array('profile_view', $user_info['permissions']))
+			$user_info['permissions'][] = 'profile_view_any';
 	}
 }