Only when the parties explicitly authorize lawyers to collect compensation on their behalf and the court agrees that lawyers can collect compensation on their behalf.
Whether the court agrees is subjective. According to the law, the parties agree that lawyers do not need the consent of the court. However, in order to avoid risks or reduce unnecessary troubles, the court may not necessarily agree with the lawyer's opinion, and each court may agree or disagree and decide for itself.