public function can_change_payment() { // Allow if Membership is new/unsaved. if (empty($this->id)) { return true; } // Allow if no payment detail was entered yet (incomplete setup). if (empty($this->payment_type)) { return true; } // Allow if no members signed up yet. $members = MS_Model_Relationship::get_subscription_count(array('membership_id' => $this->id)); if (empty($members)) { return true; } // Otherwise payment details cannot be changed anymore. return false; }