Jump to:

1036 Posts in 810 Topics by 315 members

Forum Module

SilverStripe Forums » Forum Module » Forum module - posting replies

Discuss the Forum Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1227 Views
  • Christy
    Avatar
    Community Member
    57 Posts

    Forum module - posting replies Link to this post

    When a reply is posted to a topic this error occurs although the post appears. Email notifications and moderation emails are not received.

    Has anyone seen this before? Thanks.

    [User Error] Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'Member'
    POST /members-login/forums/general-discussion/PostMessageForm

    Line 750 in /var/www/vhosts/ctla.123abc.co.nz/httpdocs/framework/core/Object.php
    Source

    741             default :
    742                throw new Exception (
    743                   "Object->__call(): extra method $method is invalid on $this->class:"
    744                      . var_export($config, true)
    745                );
    746          }
    747       } else {
    748          // Please do not change the exception code number below.
    749          $class = get_class($this);
    750          throw new Exception("Object->__call(): the method '$method' does not exist on '$class'", 2175);
    751       }
    752    }
    753    
    754    // --------------------------------------------------------------------------------------------------------------
    755    
    756    /**

    Trace

    Object->__call(forTemplate,Array)
    ViewableData.php:439
    Member->forTemplate()
    ViewableData.php:439
    ViewableData->XML_val(Author,,1)
    call_user_func_array(Array,Array)
    SSViewer.php:178
    SSViewer_Scope->__call(XML_val,Array)
    SSViewer.php:524
    SSViewer_DataPresenter->__call(XML_val,Array)
    .cache.forum.templates.email.ForumMember_TopicNotification.ss:19
    SSViewer_DataPresenter->XML_val(Author,,1)
    .cache.forum.templates.email.ForumMember_TopicNotification.ss:19
    include(/var/www/vhosts/ctla.123abc.co.nz/httpdocs/silverstripe-cache/zctla12327663nz/.cache.forum.templates.email.ForumMember_TopicNotification.ss)
    SSViewer.php:927
    SSViewer->includeGeneratedTemplate(/var/www/vhosts/ctla.123abc.co.nz/httpdocs/silverstripe-cache/zctla12327663nz/.cache.forum.templates.email.ForumMember_TopicNotification.ss,ViewableData_Customised,,Array,)
    SSViewer.php:994
    SSViewer->process(ViewableData_Customised)
    Email.php:370
    Email->parseVariables()
    Email.php:470
    Email->send()
    ForumThread.php:312
    ForumThread_Subscription::notify(Post)
    Forum.php:941
    Forum_Controller->doPostMessageForm(Array,Form,SS_HTTPRequest)
    Form.php:358
    Form->httpSubmission(SS_HTTPRequest)
    RequestHandler.php:288
    RequestHandler->handleAction(SS_HTTPRequest,httpSubmission)
    RequestHandler.php:200
    RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
    RequestHandler.php:222
    RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
    Controller.php:153
    Controller->handleRequest(SS_HTTPRequest,DataModel)
    ContentController.php:203
    ContentController->handleRequest(SS_HTTPRequest,DataModel)
    ContentController.php:186
    ContentController->handleRequest(SS_HTTPRequest,DataModel)
    ContentController.php:186
    ContentController->handleRequest(SS_HTTPRequest,DataModel)
    ModelAsController.php:68
    ModelAsController->handleRequest(SS_HTTPRequest,DataModel)
    Director.php:325
    Director::handleRequest(SS_HTTPRequest,Session,DataModel)
    Director.php:143
    Director::direct(/members-login/forums/general-discussion/PostMessageForm,DataModel)
    main.php:189

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Forum module - posting replies Link to this post

    This would indicate the template includes a $Member, $Author or $CurrentMember variable which is trying to render (whereas you should have $Member.FirstName). Have a look at ForumMember_TopicNotification.ss to see if that has any issue with that.

  • Christy
    Avatar
    Community Member
    57 Posts

    Re: Forum module - posting replies Link to this post

    Thank you Willr - this fixed the problem.

  • neilcreagh
    Avatar
    Community Member
    94 Posts

    Re: Forum module - posting replies Link to this post

    I wonder if you could help clarify what you changed in order to fix this?
    I have a very similar issue - posting replies throws up this error

    [User Error] Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'Member'
    POST /members/forum/general-discussion/PostMessageForm
    Line 750 in …/framework/core/Object.php


    Except that posting a new topic works fine AND posting a reply to that topic then works fine too... but trying to post a reply to an existing topic gives this error (and email notifications don't get sent)

    Any ideas how I might go about fixing this?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Forum module - posting replies Link to this post

    @Neil, in the template there might be a <p>$Member </p> or if $Member == "" which is triggering the forTemplate() call. In your back trace you'll see a template file to look into.

  • neilcreagh
    Avatar
    Community Member
    94 Posts

    Re: Forum module - posting replies Link to this post

    Thank you - yes there was a few lines in the ForumMember_TopicNotification.ss that I had to remove.

    Firstly I removed

    <% if Author %><% _t('BY', "by") %> $Author.Nickname.<% end_if %>

    but then I got a whole new error message

    [User Error] Uncaught SSTemplateParseException: Parse error in template on line 1. Error was: Malformed opening block tag sprintf. Perhaps you have tried to use operators?

    So then I removed the entire first line

    <p><% sprintf(_t('ForumMember_TopicNotification_ss.HI',"Hi %s,"),$Nickname) %></p>

    And now it's working. I had added an 'issue' on the Github page for the Forum Module - should I update the issue with this info or delete the issue?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Forum module - posting replies Link to this post

    Update the issue with that info as it'll still need to be fixed.

    1227 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.