• Home
  • About 404TS
  • Contact

404 Tech Support

Where IT Help is Found

  • Articles
    • Code
    • Entertainment
    • Going Green
    • Hardware, Gadgets, and Products
    • Management
    • Network
    • News
    • Operating Systems
    • Security and Privacy
    • Software
    • System Administration
    • Talking Points
    • Tech Solutions
    • Web
    • Webmaster
  • Reviews
  • Media
    • Infographics
    • Videos
  • Tech Events
  • Tools
    • How do I find my IP address?
    • Browser and plugin tests
  • Get a Technical Consultation
You are here: Home / Articles / Tech Solutions / Ask 404TS: How do I expand your phpBB mods to work for the Subsilver2 theme?

Ask 404TS: How do I expand your phpBB mods to work for the Subsilver2 theme?

2009-12-21 by Jason

ask404tsI’ve written two unofficial mods for phpBB3 forums previously that worked very well for those using the Prosilver theme, the MP3 inline attachment mod and the FLV inline attachment mod. Recently, I was asked in the forums how to make them work for the Subsilver2 theme, the other popular theme that many styled themes are based on. After puzzling on it for a long time and decoding the makeup of the Subsilver2 theme, I figured out a way to make it reliably work. Installing this mod will allow you to place inline .flv or .mp3 files to be played streaming with a simple Flash player.

Implementing this mod is much easier if you have a basic understanding of PHP and Javascript. You can learn more about php and computers at the Computer Systems Institute. The Prosilver theme is much easier to work with than the Subsilver2 theme, particularly with the part I am modifying, because it builds the command it directly wants to call from an array of variables. For example, this button is built with the Javascript variables Value1 and Value2:

<input type="button" value="{L_PLACE_INLINE}" onclick="attach_inline({Value1}, '{Value2}');" />

and I’m able to just add a third comma-separated value in there with the info I need.

Whereas with the Subsilver 2 theme, it seems to cheat a bit. It uses the information to build a drop-down box and the ‘Place Inline’ button then derives the information from the drop-down box for the attachment index. To get by this, we’re going to have to pass along the attachment ID in with the Filename and then split it apart later in the process.

Just like the Prosilver version of these mods, we only have two files to edit, although they are different files. To append the attachment ID onto the filename, we’ll need to open:

phpBBroot/includes/functions_posting.php

Find:

$s_inline_attachment_options .= '' . utf8_basename($attachment['real_filename']) . '';

Replace with:

$s_inline_attachment_options .= '' . utf8_basename($attachment['real_filename']) .  ',' . $attachment['attach_id'] . '';

The attachment ID and a comma are being appended to the usual drop-down option box code. This means, your end users will see the attachment ID in the drop-down and we’ll split the values apart later along the comma.

To do that, we need to open:

phpBBroot/styles/subsilver2/template/editor.js

Find:

    /**
    * Add inline attachment at position
    */
    function attach_inline(index, filename)
    {
    insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
    document.forms[form_name].elements[text_name].focus();
    }

Replace with:

    /**
    * Add inline attachment at position
    */
    function attach_inline(index, filenameID)
       {
          var splitresults = filenameID.split(",");
          var filename = splitresults[0];
          var attach_id = splitresults[1];

       if (filename.match(".mp3"))
       {
          insert_text('[mp3]' +'http://yourforumURL.com/download/file.php?id=' + attach_id +'[/mp3]'+'   ' + filename);
          document.forms[form_name].elements[text_name].focus();
       }
       else if (filename.match(".flv"))
       {
	    insert_text('[flv]' +'http://yourforumURL.com/download/file.php?id=' + attach_id +'.flv[/flv]');
		document.forms[form_name].elements[text_name].focus();
       }
       else
       {
          insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
          document.forms[form_name].elements[text_name].focus();
       }
    }

In the above code, don’t forget to update the yourforumURL.com path to be your domain name.

As long as you have the MP3 and FLV BBCodes and the players on your server, which you can find in the previous articles, you should be all set.

If you’re running a board where Prosilver and Subsilver2 themes might be in mixed company, you’ll need to use the top eight lines in the editor.js file under the prosilver template directory.

Because of complications like this when running a phpBB board with multiple styles, I don’t have a demo to show.

Filed Under: Tech Solutions, Webmaster

Trending

  • Artist’s Friendly Rendition of HTTPS
    In Entertainment, Security and Privacy
  • Book Review – Blockchain Revolution: How the Technology Behind Bitcoin Is Changing Money, Business, and the World
    In Hardware, Gadgets, and Products, Reviews
  • PDFVoid – Don’t Send a Malicious PDF
    In Media, Security and Privacy

Latest Media Posts

Find Out Where To Download SNES ROMs

Find Out Where To Download SNES ROMs

Multifunctional Video Conversion Tools – Wondershare Video Converter

Multifunctional Video Conversion Tools – Wondershare Video Converter

  • Popular
  • Latest
  • Today Week Month All
  • How to ‘Unblock’ multiple files at a time with PowerShell How to 'Unblock' multiple files at a time with PowerShell
  • Command line to take ownership and change permissions Command line to take ownership and change permissions
  • Increase IIS Private Memory Limit to improve WSUS availability Increase IIS Private Memory Limit to improve WSUS availability
  • SOLVED: “This modification is not allowed because the selection is locked.” SOLVED: "This modification is not allowed because the selection is locked."
  • Creating and editing views in phpMyAdmin Creating and editing views in phpMyAdmin
  • customer contactless payment for drink with mobile phon at cafe counter bar,seller coffee shop accept payment by mobile.new normal lifestyle concept The Latest Innovations In Payment Technology
  • How Digital Technology Brought the Rise of the CMO   How Digital Technology Brought the Rise of the CMO  
  • How to Purchase Cryptocurrencies? How to Purchase Cryptocurrencies?
  • Top 6 necessary aspects to consider when hiring Angular developers Top 6 necessary aspects to consider when hiring Angular developers
  • Full guide on drawbacks and benefits of Node.js for making the perfect choice for your business Full guide on drawbacks and benefits of Node.js for making the perfect choice for your business
Ajax spinner

Elevator Pitch

404 Tech Support documents solutions to IT problems, shares worthwhile software and websites, and reviews hardware, consumer electronics, and technology-related books.

Subscribe to 404TS articles by email.

Recent Posts

  • The Latest Innovations In Payment Technology
  • How Digital Technology Brought the Rise of the CMO  
  • How to Purchase Cryptocurrencies?

Search

FTC Disclaimer

404TechSupport is an Amazon.com affiliate; when you click on an Amazon link from 404TS, the site gets a cut of the proceeds from whatever you buy. This site also uses Skimlinks for smart monetization of other affiliate links.
Use of this site requires displaying and viewing ads as they are presented.

Copyright © 2023 · Magazine Pro Theme on Genesis Framework · WordPress · Log in