ElkArte Community

Project Support => Support => Topic started by: Wizard on October 16, 2015, 10:00:03 pm

Title: Start discussion button
Post by: Wizard on October 16, 2015, 10:00:03 pm
I recommended ElkArte on a forum someone I knew started. It was like he want to use a Start Discussion button on home page.

When I checked the calender module, I saw that there is a " Post in " option which gives a list as seen below. Wondering whether we can adopt the code for start discussion button as well ?

(http://www.elkarte.net/community/index.php?action=dlattach;topic=3018.0;attach=2986;image)

(http://www.elkarte.net/community/index.php?action=dlattach;topic=3018.0;attach=2988;image)
Title: Re: Start discussion button
Post by: Flavio93Zena on October 16, 2015, 10:37:30 pm
I'd discourage that just for one reason - noobs.
Basically a noob would:
-Hit the button (admitting he can see it)
-Type stuff
-Post the topic in the default/wrong section

At least with separated sections he is forced to at least enter into a section and post there, not that it cures stupidity but at least it tries to.. >:D
Title: Re: Start discussion button
Post by: Wizard on October 16, 2015, 11:01:07 pm
But, do you know how to @Flavio93Zena ?
Title: Re: Start discussion button
Post by: Flavio93Zena on October 17, 2015, 01:10:15 am
I think there was some kind of a mod doing something similar, but I can't remember very well :/
Title: Re: Start discussion button
Post by: Wizard on October 17, 2015, 01:14:21 am
Could you to tell me which code goes to which template ?
Title: Re: Start discussion button
Post by: Wizard on October 17, 2015, 01:54:35 am
I guess BoardIndex.template.php. Correct ?
Title: Re: Start discussion button
Post by: Flavio93Zena on October 17, 2015, 02:36:03 am
Yeah that one is for sure unless emanuele got some more surprising hacks such as the last time <.<
Title: Re: Start discussion button
Post by: emanuele on October 17, 2015, 08:44:13 am
Quote from: Wizard – When I checked the calender module, I saw that there is a " Post in " option which gives a list as seen below. Wondering whether we can adopt the code for start discussion button as well ?
To have the "new topic" button I think you just need a link to:
Code: [Select]
$scripturl . '?action=post;'
and then to run this code:
Code: [Select]
			$context['show_boards_dropdown'] = true;
require_once(SUBSDIR . '/Boards.subs.php');
$context += getBoardList(array('not_redirection' => true, 'allowed_to' => 'post_new'));
$context['boards_current_disabled'] = false;
if (!empty($board))
{
foreach ($context['categories'] as $id => $values)
if (isset($values['boards'][$board]))
{
$context['categories'][$id]['boards'][$board]['selected'] = true;
break;
}
}
somewhere while loading the post page, that should load the select for picking the board.