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

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

Previous topic - Next topic

ɔɔɔɔɔɔuɥoɾ

Quote from: Ken. on July 31, 2010, 11:33:09 AM
My first edit was only to the ManageSettings.php file, but after posting I reviewed the xml file and found the other edits that are needed to make the extra subs show up and work in the buttons cp.

My forum already has too many 'main' buttons, that's the reason for attempting to put in the extra subs for this Custom Button.

Well, what I would recommend is to hard code some extra buttons in Subs.php, just remember to remove them if you want to uninstall the mod, I can give you an example if you want?


SMF 2.0 RC5

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

Ken.

Quote from: johncccccc on July 31, 2010, 11:21:48 AM
Quote from: Ken. on July 31, 2010, 11:16:54 AM
Very nice johncccccc.  8)

What edits can we do to add subs to a button? (I'm trying to only run one button, but with 6-8 subs)
I tried copying #4 in the "$sourcedir/ManageSettings.php" file and setting it as #5 but that didn't work.

Thanks... Ken.


Well, I could probably add more menu items, however, see the background image for them menu does not let enough for a long list of menu items, the bottom of them menu would become transparent, if a custom theme has a black background under the drop down menu, then you will not be able to see the text, until you hover that is.

On the other hand, it is completely possible and will work

By the way..

What exactly did you try to change... ???

With just the one button activated and using all 4 subs the bg looks good on my site, haven't done the edits for subs yet, so I don't know how that's going to look.

It's the 'Extra-Pages' link:
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum;theme=76
So far it's only been tested in this one theme and the SMF Default.

Examples would be good, or I can just use the xml file as a guide to add the extra code where needed.

ɔɔɔɔɔɔuɥoɾ

#22
I just checked the CSS properties for your menu background in that theme, and you could have infinite amount of menu items as it does not use a background image :)

to add buttons hard coded, or to the xml (I would recommend since u can install it easily then)
Code (Find in Subs.php) Select

                '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
                        ),
                    ),                       
            ),


Code (Difference is) Select

                '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' => 'hard coded title here', // This is the button label
                        'href' => 'hard coded URL here', //this is the URL link.
                        'show' => true,
                        ),
                    'subbutton6' => array(
                        'title' => 'hard coded title here', // This is the button label
                        'href' => 'hard coded URL here', //this is the URL link.
                        'show' => true,
                        ),

                    ),                       
            ),


The ones you add are the hard coded ones...

Also, if you have too many buttons, that are unused, check out my Add or Remove buttons mod
http://custom.simplemachines.org/mods/index.php?mod=2650
You can make room for more useful buttons then ;)


SMF 2.0 RC5

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

Ken.

Thanks, I'll work on this again in a bit, Kay is making a BIG breakfast for the g-kids and me, so...  ;D

TheListener

Quote from: Ken. on July 31, 2010, 11:58:23 AM
Thanks, I'll work on this again in a bit, Kay is making a BIG breakfast for the g-kids and me, so...  ;D


Ooh you piggies.

Hope you're gonna share.

Ken.

Quote from: Brack1 on July 31, 2010, 12:04:06 PM
Quote from: Ken. on July 31, 2010, 11:58:23 AM
Thanks, I'll work on this again in a bit, Kay is making a BIG breakfast for the g-kids and me, so...  ;D


Ooh you piggies.

Hope you're gonna share.

It will all be over before you can get here.

Sad_Angel

Working fine, but how can i change position,  i just want that button to be after HOME, currently it is next to HELP.

Thanks
Peace...

TheListener


ɔɔɔɔɔɔuɥoɾ

Quote from: Sad_Angel on July 31, 2010, 12:10:23 PM
Working fine, but how can i change position,  i just want that button to be after HOME, currently it is next to HELP.

Thanks

This mod does not have that feature, sorry.
Maybe in a future version.


SMF 2.0 RC5

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

Sad_Angel

i am using RC3

@ √®╠╣∩©Ç瀫, fine I'll keep it as it is, no problem at all.
Peace...

Hj Ahmad Rasyid Hj Ismail

Quote from: Sad_Angel on July 31, 2010, 12:10:23 PM
Working fine, but how can i change position,  i just want that button to be after HOME, currently it is next to HELP.

Thanks
You should be able to do that by manually moving the position of this whole code in Subs.php instead of after search to after home:

            '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' => !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
                        ),
                    ),                       
            ),
            'custom2' => array(
                'title' => !empty ($modSettings['label_custombuttons_2']) ? $modSettings['label_custombuttons_2'] : $txt['cb_default_2'],
                'href' => !empty ($modSettings['url_custombuttons_2']) ? $modSettings['url_custombuttons_2'] : $scripturl,
                'show' => !empty ($modSettings['enable_custombuttons_2']) ? true : false,
                'sub_buttons' => array(
                    'subbutton1' => array(
                    'title' => !empty ($modSettings['label_subcustombuttons2_1']) ? $modSettings['label_subcustombuttons2_1'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons2_1']) ? $modSettings['url_subcustombuttons2_1'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons2_1']) ? true : false
                        ),
                    'subbutton2' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons2_2']) ? $modSettings['label_subcustombuttons2_2'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons2_2']) ? $modSettings['url_subcustombuttons2_2'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons2_2']) ? true : false
                        ),                       
                    'subbutton3' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons2_3']) ? $modSettings['label_subcustombuttons2_3'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons2_3']) ? $modSettings['url_subcustombuttons2_3'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons2_3']) ? true : false
                        ),
                    'subbutton4' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons2_4']) ? $modSettings['label_subcustombuttons2_4'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons2_4']) ? $modSettings['url_subcustombuttons2_4'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons2_4']) ? true : false
                    ),
                ),
            ),
            'custom3' => array(
                'title' => !empty ($modSettings['label_custombuttons_3']) ? $modSettings['label_custombuttons_3'] : $txt['cb_default_3'],
                'href' => !empty ($modSettings['url_custombuttons_3']) ? $modSettings['url_custombuttons_3'] : $scripturl,
                'show' => !empty ($modSettings['enable_custombuttons_3']) ? true : false,
                'sub_buttons' => array(
                    'subbutton1' => array(
                    'title' => !empty ($modSettings['label_subcustombuttons3_1']) ? $modSettings['label_subcustombuttons3_1'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons3_1']) ? $modSettings['url_subcustombuttons3_1'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons3_1']) ? true : false
                        ),
                    'subbutton2' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons3_2']) ? $modSettings['label_subcustombuttons3_2'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons3_2']) ? $modSettings['url_subcustombuttons3_2'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons3_2']) ? true : false
                        ),                       
                    'subbutton3' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons3_3']) ? $modSettings['label_subcustombuttons3_3'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons3_3']) ? $modSettings['url_subcustombuttons3_3'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons3_3']) ? true : false
                        ),
                    'subbutton4' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons3_4']) ? $modSettings['label_subcustombuttons3_4'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons3_4']) ? $modSettings['url_subcustombuttons3_4'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons3_4']) ? true : false
                    ),
                ),
            ),
            'custom4' => array(
                'title' => !empty ($modSettings['label_custombuttons_4']) ? $modSettings['label_custombuttons_4'] : $txt['cb_default_4'],
                'href' => !empty ($modSettings['url_custombuttons_4']) ? $modSettings['url_custombuttons_4'] : '',
                'show' => !empty ($modSettings['enable_custombuttons_4']) ? true : false,
                'sub_buttons' => array(
                    'subbutton1' => array(
                    'title' => !empty ($modSettings['label_subcustombuttons4_1']) ? $modSettings['label_subcustombuttons4_1'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons4_1']) ? $modSettings['url_subcustombuttons4_1'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons4_1']) ? true : false
                        ),
                    'subbutton2' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons4_2']) ? $modSettings['label_subcustombuttons4_2'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons4_2']) ? $modSettings['url_subcustombuttons4_2'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons4_2']) ? true : false
                        ),                       
                    'subbutton3' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons4_3']) ? $modSettings['label_subcustombuttons4_3'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons4_3']) ? $modSettings['url_subcustombuttons4_3'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons4_3']) ? true : false
                        ),
                    'subbutton4' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons4_4']) ? $modSettings['label_subcustombuttons4_4'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons4_4']) ? $modSettings['url_subcustombuttons4_4'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons4_4']) ? true : false
                    ),
                ),
            ),
            'custom5' => array(
                'title' => !empty ($modSettings['label_custombuttons_5']) ? $modSettings['label_custombuttons_5'] : $txt['cb_default_5'],
                'href' => !empty ($modSettings['url_custombuttons_5']) ? $modSettings['url_custombuttons_5'] : '',
                'show' => !empty ($modSettings['enable_custombuttons_5']) ? true : false,
                'sub_buttons' => array(
                    'subbutton1' => array(
                    'title' => !empty ($modSettings['label_subcustombuttons5_1']) ? $modSettings['label_subcustombuttons5_1'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons5_1']) ? $modSettings['url_subcustombuttons5_1'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons5_1']) ? true : false
                        ),
                    'subbutton2' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons5_2']) ? $modSettings['label_subcustombuttons5_2'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons5_2']) ? $modSettings['url_subcustombuttons5_2'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons5_2']) ? true : false
                        ),                       
                    'subbutton3' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons5_3']) ? $modSettings['label_subcustombuttons5_3'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons5_3']) ? $modSettings['url_subcustombuttons5_3'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons5_3']) ? true : false
                        ),
                    'subbutton4' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons5_4']) ? $modSettings['label_subcustombuttons5_4'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons5_4']) ? $modSettings['url_subcustombuttons5_4'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons5_4']) ? true : false
                    ),
                ),
            ),
            'custom6' => array(
                'title' => !empty ($modSettings['label_custombuttons_6']) ? $modSettings['label_custombuttons_6'] : $txt['cb_default_6'],
                'href' => !empty ($modSettings['url_custombuttons_6']) ? $modSettings['url_custombuttons_6'] : '',
                'show' => !empty ($modSettings['enable_custombuttons_6']) ? true : false,
                'sub_buttons' => array(
                    'subbutton1' => array(
                    'title' => !empty ($modSettings['label_subcustombuttons6_1']) ? $modSettings['label_subcustombuttons6_1'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons6_1']) ? $modSettings['url_subcustombuttons6_1'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons6_1']) ? true : false
                        ),
                    'subbutton2' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons6_2']) ? $modSettings['label_subcustombuttons6_2'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons6_2']) ? $modSettings['url_subcustombuttons6_2'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons6_2']) ? true : false
                        ),                       
                    'subbutton3' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons6_3']) ? $modSettings['label_subcustombuttons6_3'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons6_3']) ? $modSettings['url_subcustombuttons6_3'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons6_3']) ? true : false
                        ),
                    'subbutton4' => array(
                        'title' => !empty ($modSettings['label_subcustombuttons6_4']) ? $modSettings['label_subcustombuttons6_4'] : '',
                        'href' => !empty ($modSettings['url_subcustombuttons6_4']) ? $modSettings['url_subcustombuttons5_4'] : $scripturl,
                        'show' => !empty ($modSettings['label_subcustombuttons6_4']) ? true : false
                    ),
                ),
            ),


To John, a very nice and useful mod indeed.

ɔɔɔɔɔɔuɥoɾ

You can quiet easily, but with the amount of sub menus involved it would be very easy to mess up the arrays and end up with no forum lol


SMF 2.0 RC5

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

Hj Ahmad Rasyid Hj Ismail

Lol... quite right... Hopefully, he do not need to use all the six extra menu... Otherwise manually modding Subs.php will be better.

Ken.

Thanks for those hard code edits... that works very.  :)

Your 'Add or Remove Buttons' will also be useful.

ɔɔɔɔɔɔuɥoɾ

Quote from: Ken. on July 31, 2010, 02:10:09 PM
Thanks for those hard code edits... that works very.  :)

Your 'Add or Remove Buttons' will also be useful.

Your welcome, Enjoy :)


SMF 2.0 RC5

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

Bugo

Russian translation. Please use both (!) files (ANSI & UTF-8 charsets).

Grim Line

Smf 2.0RC3

1.     Execute Modification     ./Sources/Admin.php     Test failed
      1.    Add After    ./Sources/Admin.php    Test failed

All others are successful.

YogiBear

Grim Line, make sure you have the very latest release of the mod.

See the Changelog at the bottom of this page...

http://custom.simplemachines.org/mods/index.php?mod=2657
SMF v2.1.4  Mods : Snow & Garland v1.4, Simple Image Upload v2.0.0,  PHP  v.8.1

ɔɔɔɔɔɔuɥoɾ

Quote from: Grim Line on August 01, 2010, 10:44:10 AM
Smf 2.0RC3

1.     Execute Modification     ./Sources/Admin.php     Test failed
      1.    Add After    ./Sources/Admin.php    Test failed

All others are successful.

Attach your Admin.php file :)


SMF 2.0 RC5

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

ɔɔɔɔɔɔuɥoɾ

Quote from: Bugo on August 01, 2010, 07:54:25 AM
Russian translation. Please use both (!) files (ANSI & UTF-8 charsets).

I will add to the next version, thanks..


SMF 2.0 RC5

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

Advertisement: