phpBB SnippetsphpBB Snippets on RestlessRancor.com

Post Reply
User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

phpBB Snippets on RestlessRancor.com

#1

Post by Restless Rancor » October 16th, 2018, 7:26 am

 ! Message from: Restless Rancor
These code snippets come with no warranty.
We don't know your exact installation, so they may not work as they work for us, but we are happy to help you get them working if we can.
The Team will never ask for your personal login details for your forum, but may ask for a test account to be made for us to use. This will always be done via Private Message.
In phpBB 2 and 3.0.x developers provided add-ons to the base forum software in the form of modifications. These were installed line-by-line by adding the required code to each file.

In phpBB 3.1.x onwards, modifications became extensions which are click-to-install and they didn't modify the base files.

The code snippets in this forum follow the same method as 3.0.x modifications did for installation. I aim to learn and adapt these snippets into extensions, but have very little experience in extension writing. After work and college this will probably take some time- A seasoned developer could probably knock them all out in an afternoon.

Some of these code snippets are not my original content, but as they have been shared over multiple forums over the years it is hard to give credit to the original author.

If you are new to php, phpBB or even 'coding', we are happy to help you where we can.
  • Always make backups of the files and database.
    • These snippets do not change the database structure, unless they specifically state so.
    • If what you do causes errors on your forum, just upload your backups and try again.
  • Always edit files in a text editor which supports programming language, such as Notepad++ (never Notepad which comes pre-installed in Windows.
  • This guide provides the basics for what to do when told to "find" "add after" "add before" etc.
  • When a new version of phpBB is released take care when updating. It may "repair" your changed files during an automatic update meaning you'll need to make the changes again.
  • Style edits are for the styles/prosilver style (the default style for phpBB 3).
    • The majority of custom styles inherit key elements of prosilver.
    • If an edit is made to viewtopic_body.html it must also be made to your custom style's same file (if it has one).
  • Your forum's root folder is the top folder in the directory. It contains the config, ext, images and styles folders (as well as others).
  • Some portions of these snippets will overlap.
    • Most of the time you won't need to add code that you have already previously added.
    • An example of this can be found here with the 'Add After:' command:
      • 'U_POSTS' has already been added by this snippet.
If you are experienced in php/phpBB/'coding':
  • Please feel free to help out where you can.
  • Some of the code snippets on this forum have been combined and adapted from multiple searches, mainly from phpBB.com.
  • If you want to turn a snippet into an extension please feel free to do so.
    • I intend to try this myself, and if I get anywhere with it, a development topic will be made in the Extensions in development forum to track them.
    • If you do make an extension based on a snippet keep in mind some of them are not my original work.
    • If I get to creating a development topic it's possible the extension will be identical to your own. If it is I won't publish it to the customization database but will tick all of the boxes up until that point.
      • The entire point will be for me to learn the process.
Snippet downloads
  • I'm still figuring this one out...
  • Snippet downloads will be in the form of already-edited-files-ready-for-upload, but:
    • If you want to upload more than one snippet and they alter the same files you'll have to make the edits regardless, rendering the download pointless.
  • I may start with a download for individual snippets and then an "all snippets" download.
But that's what extensions are for!

I know! Refer back to the beginning of this topic :thumbsup:

The smallprint:
This forum isn't for phpBB support. We will always try to offer a helping hand, but don't be surprised if we simply direct you to phpBB Support.

Each snippet will make it clear what version of phpBB (and extensions if applicable) they have been tested on.
  • When new versions are release we'll re-test on the newer versions and update accordingly.
  • If a new version has been released and you do not see a message specifically stating it does not work on that version and it doesn't say it is tested on that version, we haven't tested it yet!
  • We're unlikely to test outdated versions of phpBB or extensions.
These code snippets come with no warranty.
We don't know your exact installation, so they may not work as they work for us, but we are happy to help you get them working if we can. Always keep backups so if things go wrong you can upload them to revert changes.


This forum is locked for new topics, but if you have a snippet you would like to share please send me a Private Message with the snippet included. I will test it and post it in this forum, changing the post author to your username.

We intend to post snippets for use by anyone and for free, but registration is required to view them. It is possible a donators group will be made on this forum which grants access to a donators only snippets forum, but there are no plans to do this just yet.


These aren't the droids you're looking for.

User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

#2

Post by Restless Rancor » October 16th, 2018, 6:17 pm

A quick note regarding Twig syntax:
I've started to use it in my snippets, as phpBB.com are recommending the switch.

It's only used for new code. Any existing phpBB <!-- IF --> statements that are altered in the snippets won't be fully converted and the new code will follow the same phpBB syntax.

phpBB are using it in the next major style, so it will be a while until the big switch- we probably won't see it until phpBB v4, though a 3.x release is a possibility.

When the time comes, I'll update snippets to correspond with phpBB's current practices.
These aren't the droids you're looking for.

Post Reply

Topic Subscribers

1 user subscribed to this topic: Restless Rancor