e107help.org Q&A
0 like 0 dislike

Good evening 

In the good old time, aka with version 1.0.4, it was possible to define a "template" in the theme to "overwrite" the one defined in the plugin 

I try since 2 days to change the "forum_post_template.php" from my theme, without success

Looking how the code works, I see that the forum plugin retreive the template content thanks to a e107 method 

$template = e107::getTemplate('forum', 'forum_'.$type)

And this method (from e107_handlers/e107_class.php) look only in the plugin folder ... frown

Is there a way to change that ? 

in the theme, may be ?

if not, I will modify the one from the plugin, but I found this really annoying (and not really smart) 



e107 version 2.1.7
in Themes by (45 points) 1 3

What I want to achieve : 

In the v1, when we replied to a thread, we had, below the editor window, the first message of the thread and the 9 last messages in reverse order 

I would like to have the same. I tried to add the following code in the file "forum_post_template.php", without success 

<div style='text-align:center'>

The div is inserted but it is empty , as if the "shortcode" wasn't working

3 Answers

1 like 0 dislike
Best answer

So I found cool
I will explain if it can help someone in the future

In fact, I was right since the beginning, I just didn't dig enough! 
Issue come from method (or public function) "getTemplate" of object "e107" or to be more precise from method "getThemeInfo".

In this last method, the path of the theme used is defined. Mainly at this line 

$for = isset($user_pref['sitetheme']) ? $user_pref['sitetheme'] : self::getPref('sitetheme');

As I said, my site is installed since a very long time, probably around v0.6 ... 
at one moment, I activated the possibility to change the theme of the site just for me 
I wanted to change the theme of the site, so I installed a lot of various theme and the droplist on the front page allowed me to test them easily and quickly without going to the admin page and without changing everything for everyone 

Fact is that in the database, I had, in table "e107_user", for value "user_prefs" :
array (
  'sitetheme' => '',
so the variable "$user_pref['sitetheme']" was set ... with an empty value ! sad

reason why, "e107::getTemplate" was unable to find my modified file in the theme, as it was thinking that I used a "personal theme" 

I removed the variable in the database and now everything is fine 

by (45 points) 1 3

To be complete: On the v1, I deleted the content of this value in the database, then from the site, I change my theme and select something different than the default theme of the site 

This change is visible in the DB.

I go back to the default theme and the variable in the database go back to the empty value 

I feel that, in this case, "empty($user_pref['sitetheme'])" should have been better than "isset" 

I agree, could you please post this up on Github so it can be looked at?
0 like 0 dislike


I read this page , and it say exactly what I said 

  • All templates that are used in e107 can be overridden by copying them into specific folders within your current theme folder. 

But when you look at the code of e107::getTemplate, you will see that it even don't look at the Theme folder ... sad

by (45 points) 1 3
Hope don't make a mistake as i do not use it.

In theme you have folder templates

for forum you would create a folder called forum too; and in this folder you put your (copied and than changed templates.
This normally would eliminate the use of get Template, and those are also not prone for update problems.
So it is the presence in your theme that overrides the core files (that is how it should work)

Yes, this how it should work, and how it was working with v1

I have the file at the correct place, I even tried to put one at the root of the theme. I edit both file and add something stupid, just to identify the page 

Nothing works (even emptied the cache)

I do the same in the "template" page from the plugin, and it works 

Just look at "e107_handlers/e107_class.php" and search for "function getTemplate" , you will see that it goes only to the plugin folder !! 

And even, if I choose to modify the template from the plugin, because I don't have the choice anyway, when adding "{LATESTPOSTS}" it doesn't work frown , I can see that something is added but it's empty 

Just tested , the IN THEME/folder forum including forum templates (and then changed some internal) does work.No issues

However i am unaware if the shortcode LATESTPOSTS is still active (although it is present in 2 files only forum ;  as for v1 khatru theme had 1 too).
Do not know if it for Bc compat or it was changed to LASTPOST.
0 like 0 dislike

1) According to the documentation, you need to place the forum template file in the folder here: e107_themes/your_theme_folder/templates/forum/
Just tested this, and it works. 

2) Clear all caches (e107 and browser) after making changes. Some server configurations may also use caching. 

3) Very if you are using the correct shortcode as used in the core template. As Tgtje said, there may have been changes which requires you to use different shortcodes. The ones in the core template (e107_plugins/forum/templates/ are the ones to be used. 

4) If all else fails, also try testing with the default bootstrap 3 theme to see if your template changes apply. If they do, there may be an issue with third party theme compatibility. 


by (2.6k points) 6 9 9

1) This is what I did, and it didn't work for me ! 

As a matter of test, I changed the template in the theme folder, just put an "ericc" somewhere in the HTML to make it visible on the page, I never see it 

I restore the page and then did the same on the same file but in the plugin folder and then it worked (while the other copy was still in the theme folder at the right place as you describe) 

Will try one more time ... 

2) My "development" webserver is a VM with Ubuntu LTS and Apache and I deactivate the Zend Cache, so shouldn't be an issue on this side

When I made modification on the page (HTML or code) I reload in the browser with Ctrl+F5 or Ctrl+R , I even clear the cache manually, by pressing Ctrl+Shift+Del (and not Ctrl+Alt+Del blush) and then select "cache"

However, I must admit that I forgot to clear the cache of e107. On my old forum, I had deactivated it because I consider it more as a problem than a solution (just checked and it's also deactivated on the new site ...so no problem)

3) Indeed, it's very possible that I dodn't used the correct shortcode. I looked inside the forum template, but didn't find what I'm looking for 

4) I will try this ... and for compatibility ... I can't exclude that, as I try to upgrade my old site, I couldn't find a replacement for all the plugin and most of them (seems to ) works  

Very eager to hear when results are positive; as mentioned in this case : a lot happening  (server; versions, shortcodes) and help can only be up to a certain level here. If there is no real thing one can cross relate or replicate it is guessing and testing..blush

"(just checked and it's also deactivated on the new site ...so no problem)"
Clear it anyway, some things are cached even though the caching functionality is turned off. 


So, I started from scratch 

On my local webserver, I installed a fresh copy of e107 v2. Then I deactivate the cache and clear everything. Some files are coming back ...

I selected as theme "landingzero", I created a folder "e107_themes/landingzero/templates/forum/" and copied inside file "forum_post_template.php" from the plugin folder 

I edited this file and in the first variable ($FORUM_POST_TEMPLATE['form'] =), at the end after "{FORUM_POST_FORM_END}", I added 

<div class='form-group text-center'>ericc





First good point, I see now "ericc" appearing right below the buttons (Preview and Post a Reply) when I try to reply to a topic

Negative point : Nothing else ! all other shortcodes are ignored 


Now, on my "upgraded" installation, I did the same: select LandingZero, create the 'forum' subfolder, and copy the file from the other installation to this one (so same file with same modification

And .... nothing ! The file is ignored completely 

I compare the content of the plugin folder between both installation with Meld and couldn't find a difference (beside the French files and images)

I removed all plugins keeping the same as on the new install, without success 


I remember now that, a long time ago, I installed a code beautifier named "Geshi" ... not a plugin, more a hack of the core. I need to remember how I did that 

Otherwise, I will try to delete all extra files from my upgraded installation compared to the new one until I found 

But anyway, what I really want to have the list of the previous post 

Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
842 questions
1,240 answers
5,546 users