SocialEngine 4: ArrowChat New Messages Notifications

Do you use ArrowChat with your SE Site now here is a simply way to enable site notifications

First go to your Arrowchat Administration panel -> General Features and enable “Enable Site Notifications”.

After that go to “Manage” -> “Notifications” -> “Private Messages” and press “Edit”

You will see “Notification Number” is “1” (we need that later)

Next open “application/modules/Messages/controllers/MessagesController.php”

Go to Line 188

You will see

          // Send notifications
          foreach( $recipients as $user )
          {
            if( $user->getIdentity() == $viewer->getIdentity() )
            {
              continue;
            }
            Engine_Api::_()->getDbtable('notifications', 'activity')->addNotification(
              $user,
              $viewer,
              $conversation,
              'message_new'
            );

After that Add

            //connect to DB
            $file = APPLICATION_PATH . '/application/settings/database.php';
            $options = include $file;
            $dbArrow = Zend_Db::factory($options['adapter'], $options['params']);
            $dbArrow->getConnection();
            //end DB setup

            $sql = "INSERT INTO arrowchat_notifications (to_id, author_id, author_name, type, alert_time, misc1, misc2, misc3)
            VALUES ('".$user->getIdentity()."', '".$viewer->getIdentity()."', '".$viewer."', '1', '".time()."', '', '', '')";
            $dbArrow->query($sql);

Save and re-upload, done :)

Just copy paste this snippet to any controller, where you want notifications to appear and change “type” to the number you want.

In our case 1 is the type for “Private Messages”

Looking for quality SocialEngine Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , | Posted under SocialEngine | RSS 2.0

Author Spotlight

Andrew Cross

Andrew Cross

Hi, I'm Andrew. A am a 26, ICT Administrator which offers support to company's around the South Wales Area. I have created a few social sites for myself and other company's. So far 2 out of 3 have been successful using the powerful SocialEngine Script. I continue to try and help the community of SocialEngine by giving Support and Technical Help where possible.

Leave a Reply

Your email address will not be published. Required fields are marked *


6 − 5 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>