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

Where/how do i enable/find the node PHPCallback tab?

Discussion in 'XenForo Development Discussions' started by Fixxer, Mar 8, 2014.

  1. Fixxer

    Fixxer Member

    Hey there,

    I have a code i need to apparently enter into the PHP Callback tab, which is

    PHP Callback eipSoftware_wppages_wppagecallback :: respond
    But i can't find the tab.

    The guide is fairly outdated, is there a new way of doing this or is the tab simply needing to be enabled somehow?

    This is what i see;

    And this is what i need;

    Thanks for any help.
  2. Liam W

    Liam W Well-Known Member

    The PHP callback is available for page nodes only.

    That is a forum node...

  3. Fixxer

    Fixxer Member



    Sorry, and thanks!
  4. Fixxer

    Fixxer Member

  5. Liam W

    Liam W Well-Known Member

    Where's the class located?

    It should be in the library/eipSoftware/wppages/wppagecallback.php file.

    And it should have a public static function called respond.

  6. Fixxer

    Fixxer Member

    Hmm.. Not sure,

    This is what's in there though.

    class eipSoftware_wppages_wppagecallback
        private static $filename = "/media/webfiles/articles/wp-config.php"; 
        private static $conntype = "pdo";    //"mysqli";
        private static $options = array();            //store the various forum options
        private static $pageDescription;
        private static $connInfo = array();
        private static $wpHtml = array('wpdate'=>'1/1/2013','wptitle'=>'Title Unavailable'
                                      ,'wppost'=>'Empty', 'wplink'=>'index.html', 'wpuser'=>'Unknown');
        private static function getAddOnOptions()
            self::$conntype = strtolower(self::getOptionValue("eipWPArticleAsPageNode", "eipWPPagesConnType"));
            self::$filename = self::getOptionValue("eipWPArticleAsPageNode", "eipWPConfigFileName");
         * read the option value from the admin control panel
         * @param string $addon
         * @param string $option_name
        private static function getOptionValue($addon,$option_name)
                self::$options[$addon][$option_name] = XenForo_Application::get('options')->$option_name;
         * load the config info from WP file
        private static function loadWPInfo()
            include_once self::$filename;
            self::$connInfo['prefix']    = $table_prefix;            //table prefix for wordpress tables
         * save the config info into an array
        private static function buildConnInfo()
            self::$connInfo['host']     = DB_HOST;
            self::$connInfo['dbname']     = DB_NAME;
            self::$connInfo['username'] = DB_USER;
            self::$connInfo['password'] = DB_PASSWORD;
         * run the query and store the vaules in an array
        private static function getWPArticle()
            switch (self::$conntype)
                case "mysqli":
                    $db = new eipSoftware_wppages_extmysql(self::$connInfo, $querytype="SELECT");
                case "pdo":
                    $db = new eipSoftware_wppages_extpdo(self::$connInfo, $querytype="SELECT");
                    $result =0;
            $result = $db->RunQuery(qry_getWPPost(array(':slug'=>self::$pageDescription),self::$conntype,self::$connInfo['prefix']));
            if (count($result) > 0)
                self::$wpHtml = array('wpdate'=>date_i18n(get_option('date_format'),strtotime($result[0]['post_date']))
         * Get the wp post and return the values back to the template
         * @param XenForo_ControllerPublic_Abstract $controller
         * @param XenForo_ControllerResponse_Abstract $response
        public static function respond(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
            self::getAddOnOptions();        //get the options from admin control panel
            self::$pageDescription = ($response->params["page"]["description"]) ? $response->params["page"]["description"] : "blank";
            self::$wpHtml['debug'] = "start: " . date("m/d/Y H.i.s") . " <br />" . $response->params["page"]["description"] . " end";
            $response->params['htmlValue'] = self::$wpHtml;
            $response->templateName = "eipSoftware_wppage";
    * Format the query to get the post
    * @param array $parmeters slug
    * @param string $prefix
    * @return eipSoftware_wppages_wpquery
    function qry_getWPPost($parmeters, $conntype="pdo", $prefix="")
        $qry = new eipSoftware_wppages_wpquery(
                SELECT    p.post_date
                FROM    " . $prefix . "posts AS p
                        LEFT OUTER JOIN " . $prefix . "users AS u
                            ON p.post_author = u.id
                        INNER JOIN
                        SELECT    p1.id
                        FROM     " . $prefix . "posts AS p1
                        WHERE    p1.post_title = :slug
                                AND p1.post_status IN ('publish','inherit')
                        GROUP BY p1.post_title
                        ) sq
                        ON p.id = sq.id
                ,array(':slug'=>($conntype=="pdo") ?  PDO::PARAM_STR : 's')
  7. Liam W

    Liam W Well-Known Member

    That file has to be in the correct location.

    Copy it to library/eipSoftware/wppages/wppagecallback.php

  8. Fixxer

    Fixxer Member

    Sorry, that's where i got it from. yes, it's in the correct location.

    For the Database info, is it wanting WP or XF database input?
  9. Liam W

    Liam W Well-Known Member

    It isn't in the correct location. The error you described is only raised if the file is in the wrong location.

    The folder names are case sensitive.

    I have no idea re database. You would have to ask the person that made it.

  10. Fixxer

    Fixxer Member

Share This Page