Home » Tag Archives: SocialEngine

Tag Archives: SocialEngine

Pass custom error messages to form in socialengine / zend framework

if( !$form->isValid($this->getRequest()->getPost()) ) { return; } // Process $values = $form->getValues(); if( ($CouponCode = $form->getElement(‘coupon_code’)) && isset($values[‘coupon_code’])) { $iCouponExist = $table->checkCouponExist($values[‘coupon_code’]); if($iCouponExist == 1) { return $CouponCode->addError(‘This Coupon Code is not available, please use another one.’); } }

Read More »

zend framework group by select in socialengine

$viewer = Engine_Api::_()->user()->getViewer(); $iCurUser = $viewer->getIdentity(); $oSelect = $this->getAdapter()->select() ->from(‘engine4_job_usersapplied’, array(‘job_id’, ‘COUNT(job_id) as applied_count’)) ->group(‘job_id’) ->where(‘job_user = ?’, $iCurUser); $result = $this->getAdapter()->fetchAll($oSelect);

Read More »

Send emails in socialengine

Steps for send e-mails in socialengine: 1.Add the mailtemplate to socialengine database Eg: INSERT INTO `engine4_core_mailtemplates` (`mailtemplate_id`, `type`, `module`, `vars`) VALUES (NULL, ‘event_deleted’, ‘event’, ‘[eventname],[host],[email]’); Default socialengine sendsystem to send mails PHP zend socialengine code: $aEmailTo=array(); $db = $event->getTable()->getAdapter(); $db->beginTransaction(); $select = $event->membership()->getMembersObjectSelect(); $aMembers = $db->fetchAll($select); foreach($aMembers as $aMember) { $aEmailTo[] = $aMember[’email’]; } //event delete mail $filteruserEmailTo = array_filter(array_unique($aEmailTo)); ...

Read More »

How to make a csv file in php socialengine

public function downloadcsvAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $query=Engine_Db_Table::getDefaultAdapter()->select() ->from(‘engine4_users’,array(‘user_id’,’email’,’displayname’,’level_id’,’enabled’,’approved’,’creation_date’)) ->where(‘user_id !=?’,1) ->where(‘user_id not in (?)’, array(‘685′,’870′,’948′,’965′,’1031′,’1249′,’1279′,’1283’)); $aResult= $query->query()->fetchAll(); header(‘Content-Type: application/csv’); header(‘Content-Disposition: attachement; filename=”users.csv”‘); $f = fopen(‘php://output’, ‘w’) or show_error(“Can’t open php://output”); $n = 0;$line = array();$array=array(); $line[]=’Email’;  $line[]=’Display Name’; $array[]=$line; $line[]=’info@smarttips.in’;$line[‘sijo’]; $array[] = $line; } foreach ($array as $user) { $n++; if (!fputcsv($f, $user)) { show_error(“Can’t write line $n: $user”); } ...

Read More »

how to redirect a page in socialengine

redirect function in socialengine we can use this code controller for redirecting <?php /** * Index Controller */ class Admin_IndexController extends Core_Controller_Action { public function loginAction() { $this->_redirect(‘/index’); } redirect is core helper function in socialengine. It can use in socialengine controller.

Read More »