I think you can just replace these 2 lines with
`user_id = c.userobj.id`

this is the current user and saves the db call