News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

6 Custom buttons / tabs and menu's (upto 4)

Started by ɔɔɔɔɔɔuɥoɾ, July 26, 2010, 03:35:28 PM

Previous topic - Next topic

Inti31

Have a look to the    <file name="$sourcedir/ManageSettings.php"> in the 6custombuttons4.xml is included in the package


        //Custom Buttons - Johncccccc
                //Button 1
                $txt['button1'],
        array('check', 'enable_custombuttons_1'),
        array('text', 'label_custombuttons_1'), array('text', 'url_custombuttons_1'),
                //Subs for button 1 - 8
        array('text', 'label_subcustombuttons1_1'), array('text', 'url_subcustombuttons1_1'),       
        array('text', 'label_subcustombuttons1_2'), array('text', 'url_subcustombuttons1_2'),       
        array('text', 'label_subcustombuttons1_3'), array('text', 'url_subcustombuttons1_3'),       
        array('text', 'label_subcustombuttons1_4'), array('text', 'url_subcustombuttons1_4'),       
        array('text', 'label_subcustombuttons1_5'), array('text', 'url_subcustombuttons1_5'),       
        array('text', 'label_subcustombuttons1_6'), array('text', 'url_subcustombuttons1_6'),       
        array('text', 'label_subcustombuttons1_7'), array('text', 'url_subcustombuttons1_7'),       
        array('text', 'label_subcustombuttons1_8'), array('text', 'url_subcustombuttons1_8'),



then see    <file name="$sourcedir/Subs.php">

            'custom1' => array(
                'title' => !empty ($modSettings['label_custombuttons_1']) ? $modSettings['label_custombuttons_1'] : $txt['cb_default_1'],
                'href' => !empty ($modSettings['url_custombuttons_1']) ? $modSettings['url_custombuttons_1'] : $scripturl,
                'show' => $context['allow_custom_button1'] && !empty ($modSettings['enable_custombuttons_1']) ? true : false,
                'sub_buttons' => array(
                    'subbutton1' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons1_1']) ? $modSettings['label_subcustombuttons1_1'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons1_1']) ? $modSettings['url_subcustombuttons1_1'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons1_1']) ? true : false
                        ),
                    'subbutton2' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons1_2']) ? $modSettings['label_subcustombuttons1_2'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons1_2']) ? $modSettings['url_subcustombuttons1_2'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons1_2']) ? true : false
                        ),                       
                    'subbutton3' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons1_3']) ? $modSettings['label_subcustombuttons1_3'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons1_3']) ? $modSettings['url_subcustombuttons1_3'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons1_3']) ? true : false
                        ),
                    'subbutton4' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons1_4']) ? $modSettings['label_subcustombuttons1_4'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons1_4']) ? $modSettings['url_subcustombuttons1_4'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons1_4']) ? true : false
                        ),
                    'subbutton5' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons1_5']) ? $modSettings['label_subcustombuttons1_5'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons1_5']) ? $modSettings['url_subcustombuttons1_5'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons1_5']) ? true : false
                        ),
                    'subbutton6' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons1_6']) ? $modSettings['label_subcustombuttons1_6'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons1_6']) ? $modSettings['url_subcustombuttons1_6'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons1_6']) ? true : false
                        ),
                    'subbutton7' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons1_7']) ? $modSettings['label_subcustombuttons1_7'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons1_7']) ? $modSettings['url_subcustombuttons1_7'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons1_7']) ? true : false
                        ),
                    'subbutton8' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons1_8']) ? $modSettings['label_subcustombuttons1_8'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons1_8']) ? $modSettings['url_subcustombuttons1_8'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons1_8']) ? true : false
                        ),
                    ),                       
            ),


at least: you need the language strings this section    
<file name="$themedir/languages/Modifications.yourlanguage(-utf8).php">


    //Sub button 5
$txt['label_subcustombuttons1_5'] = '5th sub custom title';
$txt['url_subcustombuttons1_5'] = 'URL for 5th sub custom title';
    //Sub button 6
$txt['label_subcustombuttons1_6'] = '6th sub custom title';
$txt['url_subcustombuttons1_6'] = 'URL for 6th sub custom title';
    //Sub button 7
$txt['label_subcustombuttons1_7'] = '7th sub custom title';
$txt['url_subcustombuttons1_7'] = 'URL for 7th sub custom title';
    //Sub button 8
$txt['label_subcustombuttons1_8'] = '8th sub custom title';
$txt['url_subcustombuttons1_8'] = 'URL for 8th sub custom title';
    //End of button 1 and its sub menu items


cheers Inti31
my forum
my testforum


my mods - which I only made them work for 2.0 Gold:
Topics Filter v3.2 SMF 2.0 Gold
MemberNumber

trekkie2444

I'm guessing I have to enter the URLs myself in that last code block you put?

Inti31

no, the urls you have to set in the admin area http:\\yourforum.url\index.php?action=admin;area=modsettings;sa=custombuttons;

my forum
my testforum


my mods - which I only made them work for 2.0 Gold:
Topics Filter v3.2 SMF 2.0 Gold
MemberNumber

Sweetwater

Is there any upgrade in the pipeline for SMF2.0.2

I used this mod before upgrading, was very useful.

Thanks for any replies

TheListener

Quote from: Sweetwater on June 17, 2012, 10:03:43 AM
Is there any upgrade in the pipeline for SMF2.0.2

I used this mod before upgrading, was very useful.

Thanks for any replies

No need to wait.

The mod works perfectly on 2.0.2

Have a look @ the Mod Emulate link in my signature.

ɔɔɔɔɔɔuɥoɾ

This is why I keep my mods script basic, instead of advanced code which nobody can understand, its simple code, it may be alot of code, but the simplicity of it makes it work even when other things around it change.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Matthew K.

What? Sorry, but that doesn't make a whole lot of sense.

You can write advanced code that hooks into SMF using various hacking methods.

ɔɔɔɔɔɔuɥoɾ

I mean the PHP functions I use do not really require anything from SMF coding, so when things change in new versions my mods should continue to work where other more advanced mods may fail when SMF is updated. My logic may not be perfect, I may not be correct, but I believe making code as simple as possible is best for any mod.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Matthew K.

I missunderstood your previous post then :)

ɔɔɔɔɔɔuɥoɾ



SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

TheListener


Sweetwater

Quote from: Old Fossil on June 21, 2012, 07:42:10 PM
Quote from: Sweetwater on June 17, 2012, 10:03:43 AM
Is there any upgrade in the pipeline for SMF2.0.2

I used this mod before upgrading, was very useful.

Thanks for any replies

No need to wait.

The mod works perfectly on 2.0.2

Have a look @ the Mod Emulate link in my signature.

Thankyou for the info, I wasn't aware of that feature.

Tried it & unfortunately it came up with an error on install using the emulator also.

Oh well, will have to wait for the update I guess.

Thanks

Inti31

i don't think you will see an update because this mod works fine in 2.0.2
my forum
my testforum


my mods - which I only made them work for 2.0 Gold:
Topics Filter v3.2 SMF 2.0 Gold
MemberNumber

ɔɔɔɔɔɔuɥoɾ

Quote from: Sweetwater on June 25, 2012, 11:27:56 AM
Quote from: Old Fossil on June 21, 2012, 07:42:10 PM
Quote from: Sweetwater on June 17, 2012, 10:03:43 AM
Is there any upgrade in the pipeline for SMF2.0.2

I used this mod before upgrading, was very useful.

Thanks for any replies

No need to wait.

The mod works perfectly on 2.0.2

Have a look @ the Mod Emulate link in my signature.

Thankyou for the info, I wasn't aware of that feature.

Tried it & unfortunately it came up with an error on install using the emulator also.

Oh well, will have to wait for the update I guess.

Thanks

If it has worked for someone else using 2.02, then it should work for you, its likely because another mod you have has edited one of the hooks that this mod uses to add code after. I intentionally use hooks that should not ever be changed, thus making for zero errors, one of the mods you have installed may have changed one of those hooks, which errors are you getting, try again with NO emulation and post here which files are giving you the errors, expand the error files and check which edits are effected, then we can see where the modified hook is and see why its failing.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

usa4all

Gr8 mod, works fine in my 2.02. SMF..

Question: IS it possible to open (some) links in a new window?  And how will I do that?

Inti31

Hi!
This is not a big deal and easy to implement...

you need only that:
'target' => '_blank',

Example:
Have a look to /Sources/Subs.php to my 8th custom button code

            'custom8' => array(
                'title' => !empty ($modSettings['label_custombuttons_8']) ? $modSettings['label_custombuttons_8'] : $txt['cb_default_8'],
                'target' => '_blank',
                'href' => !empty ($modSettings['url_custombuttons_8']) ? $modSettings['url_custombuttons_8'] : $scripturl,
                'show' => $context['allow_custom_button8'] && !empty ($modSettings['enable_custombuttons_8']) ? true : false,
                'sub_buttons' => array(
                    'subbutton1' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons8_1']) ? $modSettings['label_subcustombuttons8_1'] : '',
                        'target' => '_blank',
                        'href' => !empty ($modSettings['url_subcustombuttons8_1']) ? $modSettings['url_subcustombuttons8_1'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons8_1']) ? true : false
                        ),


That opens the main link in a new window, also the first subbutton...

cheers Inti31
my forum
my testforum


my mods - which I only made them work for 2.0 Gold:
Topics Filter v3.2 SMF 2.0 Gold
MemberNumber

usa4all


ɔɔɔɔɔɔuɥoɾ

Just remember to restore to stock coding 1st if you decide to uninstall the mod, or else it will fail to uninstall, because of the edit.

This should have been implemented, but I just do not have the time.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Kaitlyn

how do I hide these buttons from guests only visible if your logged into our forum

Inti31

in the permission area you've to uncheck the buttons should not be visible for guest.

http://url.com/index.php?action=admin;area=permissions;sa=modify;group=-1;view=classic
my forum
my testforum


my mods - which I only made them work for 2.0 Gold:
Topics Filter v3.2 SMF 2.0 Gold
MemberNumber

Advertisement: