News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[FREE] Who's Online: Set Everyone or Members only as default

Started by Max22, May 25, 2022, 11:41:39 AM

Previous topic - Next topic

Max22

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).

Arantor

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().

Antechinus

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.

Max22

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.

Antechinus

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.

Max22

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.

Antechinus

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.

Arantor

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.

Max22

For the record, my request has already been answered in the second post.

Advertisement: