Skip to content

Instantly share code, notes, and snippets.

@chrisjdavis
Created October 23, 2012 20:48
Show Gist options
  • Save chrisjdavis/3941451 to your computer and use it in GitHub Desktop.
Save chrisjdavis/3941451 to your computer and use it in GitHub Desktop.
Quickchat Plural Class
<?php
/**
* Quickchats Class
*
*/
class Quickchats extends Posts
{
public static function get($paramarray = array()) {
$defaults = array(
'content_type' => 'quickchat',
'fetch_class' => 'Quickchat',
);
$paramarray = array_merge($defaults, Utils::get_params($paramarray));
return Posts::get( $paramarray );
}
public static function active() {
$chats = array();
$user = User::identify();
foreach( Quickchats::get(array('sender_id' => $user->id)) as $yours ) {
$chats[] = $yours;
}
foreach( Quickchats::get(array('receiver_id' => $user->id)) as $theirs ) {
$chats[] = $theirs;
}
return $chats;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment