Original reply.tpl.php does not print submitted variable. So I have to add reply.tpl.php to site's current theme.
When I add reply.tpl.php to site's current theme, the preprocess_reply function in this theme does not called at all. So I should override preprocess_reply in theme. If I override preprocess function in my theme reply links would not be displayed on node page.

CommentFileSizeAuthor
#5 2403805-5.patch483 byteshitfactory
#1 2403805-1.patch807 bytesidebr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idebr’s picture

Title: Template functions and theme problems » Template preprocess variables are not available when reply.tpl.php is overridden in a theme
Version: 7.x-2.0-alpha1 » 7.x-2.x-dev
Status: Active » Needs work
FileSize
807 bytes

The preprocess function for the reply hook get overriddens by the entity preprocess functions when the reply.tpl.php is copied to another directory. Attached patch adds the preprocess function when this happens. I'll have a look if this behaviour can be prevented instead of overridden, but it will fix the issue you are experiencing.

Paul B’s picture

Issue tags: +Regression

This bug was fixed before in #1994298: Overriding reply.tpl.php causes fatal error with lastest version of EnityAPI by replacing template_preprocess_reply() with reply_preprocess_entity().
In #2351317: reply.tpl.php is included but never invoked reply_preprocess_entity() was replaced with reply_preprocess_reply().
It appears that template_preprocess_reply() and reply_preprocess_reply() are not called when you override the template,
but reply_preprocess_entity() is not called when you don't override the template. This seems to be related to #1462772: template suggestions are not working if no custom template is defined.

Paul B’s picture

Status: Needs work » Needs review
durum’s picture

Status: Needs review » Needs work

Patch doesn't force the mytheme_preprocess_reply() nor mymodule_preprocess_reply() functions being hit with the presence of reply.tpl.php but without the patch reply_preprocess_reply() is not hit.

hitfactory’s picture

FileSize
483 bytes

This workaround outlined by heylookalive on #1462772: template suggestions are not working if no custom template is defined ensures module and theme preprocess hooks are called. Patch with same approach attached.

Paul B’s picture

Status: Needs work » Needs review
vyasamit2007’s picture

Status: Needs review » Reviewed & tested by the community

Patch #5 resolves the issue.

durum’s picture

Confirming mytheme_preprocess_reply() is hit with the patch and reply.tpl.php inside theme directory is used.

But $variables['user'] is coming as anonymous user which may be related to the issue Author information wrong

B Boy Breaker’s picture

#5 didn't work but #1 works good
thank you

glynster’s picture

#1 works a treat +1 RTBC!

alex.skrypnyk’s picture

Just to be clear: you have to apply both #1 and #5 patches to make it all work as they tackle different parts of this issue.

Also, the issue in #5 is due to the bug in EntityAPI module (https://www.drupal.org/node/1462772).

alex.skrypnyk’s picture

If used with Bootstrap theme, there is another problem going on (https://www.drupal.org/node/2849352) and #5 is not enough.
Your theme would have to implement hook_theme_registry_alter() again and unset 'base hook' value for 'reply' entity again (same as what #5 does).