title: Magento - Dynamically disable payment method based on criteria
body: <p>I have an extremely simple module that allows a customer to "Purchase On Account". The module doesn't do anything special really (it was simply modified from a Cash On Delivery module.) </p>
  
  <p>The problem is I only want to offer this payment method to logged in customers.</p>
  
  <p>So far my module looks like this:</p>
  
  <pre><code>BuyOnAccount/
      etc/
          config.xml
          system.xml
      Model/
          PaymentMethod.php
  </code></pre>
  
  <p>The content of PaymentMethod.php is:</p>
  
  <pre><code>class MyCompany_BuyOnAccount_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
  {
      protected $_code  = 'buyonaccount';
      protected $_isInitializeNeeded      = true;
      protected $_canUseInternal          = false;
      protected $_canUseForMultishipping  = false;
  }
  </code></pre>
  
  <p>The config and system xml files contain the usual sort of thing (please let me know if you would like to see the code and i'll edit)</p>
  
  <p>So bascically I need to disable the module if the user is not logged in (but obviously only for the current customer session!)</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks</p>