/** * Given a user entity (or a UUID), removes them from this user's followed list. * Remember to save this user entity. * * @param \Idno\Entities\User|string $user * @return bool */ function removeFollowing($user) { if ($user instanceof \Idno\Entities\User) { $users = $this->getFollowingUUIDs(); unset($users[$user->getUUID()]); $this->following = $users; $acl = \Idno\Entities\AccessGroup::getOne(array('owner' => $this->getUUID(), 'access_group_type' => 'FOLLOWING')); if (!empty($acl)) { $acl->removeMember($user->getUUID()); $acl->save(); } \Idno\Core\Idno::site()->triggerEvent('unfollow', array('user' => $this, 'following' => $user)); return true; } return false; }
<a class="btn access dropdown-toggle" data-toggle="dropdown" href="#" id="access-button"> <span id="acl-text"><i class="fa fa-globe"> </i> Public</span> <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="#" data-acl="PUBLIC" class="acl-option"><i class="fa fa-globe"> </i> Public</a> </li> <li><a href="#" data-acl="SITE" class="acl-option"><i class="fa fa-lock"> </i> Members only</a></li> <li><a href="#" data-acl="<?php echo \Idno\Core\site()->session()->currentUserUUID(); ?> " class="acl-option"><i class="fa fa-lock"></i> Private</a></li> <?php $acls = \Idno\Entities\AccessGroup::get(array('owner' => \Idno\Core\site()->session()->currentUserUUID())); if (!empty($acls)) { foreach ($acls as $acl) { $icon = 'fa fa-cog'; if ($acl->access_group_type == 'FOLLOWING') { $icon = 'fa fa-users'; } ?> <li><a href="#" data-acl="<?php echo $acl->getUUID(); ?> " class="acl-option"><i class="<?php echo $icon; ?> "> </i> <?php