PHP User::$username Examples

PHP User::$username - 5 examples found. These are the top rated real world PHP examples of User::$username extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 public function __construct(User $user)
 {
     // store the parent user object
     $this->user = $user;
     // this should rather be coming from the user object
     $this->kirby = kirby::instance();
     // try to find the avatar
     if ($file = f::resolve($this->kirby->roots()->avatars() . DS . $user->username(), ['jpg', 'jpeg', 'gif', 'png'])) {
         $filename = f::filename($file);
     } else {
         $filename = $user->username() . '.jpg';
         $file = $this->kirby->roots()->avatars() . DS . $filename;
     }
     parent::__construct($file, $this->kirby->urls()->avatars() . '/' . $filename);
 }
Example #2
0
 public function getWritterUsername()
 {
     return $this->writter->username();
 }
	// XXX: this could do with some filtering.
	$thumb = "<a href='".Link::upload($avatar)."' target='_blank'><img src='" . $avatar->thumbURL() . "' ".(is_array($info) ? $info[3] : "")." border='0' /></a>";
}

$referer = $user->referred_by();
$refer = "";

if($referer) {
	if($referer->location()) {
		$refer = $user->username()." was invited by <a href='javascript:maxxerMap.posseClick(".$referer->id().");'>"
		         .$referer->username()."</a>";
	} else {
		$refer = $user->username()." was invited by ".$referer->username();
	}
}

$possearr = $user->posse();
if(count($possearr) == 0) {
	$posse = "";
	$overflow = "";
} else {
	$posse = "<p style='line-height: 10px; margin: 4px 0px 3px 0px;'><a style='text-decoration: none;' href='".Link::content("posse")."&userid=".$user->id()."'>".$user->username()." has a posse</a>";
	
	$posse_markers = 0;
	$posse_list = "";
	foreach($possearr as $posser) {
		if($posser->location()) {
			$posse_markers++;
			$posse_list .= "<li><a href='javascript:maxxerMap.posseClick(".$posser->id().");'>".$posser->username()."</a></li>";
		}
	}
Example #4
0
 /**
  * Test if a given user has capability to perform a certain action.
  *
  * @param   User     $user
  * @param   string   $action
  * @return  boolean
  */
 public function userCan($user, $action)
 {
     // Ensure a valid user object is given
     if (!$user instanceof User) {
         return false;
     }
     // Test for authorship
     $isAuthor = $this->username() === $user->username();
     if ($isAuthor && in_array($action, array('edit', 'delete'))) {
         return true;
     }
     // Test if the user has the required role
     $caps = plugin('comments')->config()->get('capabilities');
     $roles = explode('|', a::get($caps, $action));
     return in_array('all', $roles) || in_array($user->role(), $roles);
 }
Example #5
0
 private function existsUser(User $user)
 {
     $sql = "SELECT username FROM users WHERE username = :username";
     $query = $this->session->prepare($sql);
     $query->bindParam(':username', $user->username());
     $query->execute();
     return $query->rowCount() > 0;
 }