TinyPortal

Development => Support => Topic started by: davo88 on April 29, 2024, 10:31:24 PM

Title: How to disable TinyPortal menu option in members' profile
Post by: davo88 on April 29, 2024, 10:31:24 PM
I would like to disable the TinyPortal menu option that appears in members' profiles.

Snag_2cd42937.png

So far, 'Hide TinyPortal menu option' has been enabled in TP General Settings.

Snag_2cd5a0f3.png

And 'ShowTPdownloads' has been turned off in TPdownloads > Settings

Snag_2cd6e896.png

But I am unable to find any further options that might remove that menu from the Profile.
Title: Re: How to disable TinyPortal menu option in members' profile
Post by: @rjen on May 01, 2024, 09:10:36 PM
No option to do that. You can try removing this section from Integrate.php

    public static function hookProfileArea(&$profile_areas)
    {
        global $txt, $context;

        $profile_areas['tp'] = array(
            'title' => 'TinyPortal',
            'areas' => array(),
        );

        $profile_areas['tp']['areas']['tpsummary'] = array(
            'label' => $txt['tpsummary'],
            'file' => 'TPSubs.php',
            'function' => 'tp_summary',
            'icon' => 'menu_tp',
            'permission' => array(
                'own' => 'profile_view_own',
                'any' => 'profile_view_any',
            ),
        );

        if (!$context['TPortal']['use_wysiwyg']=='0') {
            $profile_areas['tp']['areas']['tparticles'] = array(
                'label' => $txt['articlesprofile'],
                'file' => 'TPSubs.php',
                'function' => 'tp_articles',
                'icon' => 'menu_tparticle',
                'permission' => array(
                    'own' => 'profile_view_own',
                    'any' => 'profile_view_any',
                ),
                'subsections' => array(
                    'articles' => array($txt['tp-articles'], array('profile_view_own', 'profile_view_any')),
                    'settings' => array($txt['tp-settings'], array('profile_view_own', 'profile_view_any')),
                ),
            );
        }
        else {
            $profile_areas['tp']['areas']['tparticles'] = array(
                'label' => $txt['articlesprofile'],
                'file' => 'TPSubs.php',
                'function' => 'tp_articles',
                'icon' => 'menu_tparticle',
                'permission' => array(
                    'own' => 'profile_view_own',
                    'any' => 'profile_view_any',
                ),
            );
        }

        if(!empty($context['TPortal']['show_download'])) {
            $profile_areas['tp']['areas']['tpdownload'] = array(
                'label' => $txt['downloadsprofile'],
                'file' => 'TPSubs.php',
                'function' => 'tp_download',
                'icon' => 'menu_tpdownload',
                'permission' => array(
                    'own' => 'profile_view_own' && !empty($context['TPortal']['show_download']),
                    'any' => 'profile_view_any' && !empty($context['TPortal']['show_download']),
                ),
            );
        }

        if(!$context['TPortal']['profile_shouts_hide']) {
            $profile_areas['tp']['areas']['tpshoutbox'] = array(
                'label' => $txt['shoutboxprofile'],
                'file' => 'TPShout.php',
                'function' => 'tp_shoutb',
                'icon' => 'menu_tpshout',
                'permission' => array(
                    'own' => 'profile_view_own',
                    'any' => 'profile_view_any',
                ),
            );
        }
    }
Title: Re: How to disable TinyPortal menu option in members' profile
Post by: davo88 on May 01, 2024, 11:47:47 PM
Thanks @rjen. We got a couple of error messages in the log after commenting that section out.
Hook call: function "TinyPortal\Integrate::hookProfileArea" in file /home/... could not be called.The callable TinyPortal\Integrate::hookProfileArea could not be called.Taking out this line out seems to have addressed those and there has been no more errors so far. Will keep an eye on it though.
        $hooks['pre_profile_areas']     = 'TinyPortal\Integrate::hookProfileArea';
A setting for this could be a good candidate for future versions. When introducing TP to a long running forum-only site, it will take a while for members (and me) to adjust and manage all the new features. So being able to slow that process down and roll things out in stages is very good. Thanks again for posting your fix.
Title: Re: How to disable TinyPortal menu option in members' profile
Post by: @rjen on May 02, 2024, 05:42:10 AM
Sorry, should have thought about that. Just taking out the line would have been sufficient