/** * @param Alaa_FacebookConnect_Model_Resource_User_Collection $facebookUserCollection * @return $this */ public function massActivate($facebookUserCollection) { $data = array('is_active' => 1); $emails = $facebookUserCollection->getColumnValues('email'); $customerCollection = $this->getCustomerCollection()->addFieldToFilter('email', $emails); $this->massUpdate($facebookUserCollection, $data); if ($customerCollection->count() > 0) { $this->massUpdate($customerCollection, $data); } return $this; }
/** * @see Mage_Adminhtml_Controller_Action::preDispatch */ public function preDispatch() { parent::preDispatch(); $actions = array('massActivate', 'massDeactivate', 'massDelete'); $action = $this->getRequest()->getActionName(); if (in_array($action, $actions)) { if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); $users = isset($post['facebook_user']) ? $post['facebook_user'] : array(); if (!is_array($users) || empty($users)) { $this->getSession()->addError('There was a problem updating users.'); $this->_redirect('*/*/'); } $this->facebookCollection = $this->getFacebookUserCollection()->addFieldToFilter('entity_id', $users); $this->collectionCount = $this->facebookCollection->count(); } } }