SniderDK
Privileged
-
Joined
-
Last visited
Solutions
-
SniderDK's post in Can a php object have an object as one of it's properties? was marked as the answerHopfully some sample code is the better answer... i wrote this on the forum, and as such does not function.
<?php class UserRole { function add($key){} function allowedAccess($key){} } class UserProfile {} class User { function __construct($id == false){ if($id){ $this->role = new UserRole($id); $this->profile = new UserProfile($id); } } } $user = new User(1); // passing user id one $user->role->add('some text to pass to UserRole->add()'); if(!$user->role->allowedAccess('contentEditing')){ die('you dont have permission to do this'); }