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

Adding data to a response?

Discussion in 'XenForo Development Discussions' started by Z61, Feb 6, 2015.

  1. Z61

    Z61 Member

    I'm attempting to add some additional data onto the end of a response for a report. I cannot seem to get it to work right and it cuts off the content of the report.
    Code:
      function actionView()
      {
      $options = XenForo_Application::get('options');
      $response = parent::actionView();
      $data["commentHideTime"] = strtotime($options->z61_days . " days");
      return $this->responseView('XenForo_ViewPublic_Report_View', 'report_view', array_merge($data, $response->params));
      }
    
    Anyone know a proper way of doing this?
     
    Last edited: Feb 6, 2015
  2. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    Not sure what you are trying to achieve here, but the best approach for what you've posted would be:

    PHP:
    public function actionView()
    {
        
    $return parent::actionView();

        if (
    $return instanceof XenForo_ControllerResponse_View)
        {
            
    $options XenForo_Application::get('options');
            
    $return->params['commentHideTime'] = strtotime($options->z61_days " days");
        }

        return 
    $return;
    }
     
    Z61 likes this.

Share This Page