Count of read messages.
@param _userId  user id the count is wanted for
@return count of read messages
340764
public static int getReadCount(final Long _userId)
    {
        int ret = 0;
        if (MessageStatusHolder.CACHE.userID2Read.containsKey(_userId)) {
            ret = MessageStatusHolder.CACHE.userID2Read.get(_userId);
        }
        return ret;
    }
1294304
def count_of_user(user_id):
        '''
        
        '''
        return TabCollect.select(
            TabCollect, TabPost.uid.alias('post_uid'),
            TabPost.title.alias('post_title'),
            TabPost.view_count.alias('post_view_count')
        ).where(
            TabCollect.user_id == user_id
        ).join(
            TabPost, on=(TabCollect.post_id == TabPost.uid)
        ).count()
301020
private function _userId($userId)
    {
        if (!$userId) {
            $currentUser = Craft::$app->getUser()->getIdentity();
            if ($currentUser) {
                $userId = $currentUser->id;
            }
        }
        return (int)($userId);
    }
1015406
public static function mark_message_as_read($userid, $message, $timeread = null) {
        global $DB;

        if (is_null($timeread)) {
            $timeread = time();
        }

        $mua = new \stdClass();
        $mua->userid = $userid;
        $mua->messageid = $message->id;
        $mua->action = self::MESSAGE_ACTION_READ;
        $mua->timecreated = $timeread;
        $mua->id = $DB->insert_record('message_user_actions', $mua);

        // Get the context for the user who received the message.
        $context = \context_user::instance($userid, IGNORE_MISSING);
        // If the user no longer exists the context value will be false, in this case use the system context.
        if ($context === false) {
            $context = \context_system::instance();
        }

        // Trigger event for reading a message.
        $event = \core\event\message_viewed::create(array(
            'objectid' => $mua->id,
            'userid' => $userid, // Using the user who read the message as they are the ones performing the action.
            'context' => $context,
            'relateduserid' => $message->useridfrom,
            'other' => array(
                'messageid' => $message->id
            )
        ));
        $event->trigger();
    }
328363
public function SetUserBookmarkCount($UserID) {
		$Count = $this->UserBookmarkCount($UserID);
      Gdn::UserModel()->SetField($UserID, 'CountBookmarks', $Count);
		
		return $Count;
	}
1205597
public function isReadBy($userOrId)
    {
        if ($userOrId instanceof UserInterface) {
            $userOrId = $userOrId->getId();
        }
        
        return in_array($userOrId, $this->readBy);
    }
1187560
public GetQYUserInviteResponse invite(String userid){
        BeanUtil.requireNonNull(userid, "userid is null");
        GetQYUserInviteResponse response;
        String url = BASE_API_URL + "cgi-bin/invite/send?access_token=#";
        final Map<String, String> params = new HashMap<String, String>();
        params.put("userid", userid);
        BaseResponse r = executePost(url, JSONUtil.toJson(params));
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        response = JSONUtil.toBean(resultJson, GetQYUserInviteResponse.class);
        return response;
    }
479434
public function countUnread(User $user)
    {
        return $this->createQueryBuilder('m')
            ->select('count(m)')
            ->join('m.userMessages', 'um')
            ->where('m.user != :sender')
            ->orWhere('m.user IS NULL')
            ->andWhere('um.user = :user')
            ->andWhere('um.isRead = 0')
            ->andWhere('um.isRemoved = 0')
            ->setParameter(':user', $user)
            ->setParameter(':sender', $user)
            ->getQuery()
            ->getSingleScalarResult();
    }
171117
public static int getUnreadMessageCount() {
		try {
			if (ApptentiveInternal.isApptentiveRegistered()) {
				ConversationProxy conversationProxy = ApptentiveInternal.getInstance().getConversationProxy();
				return conversationProxy != null ? conversationProxy.getUnreadMessageCount() : 0;
			}
		} catch (Exception e) {
			ApptentiveLog.e(MESSAGES, e, "Exception while getting unread message count");
			logException(e);
		}
		return 0;
	}
1230532
public function GetCount($ViewingUserID, $Wheres = '') {
      if (is_array($Wheres))
         $this->SQL->Where($Wheres);
         
      return $this->SQL
         ->Select('uc.UserID', 'count', 'Count')
         ->From('UserConversation uc')
         ->Where('uc.UserID', $ViewingUserID)
         ->Get()
         ->Value('Count', 0);
   }
811714
public GetQYUserInfoResponse get(String userId){
        BeanUtil.requireNonNull(userId, "userId is null");
        GetQYUserInfoResponse response;
        String url = BASE_API_URL + "cgi-bin/user/get?access_token=#&userid=" + userId;
        BaseResponse r = executeGet(url);
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        response = JSONUtil.toBean(resultJson, GetQYUserInfoResponse.class);
        return response;
    }
100183
public function getReadIds(User $user)
    {
        return Discussion::leftJoin('discussion_user', 'discussion_user.discussion_id', '=', 'discussions.id')
            ->where('discussion_user.user_id', $user->id)
            ->whereColumn('last_read_post_number', '>=', 'last_post_number')
            ->pluck('id')
            ->all();
    }
709758
public Collection<Tag> getListUser(String userId) throws FlickrException {

        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("method", METHOD_GET_LIST_USER);

        parameters.put("user_id", userId);

        Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);
        if (response.isError()) {
            throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
        }

        Element whoElement = response.getPayload();

        List<Tag> tags = new ArrayList<Tag>();
        Element tagsElement = (Element) whoElement.getElementsByTagName("tags").item(0);
        NodeList tagElements = tagsElement.getElementsByTagName("tag");
        for (int i = 0; i < tagElements.getLength(); i++) {
            Element tagElement = (Element) tagElements.item(i);
            Tag tag = new Tag();
            tag.setValue(((Text) tagElement.getFirstChild()).getData());
            tags.add(tag);
        }
        return tags;
    }
639149
def inbox_count_for(user):
    
    return Message.objects.filter(recipient=user, read_at__isnull=True, recipient_deleted_at__isnull=True).count()
696208
public function getLastMessageFromOtherUser($uid, $thread_id) {
    $timestamp = $this->database->query(
      'SELECT MAX(pm.created) ' .
      'FROM {private_message_thread__private_messages} pmt ' .
      'JOIN {private_messages} pm ON pmt.private_messages_target_id = pm.id ' .
      'WHERE pmt.entity_id = :thread AND pm.owner <> :uid',
      [
        ':thread' => $thread_id,
        ':uid' => $uid,
      ]
    )->fetchCol();

    // Chop of the head.
    if (is_array($timestamp)) {
      $timestamp = ($timestamp[0] !== NULL) ? $timestamp[0] : 0;
    }

    return $timestamp;
  }
1071792
public List<String> getUserGroups(final int userID)
        throws WikiApiException
    {

        List<String> groups = new LinkedList<String>();

        try {
            if (userID < 1) {
                throw new IllegalArgumentException();
            }

            if (!tableExists("user_groups")) {
                throw new WikiInitializationException(
                        "User group assignment data is missing. Please download user_groups.sql for this Wikipedia from http://dumps.wikimedia.org and import the data into this database.");
            }

            PreparedStatement statement = null;
            ResultSet result = null;

            try {
                statement = connection.prepareStatement("SELECT ug_group "
                        + "FROM user_groups WHERE ug_user=?");
                statement.setInt(1, userID);
                result = statement.executeQuery();

                // Make the query
                if (result == null) {
                    throw new WikiPageNotFoundException("The user  with the ID " + userID
                            + " was not found.");
                }
                while (result.next()) {

                    groups.add(result.getString(1));

                }
            }
            finally {
                if (statement != null) {
                    statement.close();
                }
                if (result != null) {
                    result.close();
                }
            }

            return groups;

        }
        catch (WikiApiException e) {
            throw e;
        }
        catch (Exception e) {
            throw new WikiApiException(e);
        }
    }
480274
public function handleTrackCalculation($userId)
    {
        // Process any events
        $trackEngine = $this->getTrackEngine();

        // Places here instead of only in handle field update so it will run on new tracks too
        $this->assignTokensToRelations();

        if ($event = $trackEngine->getTrackCalculationEvent()) {
            return $event->processTrackCalculation($this, $userId);
        }

        return 0;
    }