MyBB Community Forums

Full Version: Using Template parts outside of their originally defined template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi, I'm styling a MyBB forum for a client (sorry, can't link as it's only on localhost at the minute). Basically the company I work for have been subcontracted out, and I'm just coding up someone elses design.
And the designer is a pedantic tosser.
Because of this, he is actually making us get it pixel perfect (and I mean PIXEL perfect) and he wont accept no as an answer... at all. In fact he has even been emailing us to tell us parts are broken while we're still making them.

In short I need to know if it is possible to:
  • Include the boardstats on forumdisplay pages
  • Add 'Last Logged In' to user information displayed in threads (when a user makes a post)

I am using version 1.6.8

Screenshots of the .PSDs attatched.

  1. You will need to plugin for this.
  2. Move {$post['onlinestatus']} anywhere in the postbit/postbit_classic template and edit the postbit_online/postbit_away/postbit_offline to fit your needs.
Saying "You will need a plugin for this." is possibly the most useless answer you could have given me. You might as well have said "You do not have the things required to do this". If I need a plugin, what plugin? where could I go about finding a plugin like this? Why do I need to use a plugin for something so simple?
I have done a lot of research into this, and so far the only topics I have found on the subject are telling me that it requires template altering. I AM PREPARED TO DO THIS. I just need some pointers on what the hell I'm actually supposed to do to achieve this.

And I said LAST LOGGED IN. Not online/offline. I was asking for a method of showing MORE information than if a person is simply online or offline, I need to show when they were LAST online if they are not currently online.

I'm sorry if my original post was not clear enough for you to entirely understand what I was asking, and I apologise for my ragefilled answer, but I really expect a slightly more useful answer from someone marked as the "Support Team".
(2012-11-12, 02:15 PM)Sudo Wrote: [ -> ]Saying "You will need a plugin for this." is possibly the most useless answer you could have given me. You might as well have said "You do not have the things required to do this". If I need a plugin, what plugin? where could I go about finding a plugin like this? Why do I need to use a plugin for something so simple?
I have done a lot of research into this, and so far the only topics I have found on the subject are telling me that it requires template altering. I AM PREPARED TO DO THIS. I just need some pointers on what the hell I'm actually supposed to do to achieve this.

The board stats are only loaded on the index page, so you need a plugin to perform the same function which is executed on the index page on forumdisplay. Omar stated you need a plugin to achieve this because there isn't one available. It's not useless at all, he's pointing you in the right direction.
For question number 1:

Definitely requires a plugin. It's not that difficult to make - I created one ages back when I coded the MyBBSecurity theme for them as the designer had added a global WOL there too.

For question number 2:

As Omar said, you will likely require a plugin though I've not seen any that accomplishes this task, though it would be fairly easy to create as the user's last visit should be stored in the {$post['lastvisit']} variable in the form of a Unix Timestamp. You could try posting a request in the plugin requests forum and see if anybody would be willing to create it for you as it should be pretty straightforward.
(2012-11-12, 02:15 PM)Sudo Wrote: [ -> ]I'm sorry if my original post was not clear enough for you to entirely understand what I was asking, and I apologise for my ragefilled answer, but I really expect a slightly more useful answer from someone marked as the "Support Team".

The answer was very useful. It showed you how to accomplish what you want. You can not be more detailed than that when it comes to a situation when something an users wants can be accomplished with plugins imho.
Ahhh, and as always on forums, flame a little and suddenly people want to prove you wrong... Best way to get support.

I'm slowly getting somewhere with the creating the boardstats block. Managed to get some more answers round here, and I'm using the PHP in Templates plugin so that solves a lot of plugin woes.

As for the timestamp, someone gave me a list of the variables I needed in another one of my threads, which led me to this changing my postbit_offline to:

<?php echo date("jS F, Y", ($mybb->user['lastactive'])); ?>
(2012-11-12, 03:10 PM)Sudo Wrote: [ -> ]Ahhh, and as always on forums, flame a little and suddenly people want to prove you wrong... Best way to get support.

Don't be too smart or people will remember Toungue

On topic: Do be careful with php in templates, it is a great tool but as ZingaBurga says, loading lots and lots of snippets will slow the page down a little, so for high traffic areas I would recommend a plugin. Also, direct edits in templates are a pain on upgrade if a lot of templates get changed.

IF you know your way about php then you can make a lot of plugins yourself, or you can use the patches plugin and edit core files.

http://mods.mybb.com/view/patches
(2012-11-12, 03:27 PM)Leefish Wrote: [ -> ]On topic: Do be careful with php in templates, it is a great tool but as ZingaBurga says, loading lots and lots of snippets will slow the page down a little, so for high traffic areas I would recommend a plugin. Also, direct edits in templates are a pain on upgrade if a lot of templates get changed.

IF you know your way about php then you can make a lot of plugins yourself, or you can use the patches plugin and edit core files.

http://mods.mybb.com/view/patches

Yeah I understand, I unfortunately everyone in my office has lost any patience for this client, he's made every part of this project awkward for everyone involved, so we're not really taking any pity on future issues they might have. I doubt they'll be upgrading the site anyway.

And okay I will have a look into creating plugins, see what I can do with that.
If the client is never going to upgrade then look at using patches for sure, it is actually easier than making a plugin and saves the overhead a lot of the time. Look in the index.php for the boardstats, you will see it is calling from cache - so your plugin would need to hook into the cache.

I made a really simple example plugin for using the cache on on all pages for newestuser (part of what you want), I will see if I can find it. The online users can be part of that plugin.

This might help : http://www.leefish.nl/mybb/forum-10-page-1.html

The online today plugin is from the mods site, but it is a plugin to get the usersonline today. Maybe you can combine those?
Pages: 1 2