Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Forum Module /

Discuss the Forum Module.

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

Forum module - posting replies


Go to End


7 Posts   4709 Views

Avatar
Christy

Community Member, 68 Posts

4 November 2013 at 3:34pm

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

Avatar
Willr

Forum Moderator, 5523 Posts

4 November 2013 at 6:59pm

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.

Avatar
Christy

Community Member, 68 Posts

25 November 2013 at 1:16pm

Thank you Willr - this fixed the problem.

Avatar
neilcreagh

Community Member, 136 Posts

1 March 2014 at 1:43am

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?

Avatar
Willr

Forum Moderator, 5523 Posts

1 March 2014 at 11:17am

@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.

Avatar
neilcreagh

Community Member, 136 Posts

2 March 2014 at 2:45am

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?

Avatar
Willr

Forum Moderator, 5523 Posts

2 March 2014 at 10:24am

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