When a person is unlawfully carried out of the State or is imprisoned in a secret place, any other person may appear for him in an action therefor in his name, who shall stipulate for the payment of costs as the court orders.