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

Saving page-node with class and method callback fails.

Discussion in 'XenForo Development Discussions' started by GabrielVH, Mar 17, 2013.

  1. GabrielVH

    GabrielVH Member

    I originally posted in this thread: http://xenforo.com/community/thread...-a-callback-for-pages.7226/page-5#post-498765


    I know this is an old thread, but I can't find anything else (unless someone has a link?).

    I've got my class setup in /library/PGMemberList/PageCallback/Members.php and I'm just using the example code from the video at the moment, modified with my class name:

    class PGMemberList_PageCallback_Members {
      public static function respond(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract $response)
        $userModel = $controller->getModelFromCache('XenForo_Model_User');
        $response->params['users'] = $userModel->getLatestUsers(array(), array('limit' => 5));
        $response->templateName = 'pgmember_list';
    My template file just has a foreach loop of the user title as in the video.

    But I can't save the page in the ACP when I enter the class name and method? Looking at the XHR request the page makes, the server responds with Internal Server Error 500.
    I've also edited the database page entry with my class name and method, but then the resulting page node just shows up blank. Even with debug mode on for my IP Address I don't get any information about the error.

    Any ideas?
  2. Jeremy

    Jeremy Well-Known Member

    Do you have your file saved under:

    What options do you actually have in your page? What error do you get? An actual error from XenForo?
  3. GabrielVH

    GabrielVH Member

    Yup, the class file is here:

    The Members.php code is as I posted above, and the template simply contains:

    <xen:require css="page.css" />
    <xen:foreach loop="$users" value="$user">
    {xen:helper usertitle, $user}
    There isn't any displayed error - XenForo doesn't even show the "Please enter valid class name" error. When you click Save, the form submits but there is no success message.
    The server just has an Internal Error.
  4. Jeremy

    Jeremy Well-Known Member

    This appears to be more of an issue with your server failing to display templates/save-multiple.json, versus an actual programming error. What add-ons do you have installed on your site?
  5. GabrielVH

    GabrielVH Member

    Well, this proves how tired I have been lately. There's a missing open bracket on line 5.

    *head-desk* *head-desk*
    Jeremy likes this.
  6. Jeremy

    Jeremy Well-Known Member

    I take it it works now?
  7. GabrielVH

    GabrielVH Member

    Yep, works fantastic thanks.

Share This Page