Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: JPA on July 28, 2010, 01:11:07 PM

Title: Want home menu button to default to forum
Post by: JPA on July 28, 2010, 01:11:07 PM
Hello, I'm looking to set my menu to have the frontpage display for all guests and unlogged users via the home menu button, and I would like to be able to have the the home menu button point to the forum for all users once they are logged in.  Any help or suggestions would be appreciated.
Title: Re: Want home menu button to default to forum
Post by: Matthew K. on July 28, 2010, 01:13:10 PM
If I am understanding this correctly, you have a homepage, which is where you want the forums "Home" button to link to, and if they're logged in, the home button should link to the actual forums home?
Title: Re: Want home menu button to default to forum
Post by: JPA on July 28, 2010, 01:22:20 PM
Yes, I want to Have the home menu button link to the forum index, "/index.php?action=forum" for all logged in users. and have the menu button point to the frontpage for all guests and non logged in users
Title: Re: Want home menu button to default to forum
Post by: Matthew K. on July 28, 2010, 01:27:26 PM
./Sources/Subs.php
Code (Find) Select

$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),

Code (Replace) Select

$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),
'home' => array(
'title' => $txt['home'],
'href' => 'http://www.yourdomainroothere.com/',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),

That *should* work for you.
Title: Re: Want home menu button to default to forum
Post by: JPA on July 28, 2010, 01:56:28 PM
Thanks, I'll have to give that a shot tonight.  Off to my 'OTHER' job lol.  I'll post my results ;)
Title: Re: Want home menu button to default to forum
Post by: JPA on July 29, 2010, 12:45:43 AM
This created a new button.  My apologies for not being more clear.  On the forum there is a front page that displays, that is linked to the home menu button, what I'd like to accomplish is once users log in to have the forum display, not the front page, and have the home menu button point to the forum instead of the front page. 
Title: Re: Want home menu button to default to forum
Post by: CapadY on July 29, 2010, 05:15:22 AM
I didn test it but try this, it should at least solve a part of your problems:


         'home' => array(
            'title' => $txt['home'],
            'href' => $user_info['is_guest'] ? 'http://www.yourdomainroothere.com/' : 'http://www.yourforumroothere.com/' ;,
            'show' => true,
            'sub_buttons' => array(
            ),
            'is_last' => $context['right_to_left'],
            // 'target' => '_blank',
         ),
Title: Re: Want home menu button to default to forum
Post by: JPA on July 29, 2010, 07:55:00 AM
Thank you capady, now all I need is to have the forum load as the home page on sign in and I'm set!
Title: Re: Want home menu button to default to forum
Post by: Matthew K. on July 29, 2010, 10:10:09 AM
My code did the same thing capady's did, just a different way.

Capady - Instead of putting

'href' => $user_info['is_guest'] ? 'http://www.yourdomainroothere.com/' : 'http://www.yourforumroothere.com/' ;,

It should be

'href' => $user_info['is_guest'] ? 'http://www.yourdomainroothere.com/' : ''. $scripturl. '';,
Title: Re: Want home menu button to default to forum
Post by: JPA on July 29, 2010, 10:41:22 AM
Labradoodle, capady, thank you for helping me resolve the menu button issue.  Any suggestions on how to load the forum on log in and not  the front page.
Any suggestions would be greatly appreciated! :D