Make past payments query in front end file conditional

The data produced by this query is not needed when you're viewing another client's hash and the system is set to hide payments, so why make the query at all?