Beispiel #1
0
/**
 * Add title button for adding more people to a chat.
 *
 * All members of the chat are allowed to add people.
 *
 * @todo Is it possible to use userpicker through lightbox?
 *
 * @param obj $entity ElggChat object
 */
function chat_register_addusers_button($entity)
{
    if (elgg_is_logged_in()) {
        $user = elgg_get_logged_in_user_entity();
        if ($user && $entity->isMember()) {
            $guid = $entity->getGUID();
            elgg_register_menu_item('title', array('name' => 'chat_members', 'href' => "chat/members/{$guid}", 'text' => elgg_echo('chat:members:add'), 'link_class' => 'elgg-button elgg-button-action'));
        }
        /*
        elgg_load_js('lightbox');
        elgg_load_css('lightbox');
        
        elgg_load_js('elgg.userpicker');
        */
    }
}
Beispiel #2
0
 /**
  * Increase the number of unread messages for an user.
  *
  * @param obj $user
  * @return boolean
  */
 public function increaseUnreadMessageCount($user)
 {
     // Increase the number of unread messages under the chat
     $options = array('annotation_owner_guids' => $user->getGUID());
     $num_unread = $this->getUnreadMessagesCount($options, true);
     if ($num_unread) {
         // Increase the value of annotation
         $num_unread->value = $num_unread->value + 1;
         return $num_unread->save();
     } else {
         // Add new annotation
         return $this->annotate('unread_messages', 1, ACCESS_LOGGED_IN, $user->getGUID());
     }
 }