$cmsBlock = Mage::getModel('cms/block')->getCollection()
->addStoreFilter($store->getId())
->addFieldToSelect('*')
->addFieldToFilter('identifier', $identifier)
->setPageSize(1)
->getFirstItem();
You need to use a collection to safely load cms blocks in Magento 1 (and 2 IIRC).
This is because Mage_Cms_Model_Resource_Block::_getLoadSelect does an is_active=1 check if you try and load it by store scope.
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
if ($object->getStoreId()) {
$stores = array(
(int) $object->getStoreId(),
Mage_Core_Model_App::ADMIN_STORE_ID,
);
$select->join(
array('cbs' => $this->getTable('cms/block_store')),
$this->getMainTable().'.block_id = cbs.block_id',
array('store_id')
)->where('is_active = ?', 1)
->where('cbs.store_id in (?) ', $stores)
->order('store_id DESC')
->limit(1);
}
return $select;
}
Using a collection allows you to bypass this hardcoded load select filtering.
Using a collection to load the CMS block does not trigger all the same observers etc that you would expect, so if you are planning on calling $cmsBlock->save() at the end of your modifications you will have to be sure to re-attach the store information.
$cmsBlock->setData('foo', 'bar');
$existingStoreIds = Mage::getModel('cms/block')->getResource()->lookupStoreIds($cmsBlock->getId());
$cmsBlock->setData('stores', $existingStoreIds);
$cmsBlock->save();