1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Deleted usernames not showing into Conversations list

Discussion in 'Resolved Bug Reports' started by Floren, Sep 4, 2012.

  1. Floren

    Floren Well-Known Member

    This is a conversation between a deleted user and myself:


    The name is blank, it should show the original name like it does into conversation:

    Jake Bunce and CyclingTribe like this.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member


    Here is a quick patch to ensure that it uses the old name from the master even if the user record doesn't exist:


    Add the red code:

    	public function getConversationsForUser($userId, array $conditions = array(), array $fetchOptions = array())
    		$whereClause = $this->prepareConversationConditions($conditions, $fetchOptions);
    		$sqlClauses = $this->prepareConversationFetchOptions($fetchOptions);
    		$limitOptions = $this->prepareLimitFetchOptions($fetchOptions);
    		$sql = $this->limitQueryResults(
    				SELECT conversation_master.*,
    					conversation_master.username AS username,
    					conversation_recipient.recipient_state, conversation_recipient.last_read_date
    					' . $sqlClauses['selectFields'] . '
    				FROM xf_conversation_user AS conversation_user
    				INNER JOIN xf_conversation_master AS conversation_master ON
    					(conversation_user.conversation_id = conversation_master.conversation_id)
    				INNER JOIN xf_conversation_recipient AS conversation_recipient ON
    					(conversation_user.conversation_id = conversation_recipient.conversation_id
    					AND conversation_user.owner_user_id = conversation_recipient.user_id)
    				LEFT JOIN xf_user AS conversation_starter ON
    					(conversation_starter.user_id = conversation_master.user_id)
    					' . $sqlClauses['joinTables'] . '
    				WHERE conversation_user.owner_user_id = ?
    					AND ' . $whereClause . '
    				ORDER BY conversation_user.last_message_date DESC
    			', $limitOptions['limit'], $limitOptions['offset']
    		return $this->fetchAllKeyed($sql, 'conversation_id', $userId);
    You may want to apply the same change to the getConversationsForUserByIds() function.
  3. Mike

    Mike XenForo Developer Staff Member

    Fixed. :)
    Floren, Slavik and TBolley like this.

Share This Page