Alert Handler

Cupara

Well-known member
I am missing something here. I have the template, file, and content_type but the alert popup displays 1 but does not grab my template to display that user a has send you xxxx points.

alert_xfpoints_sent
HTML:
{xen:phrase xfpoints_x_sent_gift_y,
   'name={xen:helper username, $user, 'subject'}',
   'amount={$content.amount}',
   'points={$xenOptions.xfpoints_currency_name}'}

xfpoints_alert_preferences
HTML:
  <h3 class="sectionHeader">{xen:phrase xfpoints}</h3>
   <dl class="ctrlUnit">
     <dt>{xen:phrase xfpoints_receive_alert_when_you_receive}...</dt>
     <dd>
       <ul>
         <xen:hook name="account_alerts_xfpoints">
         <li><input type="hidden" name="alertSet[xfpoints_sent]" value="1" />
           <label><input type="checkbox" value="1" name="alert[xfpoints_sent]" {xen:checked "!{$alertOptOuts.xfpoints_sent}"} /> {xen:phrase xfpoints_send_user}</label
            ><p class="hint">{xen:phrase xfpoints_someone_sends_gift}</p>
         </li>
         </xen:hook>
       </ul>
     </dd>
   </dl>

xfPoints_Model_Gift
PHP:
    public function getGiftByIds(array $giftIds)
   {
     return $this->fetchAllKeyed('
       SELECT *
         FROM xfpoints_transactions
       WHERE transaction_id IN (' . $this->_getDb()->quote($gifIds) . ')
     ', 'transaction_id');
   }

xfPoints_AlertHandler_Gift
PHP:
<?php

class xfPoints_AlertHandler_Gift extends XenForo_AlertHandler_Abstract
{
   public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser)
   {
     return $model->getModelFromCache('xfPoints_Model_Gift')->getGiftByIds($contentIds);
   }
}

Database: xf_content_type and xf_content_type_field
xfcoder.com | localhost.webp
xfcoder.com | localhost 2.webp

I'm not sure what else I need to do to make sure my template of xfpoints_sent is called or where I went wrong for getting it to work.
 
I am missing something here. I have the template, file, and content_type but the alert popup displays 1 but does not grab my template to display that user a has send you xxxx points.

alert_xfpoints_sent
HTML:
{xen:phrase xfpoints_x_sent_gift_y,
   'name={xen:helper username, $user, 'subject'}',
   'amount={$content.amount}',
   'points={$xenOptions.xfpoints_currency_name}'}

xfpoints_alert_preferences
HTML:
  <h3 class="sectionHeader">{xen:phrase xfpoints}</h3>
   <dl class="ctrlUnit">
     <dt>{xen:phrase xfpoints_receive_alert_when_you_receive}...</dt>
     <dd>
       <ul>
         <xen:hook name="account_alerts_xfpoints">
         <li><input type="hidden" name="alertSet[xfpoints_sent]" value="1" />
           <label><input type="checkbox" value="1" name="alert[xfpoints_sent]" {xen:checked "!{$alertOptOuts.xfpoints_sent}"} /> {xen:phrase xfpoints_send_user}</label
            ><p class="hint">{xen:phrase xfpoints_someone_sends_gift}</p>
         </li>
         </xen:hook>
       </ul>
     </dd>
   </dl>

xfPoints_Model_Gift
PHP:
    public function getGiftByIds(array $giftIds)
   {
     return $this->fetchAllKeyed('
       SELECT *
         FROM xfpoints_transactions
       WHERE transaction_id IN (' . $this->_getDb()->quote($gifIds) . ')
     ', 'transaction_id');
   }

xfPoints_AlertHandler_Gift
PHP:
<?php

class xfPoints_AlertHandler_Gift extends XenForo_AlertHandler_Abstract
{
   public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser)
   {
     return $model->getModelFromCache('xfPoints_Model_Gift')->getGiftByIds($contentIds);
   }
}

Database: xf_content_type and xf_content_type_field
View attachment 54019
View attachment 54020

I'm not sure what else I need to do to make sure my template of xfpoints_sent is called or where I went wrong for getting it to work.
You must rebuild contentType after you run sql add column :)
Look at xf_content_type_filed that column filed [BOL-0]
 
I'm not understanding you there. There is no method I aware of to rebuild content_type.
When you add something to xf_content_type and xf_content_type_filed You must rebuild that
PHP:
XenForo_Model::create('XenForo_Model_ContentType')->rebuildContentTypeCache();
As I saw your database
xf_content_type column FIELD [BLOB - 0B] this look like don't save some information for alert handler. You can export some handler to understand that :)

My Addon also using alert handler :) http://xenforo.com/community/resources/thread-action-alert.2082/
 
Back
Top Bottom