Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Topic started by: Max22 on May 25, 2022, 11:41:39 AM

Title: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Max22 on May 25, 2022, 11:41:39 AM
I would be interested in a "hooks only" mod to display the Who's Online dropdown menu with "Everyone" and "Members only" options in order to set one of those as default view (instead of editing the file Who.php as explained here (https://www.simplemachines.org/community/index.php?msg=4125339)).
Title: Re: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Arantor on May 25, 2022, 11:52:10 AM
If there had been a nice way of writing a hooks-only mod for this, I'd have written it.

The problem is that there isn't a hook in a place you'd need there to be. The only thing you can do is run a hook much earlier that runs on every page, just in case you happen to be on the right page, and fudge the setup before you even go into Who().
Title: Re: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Antechinus on May 26, 2022, 04:42:08 PM
Ok, obvious question: since this is such a simple thing, and will only edit a template that is probably never messed with by any other mod, why does it need to be hooks only? Especially if you only plan to install it once,and leave it installed. Hooks are useful, but they aren't essential.
Title: Re: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Max22 on May 26, 2022, 05:19:39 PM
It could have been useful to toggle from one value to another without having to uninstall it.

As a matter of habit, I prefer to adopt a mod for each change I need to make.
Title: Re: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Antechinus on May 26, 2022, 05:25:22 PM
If you mean toggle from one display option to another, that can be done with the select regardless of whether the mod uses hooks or not.

If you mean toggling the mod itself to enabled or disabled, you have to uninstall a hooks mod to disable it anyway.

My point is that hooks are a convenience from the back end coding perspective, but have zero effect on how a mod actually functions for the person using the forum interface.
Title: Re: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Max22 on May 26, 2022, 05:30:22 PM
Quote from: Antechinus on May 26, 2022, 05:25:22 PMIf you mean toggle from one display option to another, that can be done with the select regardless of whether the mod uses hooks or not.

The point was to set manually the default view for any user of my forum, unless there is a specific admin setting I'm not aware on SMF 2.1.
Title: Re: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Antechinus on May 26, 2022, 05:32:17 PM
Ok, so that can be done without hooks. You just need to code the mod to change the relevant line of code, which is pretty trivial. As long as no other mods mess with that same line of code, no problem.
Title: Re: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Arantor on May 26, 2022, 07:01:13 PM
And if you're talking about making it a mod, the process is even documented as per the OP pointing to a post of mine. It's just a case of packaging that up.

Or convincing the team to add a new hook solely for the purposes of changing things.
Title: Re: [FREE] Who's Online: Set Everyone or Members only as default
Post by: Max22 on May 26, 2022, 07:14:50 PM
For the record, my request has already been answered in the second post.