get_person_by

Description

This function allows you to return person data by field and value. The unique fields to use are below.

  • personID – Unique person’s ID
  • altID – Alternate ID
  • uname – Person’s username
  • email – Person’s email address

Usage

<?php $person = get_person_by($field, $value); ?>

Parameters

$field (string) (required) Unique person fields from the person table (pesonID, altID, uname, email).

$value (string) (required) The value of the requested $field.

Return Values

(mixed) A person object or false if user isn’t found or field does not exist.

Example

$person = get_person_by('email', 'mousem@eb.edu');
echo "Mickey's last name is " . $person->lname;

var_dump of $person = get_person_by(‘personID’, ’12’);

Liten\Orm::__set_state(array(
   'pdo' => 
  PDO::__set_state(array(
  )),
   'table_name' => 'person',
   'table_token' => 'person',
   'table_alias' => 'person',
   'pdo_stmt' => NULL,
   'is_single' => true,
   'select_fields' => 
  array (
  ),
   'join_sources' => 
  array (
  ),
   'limit' => NULL,
   'offset' => NULL,
   'order_by' => 
  array (
  ),
   'group_by' => 
  array (
  ),
   'where_parameters' => 
  array (
  ),
   'where_conditions' => 
  array (
  ),
   'and_or_operator' => ' AND ',
   'having' => 
  array (
  ),
   'wrap_open' => false,
   'last_wrap_position' => 0,
   'is_fluent_query' => true,
   'pdo_executed' => true,
   '_data' => 
  array (
    'personID' => '12',
    'altID' => NULL,
    'uname' => 'mousem',
    'prefix' => 'Mr',
    'personType' => 'STU',
    'fname' => 'Mickey',
    'lname' => 'Mouse',
    'mname' => '',
    'email' => 'mousem@eb.edu',
    'ssn' => '19810705',
    'dob' => '0000-00-00',
    'veteran' => '0',
    'ethnicity' => 'Other',
    'gender' => 'M',
    'emergency_contact' => '',
    'emergency_contact_phone' => '',
    'photo' => NULL,
    'password' => '$2a$08$xDA1XVueCIlk1l0beaQrHuGqBZn8T5P6aQhVX.sKQtPsvyBD7Hlj.',
    'status' => 'A',
    'auth_token' => 'NULL',
    'approvedDate' => '2014-03-01 00:00:00',
    'approvedBy' => '1',
    'LastLogin' => '2015-09-04 01:42:35',
    'LastUpdate' => '2015-08-12 00:11:40',
    'addressID' => '0013',
    'address1' => '12 Disney Avenue',
    'address2' => '',
    'city' => 'Lake Buena Vista',
    'state' => 'FL',
    'zip' => '32830',
    'country' => 'US',
    'addressType' => 'P',
    'startDate' => '2014-03-01',
    'endDate' => '0000-00-00',
    'addressStatus' => 'C',
    'phone1' => '',
    'phone2' => '',
    'ext1' => '',
    'ext2' => '',
    'phoneType1' => '',
    'phoneType2' => '',
    'email1' => 'mousem@eb.edu',
    'email2' => '',
    'addDate' => '2014-03-02 00:00:00',
    'addedBy' => '1',
    'id' => NULL,
    'staffID' => NULL,
    'schoolCode' => NULL,
    'buildingCode' => NULL,
    'officeCode' => NULL,
    'office_phone' => NULL,
    'deptCode' => NULL,
    'ID' => '4',
    'stuID' => '12',
    'tags' => 'Freshman',
  ),
   'debug_sql_query' => false,
   'sql_query' => 'SELECT 
	 person.*, 
	address.*, 
	staff.*, 
	student.* 
 FROM 
	 person AS person 
  LEFT JOIN
	 address 
		ON (person.personID = address.personID)
 LEFT JOIN
	 staff 
		ON (person.personID = staff.staffID)
 LEFT JOIN
	 student 
		ON (person.personID = student.stuID)
 
 WHERE 
	 person.personID = ? 
 LIMIT 
	 1 
',
   'sql_parameters' => 
  array (
    0 => '12',
  ),
   '_dirty_fields' => 
  array (
  ),
   'reference_keys' => 
  array (
    'id' => 
    array (
      0 => NULL,
    ),
    'personID' => 
    array (
      0 => '12',
    ),
    'altID' => 
    array (
      0 => NULL,
    ),
    'uname' => 
    array (
      0 => 'mousem',
    ),
    'prefix' => 
    array (
      0 => 'Mr',
    ),
    'personType' => 
    array (
      0 => 'STU',
    ),
    'fname' => 
    array (
      0 => 'Mickey',
    ),
    'lname' => 
    array (
      0 => 'Mouse',
    ),
    'mname' => 
    array (
      0 => '',
    ),
    'email' => 
    array (
      0 => 'mousem@eb.edu',
    ),
    'ssn' => 
    array (
      0 => '19810705',
    ),
    'dob' => 
    array (
      0 => '0000-00-00',
    ),
    'veteran' => 
    array (
      0 => '0',
    ),
    'ethnicity' => 
    array (
      0 => 'Other',
    ),
    'gender' => 
    array (
      0 => 'M',
    ),
    'emergency_contact' => 
    array (
      0 => '',
    ),
    'emergency_contact_phone' => 
    array (
      0 => '',
    ),
    'photo' => 
    array (
      0 => NULL,
    ),
    'password' => 
    array (
      0 => '$2a$08$xDA1XVueCIlk1l0beaQrHuGqBZn8T5P6aQhVX.sKQtPsvyBD7Hlj.',
    ),
    'status' => 
    array (
      0 => 'A',
    ),
    'auth_token' => 
    array (
      0 => 'NULL',
    ),
    'approvedDate' => 
    array (
      0 => '2014-03-01 00:00:00',
    ),
    'approvedBy' => 
    array (
      0 => '1',
    ),
    'LastLogin' => 
    array (
      0 => '2015-09-04 01:42:35',
    ),
    'LastUpdate' => 
    array (
      0 => '2015-08-12 00:11:40',
    ),
    'addressID' => 
    array (
      0 => '0013',
    ),
    'address1' => 
    array (
      0 => '12 Disney Avenue',
    ),
    'address2' => 
    array (
      0 => '',
    ),
    'city' => 
    array (
      0 => 'Lake Buena Vista',
    ),
    'state' => 
    array (
      0 => 'FL',
    ),
    'zip' => 
    array (
      0 => '32830',
    ),
    'country' => 
    array (
      0 => 'US',
    ),
    'addressType' => 
    array (
      0 => 'P',
    ),
    'startDate' => 
    array (
      0 => '2014-03-01',
    ),
    'endDate' => 
    array (
      0 => '0000-00-00',
    ),
    'addressStatus' => 
    array (
      0 => 'C',
    ),
    'phone1' => 
    array (
      0 => '',
    ),
    'phone2' => 
    array (
      0 => '',
    ),
    'ext1' => 
    array (
      0 => '',
    ),
    'ext2' => 
    array (
      0 => '',
    ),
    'phoneType1' => 
    array (
      0 => '',
    ),
    'phoneType2' => 
    array (
      0 => '',
    ),
    'email1' => 
    array (
      0 => 'mousem@eb.edu',
    ),
    'email2' => 
    array (
      0 => '',
    ),
    'addDate' => 
    array (
      0 => '2014-03-02 00:00:00',
    ),
    'addedBy' => 
    array (
      0 => '1',
    ),
    'staffID' => 
    array (
      0 => NULL,
    ),
    'schoolCode' => 
    array (
      0 => NULL,
    ),
    'buildingCode' => 
    array (
      0 => NULL,
    ),
    'officeCode' => 
    array (
      0 => NULL,
    ),
    'office_phone' => 
    array (
      0 => NULL,
    ),
    'deptCode' => 
    array (
      0 => NULL,
    ),
    'ID' => 
    array (
      0 => '4',
    ),
    'stuID' => 
    array (
      0 => '12',
    ),
    'tags' => 
    array (
      0 => 'Freshman',
    ),
  ),
   'join_on' => false,
   'table_structure' => 
  array (
    'primaryKeyname' => 'id',
    'foreignKeyname' => '%s',
  ),
))

Change Log

Since 6.2.0

Source File

get_person_by() is located in app/functions/auth-function.php.