1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Render Alerts

Discussion in 'XenForo Development Discussions' started by silence, Aug 6, 2013.

  1. silence

    silence Well-Known Member

    Yes it's me again :C
    This function in the Alert model:
    PHP:
        public function getAlertsForUser($userId$fetchMode, array $fetchOptions = array(), array $viewingUser null)
    It get's the alerts for a user, however how exactly is the alert rendered on the controller?
    I was looking in one of the alert templates and it was being called simply with one variable ($alert.template) so which function renders an alert into a single string?

    Thanks!
     
  2. silence

    silence Well-Known Member

    Alright I got a bit further with this, I'm attempting to grab the template and render it, then use a regex to remove all html content and leave me with just the raw text of the template. However, I can't figure out how to get said template and view it raw! Here is what I have so far.

    PHP:
    <?php

    class Teamspeak_Model_Alert extends XFCP_Teamspeak_Model_Alert
    {
        public function 
    renderAlert($alert)
        {
            
    $template $this->_getAlertTemplate($alert['content_type'], $alert['action']);
        }

        protected function 
    _getAlertTemplate($contentType$action)
        {
            return 
    'alert_' $contentType '_' $action;
        }
    }
     
  3. silence

    silence Well-Known Member

    bumpity bump bump!
     
  4. silence

    silence Well-Known Member

    Bump I still am a bit confused about this D:
    I saw the plugin 'Pushover Integration' by @xfrocks but am confused as to how they achieved it :(
     
  5. xfrocks

    xfrocks Well-Known Member

    Well, you need the XenForo_View object to render the template. Take a look at XenForo_ViewPublic_Account_AlertsPopup ;)
     
    Nobita.Kun likes this.

Share This Page