Modifying Search block default options

Post

Posted
Rating:
Item has a rating of 5 (Liked by Adam Edington)
#373 (In Topic #86)
Avatar
Standard member
Finncat is in the usergroup ‘Fan in action’
I have noticed that quite often when I try to find contents from my site using Search block, I have to open the Options menu  and tick Catalogue entries or some other non-default option in order to get the desired results.

I have not managed to find out how  to define which search content options are selected as default?
Online now: No Back to the top

Post

Posted
Rating:
Item has a rating of 5 (Liked by Adam Edington)
#375
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Hi,

There is a way to change the top_search block's defaults, but it's too fiddly to explain reasonably.

I think we should make this better, so I've added it to the tracker:
0002378: Allow configuration of search defaults, outside block options - Composr CMS feature tracker
In the past we were very frugal about adding new config options, but that's no longer an issue with Composr as we've improved our configuration subsystem.

For now though it's easiest to just manually alter the PHP code.

If you look in the sources/hooks/modules/search/*.php files you'll find some have:

Code

$info['default'] = false;
change to:

Code

$info['default'] = true;
as you desire.

Then save under sources_custom/hooks/modules/search/


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#376
Avatar
Standard member
Finncat is in the usergroup ‘Fan in action’
Thanks Chris,

I tried immediately, and it works :thumbs:

I guess the logic is that php files in sources_custom have priority over files in sources, right?
Online now: No Back to the top

Post

Posted
Rating:
#377
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Yes, priority, and protected from automatic overwrite during upgrades. :)


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Forum statistics:
  • 2,052 topics, 7,195 posts, 10,830 members
  • Our newest member is Customcollective
Back to Top