Help! change default search in forum

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
Locked
afifulinuha
Registered User
Posts: 15
Joined: Mon Feb 09, 2015 1:00 pm

Help! change default search in forum

Post by afifulinuha » Mon Feb 09, 2015 1:11 pm

Hey guys, I have a question.

I wanna find out how to change the default search in forum setting for the search results.

I would like it to show the results as default forum name "download bay" without the user having to manually change it before they selected the forum name.

Image

to

Image

I want to change it to forum name that i select to keep the setting by default.

Any help would be appreciated.

tahnk you :D
Last edited by afifulinuha on Mon Feb 09, 2015 7:38 pm, edited 2 times in total.

afifulinuha
Registered User
Posts: 15
Joined: Mon Feb 09, 2015 1:00 pm

Re: Help! change default search in forum

Post by afifulinuha » Mon Feb 09, 2015 5:20 pm

anyone please help me to solve this :)

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51484
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Help! change default search in forum

Post by Brf » Mon Feb 09, 2015 5:25 pm

There is a 6-hour bump limit on these forums. Please wait 6-hours before bumping your own topic.

What do you mean by:
afifulinuha wrote:default forum id
?

afifulinuha
Registered User
Posts: 15
Joined: Mon Feb 09, 2015 1:00 pm

Re: Help! change default search in forum

Post by afifulinuha » Tue Feb 10, 2015 1:07 am

Brf wrote:There is a 6-hour bump limit on these forums. Please wait 6-hours before bumping your own topic.

What do you mean by:
afifulinuha wrote:default forum id
?
forum id in forum url.. or i mean is forum name..

i already edited my topic.. i hope it will be easy to understand..

User avatar
AmigoJack
Registered User
Posts: 5420
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Help! change default search in forum

Post by AmigoJack » Tue Feb 10, 2015 8:36 am

Preselecting forum(s) can be done via URI parameters already: search.php?[b]fid%5B%5D=69[/b]

To also preselect the "Search within" parameter you'd have to modify poth the search PHP file and the template of each style:

In /search.php find:

Code: Select all

    $template->assign_vars(array(
        'SEARCH_TITLE'        => $l_search_title,
        'SEARCH_MATCHES'    => $l_search_matches,
        'SEARCH_WORDS'        => $keywords,
        'SEARCHED_QUERY'    => $search->search_query, 
After, add:

Code: Select all

        /*** 2015-02-10 BEGIN AmigoJack
            https://www.phpbb.com/community/viewtopic.php?f=72&t=2295786 ***/
        'SEARCH_FIELDS'=> $search_fields,
        /*** 2015-02-10 END ***/ 
In /styles/prosilver/template/search_body.html find:

Code: Select all

		<dd><label for="sf1"><input type="radio" name="sf" id="sf1" value="all" checked="checked" /> {L_SEARCH_TITLE_MSG}</label></dd>
		<dd><label for="sf2"><input type="radio" name="sf" id="sf2" value="msgonly" /> {L_SEARCH_MSG_ONLY}</label></dd>
		<dd><label for="sf3"><input type="radio" name="sf" id="sf3" value="titleonly" /> {L_SEARCH_TITLE_ONLY}</label></dd>
		<dd><label for="sf4"><input type="radio" name="sf" id="sf4" value="firstpost" /> {L_SEARCH_FIRST_POST}</label></dd>
Replace with:

Code: Select all

		<dd><label for="sf1"><input type="radio" name="sf" id="sf1" value="all" <!-- IF SEARCH_FIELDS == 'all' OR SEARCH_FIELDS == '' -->checked="checked"<!-- ENDIF --> /> {L_SEARCH_TITLE_MSG}</label></dd>
		<dd><label for="sf2"><input type="radio" name="sf" id="sf2" value="msgonly" <!-- IF SEARCH_FIELDS == 'msgonly' -->checked="checked"<!-- ENDIF --> /> {L_SEARCH_MSG_ONLY}</label></dd>
		<dd><label for="sf3"><input type="radio" name="sf" id="sf3" value="titleonly" <!-- IF SEARCH_FIELDS == 'titleonly' -->checked="checked"<!-- ENDIF --> /> {L_SEARCH_TITLE_ONLY}</label></dd>
		<dd><label for="sf4"><input type="radio" name="sf" id="sf4" value="firstpost" <!-- IF SEARCH_FIELDS == 'firstpost' -->checked="checked"<!-- ENDIF --> /> {L_SEARCH_FIRST_POST}</label></dd>
Untested. Now it should also act accordingly on adding that parameter: search.php?fid%5B%5D=69&[b]sf=titleonly[/b]
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

afifulinuha
Registered User
Posts: 15
Joined: Mon Feb 09, 2015 1:00 pm

Re: Help! change default search in forum

Post by afifulinuha » Tue Feb 10, 2015 9:08 am

AmigoJack wrote:Preselecting forum(s) can be done via URI parameters already: search.php?[b]fid%5B%5D=69[/b]

To also preselect the "Search within" parameter you'd have to modify poth the search PHP file and the template of each style:

In /search.php find:

Code: Select all

    $template->assign_vars(array(
        'SEARCH_TITLE'        => $l_search_title,
        'SEARCH_MATCHES'    => $l_search_matches,
        'SEARCH_WORDS'        => $keywords,
        'SEARCHED_QUERY'    => $search->search_query,
After, add:

Code: Select all

        /*** 2015-02-10 BEGIN AmigoJack
            https://www.phpbb.com/community/viewtopic.php?f=72&t=2295786 ***/
        'SEARCH_FIELDS'=> $search_fields,
        /*** 2015-02-10 END ***/
In /styles/prosilver/template/search_body.html find:

Code: Select all

		<dd><label for="sf1"><input type="radio" name="sf" id="sf1" value="all" checked="checked" /> {L_SEARCH_TITLE_MSG}</label></dd>
		<dd><label for="sf2"><input type="radio" name="sf" id="sf2" value="msgonly" /> {L_SEARCH_MSG_ONLY}</label></dd>
		<dd><label for="sf3"><input type="radio" name="sf" id="sf3" value="titleonly" /> {L_SEARCH_TITLE_ONLY}</label></dd>
		<dd><label for="sf4"><input type="radio" name="sf" id="sf4" value="firstpost" /> {L_SEARCH_FIRST_POST}</label></dd>
Replace with:

Code: Select all

		<dd><label for="sf1"><input type="radio" name="sf" id="sf1" value="all" <!-- IF SEARCH_FIELDS == 'all' OR SEARCH_FIELDS == '' -->checked="checked"<!-- ENDIF --> /> {L_SEARCH_TITLE_MSG}</label></dd>
		<dd><label for="sf2"><input type="radio" name="sf" id="sf2" value="msgonly" <!-- IF SEARCH_FIELDS == 'msgonly' -->checked="checked"<!-- ENDIF --> /> {L_SEARCH_MSG_ONLY}</label></dd>
		<dd><label for="sf3"><input type="radio" name="sf" id="sf3" value="titleonly" <!-- IF SEARCH_FIELDS == 'titleonly' -->checked="checked"<!-- ENDIF --> /> {L_SEARCH_TITLE_ONLY}</label></dd>
		<dd><label for="sf4"><input type="radio" name="sf" id="sf4" value="firstpost" <!-- IF SEARCH_FIELDS == 'firstpost' -->checked="checked"<!-- ENDIF --> /> {L_SEARCH_FIRST_POST}</label></dd>
Untested. Now it should also act accordingly on adding that parameter: search.php?fid%5B%5D=69&[b]sf=titleonly[/b]
greaat!!! thanks amigojack!

i follow your instruction it so helpful.. and works like charm!

thank you very much :D

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51484
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Help! change default search in forum

Post by Brf » Tue Feb 10, 2015 6:30 pm

If you want to search in a particular forum, you can also use the "Search this forum" box at the top of the Viewforum page.

Locked

Return to “[3.0.x] MOD Requests”

Who is online

Users browsing this forum: Yandex [Bot] and 21 guests