Jump to content

Featured Replies

Posted
comment_202136

Hello, how are you ? As I have no knowledge of programming, I asked ChatGPT to create a plugin for ip.board 4 for me, which would detect members who were using adblock and take this to the admin panel, and also display a message to subscribers and members who were using it, so chatgpt provided me with the following 3 files below, however, I don't know how to implement them, could anyone help me?:

 

Plugin XML:

<plugin>
    <title>Detect AdBlock Member and Visitant</title>
    <version>1.0.0</version>
    <author>Fantasma Verde</author>
    <url>https://steamverde.net</url>
    <description>Detecta se um membro está usando AdBlock e exibe esta informação no painel de administração. Além disso, exibe uma mensagem no frontend para visitantes e usuários cadastrados que estiverem usando AdBlock, avisando para desativá-lo.</description>
    <hooks>
        <templateHooks>
            <templateHook>
                <hookClass>ips_adblockdetector_hook_FrontEnd</hookClass>
                <position>footer</position>
            </templateHook>
        </templateHooks>
        <frontEndHooks>
            <frontEndHook>
                <hookClass>ips_adblockdetector_hook_FrontEnd</hookClass>
                <method>detectAdBlock</method>
                <location>global</location>
                <runOrder>0</runOrder>
            </frontEndHook>
        </frontEndHooks>
        <adminHooks>
            <adminHook>
                <hookClass>ips_adblockdetector_hook_AdminDashboard</hookClass>
                <method>widgets</method>
                <location>dashboard</location>
                <runOrder>0</runOrder>
            </adminHook>
        </adminHooks>
    </hooks>
    <fileHooks>
        <fileHook>
            <class>ips_adblockdetector_hook_FrontEnd</class>
            <method>detectAdBlock</method>
            <file>front/front.php</file>
        </fileHook>
        <fileHook>
            <class>ips_adblockdetector_hook_AdminDashboard</class>
            <method>widgets</method>
            <file>admin/dashboard.php</file>
        </fileHook>
    </fileHooks>
</plugin>

 

Frontend File (front/front.php):

<?php

class ips_adblockdetector_hook_FrontEnd extends _HOOK_CLASS_
{
    public function detectAdBlock()
    {
        ?>
        <script>
            // Função para detectar AdBlock
            function checkAdBlock() {
                var adBlockEnabled = false;
                var testAd = document.createElement('div');
                testAd.innerHTML = '&nbsp;';
                testAd.className = 'adblock-test';
                document.body.appendChild(testAd);
                window.setTimeout(function() {
                    if (!testAd.offsetHeight) {
                        adBlockEnabled = true;
                        // Exiba uma mensagem de aviso para os usuários
                        alert("Você está usando um bloqueador de anúncios. Por favor, desative-o para acessar o conteúdo.");
                    }
                    document.body.removeChild(testAd);
                }, 100);
            }

            // Chamada à função de verificação quando a página é carregada
            window.onload = function() {
                checkAdBlock();
            };
        </script>
        <?php
    }
}

 

Admin File (admin/dashboard.php):

<?php

use IPS\Db;

class ips_adblockdetector_hook_AdminDashboard extends _HOOK_CLASS_
{
    public function widgets()
    {
        $widgets = parent::widgets();

        // Adicione um novo widget ao painel de administração
        $widgets['adblock_users'] = [
            'title' => 'Usuários com AdBlock',
            'content' => $this->getAdblockUsers()
        ];

        return $widgets;
    }

    // Função para obter usuários com AdBlock
    protected function getAdblockUsers()
    {
        $db = Db::i();

        // Execute a consulta para obter usuários com AdBlock ativado
        $adblockUsers = $db->select('*', 'core_members', ['adblock' => 1]);

        $output = '<ul>';
        foreach ($adblockUsers as $user) {
            $output .= '<li>' . $user['name'] . '</li>';
        }
        $output .= '</ul>';

        return $output;
    }
}

 

comment_202142
2 часа назад, dfdgfgfsd сказал:

не помогайте ему, хочет адблок юзеров поймать! ты что делаеш!!

Монетизация вещь такая, что приходится делать все что угодно чтобы приносило прибыль 🤔 

  • Author
comment_202146
3 hours ago, dfdgfgfsd said:

не помогайте ему, хочет адблок юзеров поймать! ты что делаеш!!

Please note that I'm not asking for opinions on adblock and anti-adblock, I'm asking for help on a plugin.

  • Author
comment_202150
50 minutes ago, Zero108 said:

Попробуй активировать плагин в настройках плагина после установки.

I know how to activate it, but the plugin doesn't work, wouldn't I be able to use what I posted above generated by GPT? because I want to see which members use adblok too...

image.thumb.png.95e21a11d9ab13ae5ebc1fc5afd3b601.png

  • Author
comment_202152

Someone should really create a plugin to detect members who are using adblock and show it on the admin panel, in addition to showing a message on the frontend to all members and visitors who are also using adblock, I tried, but unfortunately as I don't have much knowledge, this project will die here...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.


Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.