Onforum.net - Web and gaming resource community

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members .

Xenforo 2 Copyright Footer Management

Sonia

Administrator
Administrator
Credits
1,338
This is a quick and dirty tutorial for how to automatically merge all copyright footers from your products into a single line, avoiding a situation where you have 5 mods released with 5 separate lines
Template Modifications

Template:
PAGE_CONTAINER
Modification Key: your_namespace_copyright_footer_display
Description: Copyright Footer
Search type: PHP Callback
Find: #({{ phrase\('extra_copyright'\) }})#si
Replace: Your\Namespace\Template\Callback\Copyright::insert
Execution order: 10


Code Event Listeners

Listen to event:
app_setup
Execute callback: Your\Namespace\Listener :: appSetup
Execution order: 10
Description: App setup


PHP

/src/Your/Namespace/Listener.php

PHP:
<?php

namespace Your\Namespace;

class Listener
{
    /**
     * The product ID (in the store)
     * @var integer
     */
    protected static $_productId = 0;

    /**
     * @param \XF\App $app
     */
    public static function appSetup(
        \XF\App $app
    )
    {
        if (!$app->offsetExists('prefix_branding_free'))
        {
            // Make sure we fetch the branding array from the application
            $branding = $app->offsetExists('prefix_branding') ? $app->prefix_branding : [];
        
            // Add productid to the array
            $branding[] = self::$_productId;
        
            // Store the branding
            $app->prefix_branding = $branding;
        }
    }
}

(Replace prefix with the vendor prefix (e.g. dbtech is ours, normally it's the "your" part of the "Your\Namespace" replacement.)

/src/Your/Namespace/Template/Callback/Copyright.php


View hidden content is available for registered users!
(Replace prefix with the vendor prefix (e.g. dbtech is ours, normally it's the "your" part of the "Your\Namespace" replacement. Also, replace the www.yoursite.com links with the links to your actual website. Also, replace "YourCompany" with the name of your company. Lastly, either create the details.php page that accepts product IDs as parameters to display a list of the products that site is running, or remove that entire parenthesis section altogether.)
 
Thread starter Similar threads Forum Replies Date
Sonia Tutorials 0

Similar threads


Top

Dear User!

We found that you are blocking the display of ads on our site.

Please add it to the exception list or disable AdBlock.

The advertises that you'll see aren't intrusive they just help us to keep the community alive

If you don't want to see those ads just buy an upgrade.

Thank you for understanding!

Baba2

Baba2 Purchase

User upgrade! at

🔥 Upgrade Now

Escanor25 Purchase

User upgrade! at

🔥 Upgrade Now
Tigrex

Tigrex Purchase

User upgrade! at

🔥 Upgrade Now