Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: @rjen on October 06, 2009, 11:36:19 AM

Title: Auto Purge Old Topics
Post by: @rjen on October 06, 2009, 11:36:19 AM
Link to the mod (https://custom.simplemachines.org/index.php?mod=2171)

Original author: Arantor

Description:
An addition to the Auto Lock Old Topics (http://custom.simplemachines.org/mods/index.php?mod=2040) mod, this mod adds a Scheduled Task to check for topics that have not been replied to in a while, and automatically removes them.

You can change it on a per-board setting, so different boards have different amounts of time if you like, and you can specify never to remove old posts.

By default the task will only select locked topics allowing the admin to use this mod as an add-on to the Auto Lock mod by first locking the topics and then moving topics to the recycle bin. An option is provided to let the mod purge all topics and not just locked topics.

You can also have it optionally ignore or remove sticky topics.

Posts are purged in this manner:
All extra information attached to the old topics that haven't been replied to is also removed - polls, calendar entries, log of what has been read etc. so on forums that don't need to archive posts this would be an excellent way of keeping space managed.

This new version is created for SMF2.1 and is all hooks
No support is provided for older versions of SMF.


Version history:
2.0 - 6 April 2023
Compatibility for 2.1.x (all hooks)

Taken over by @rjen

*** support for old version dropped ***

1.3.2 - 27 January 2014
Compatibility for 2.0.7 (no code changes)

1.3.1 - June 22, 2013
Compatibility for 2.0.4 (no code changes)

1.3 - July 28, 2012
Added compatibility for 2.0 - 2.0.2
Dropped support for all RC versions

1.2 - November 1, 2009
Added compatibility for RC2

1.1 - October 19, 2009
Minor bugfix regarding admin panel quick search

1.0 - September 25, 2009
Original release
Title: Re: Auto Purge Old Topics
Post by: imrich on October 08, 2009, 10:17:06 AM
This seems very close to this post I made:

http://www.simplemachines.org/community/index.php?topic=337811.msg2269496#msg2269496

I'm hopefull I can use it, thanks!


Title: Re: Auto Purge Old Topics
Post by: Arantor on October 08, 2009, 10:18:18 AM
Indeed that's what it's for :)
Title: Re: Auto Purge Old Topics
Post by: imrich on October 08, 2009, 10:33:08 AM
Thanks! This seems perfect. For a future version, it would be nice to have the option to send posts to the 'recycle bin' for some boards.

Then use the ability to prune the recycle board too. :)

Thanks for this mod, it's sorely needed for SMF 2.

Title: Re: Auto Purge Old Topics
Post by: Arantor on October 08, 2009, 10:57:06 AM
The idea of this mod is to purge old posts. I don't really want to get into the realms of putting it into the recycle bin on the basis that if it's 30 days old without a reply, all you're doing is moving it to the recycle bin for ANOTHER 30 days where it likely won't get a reply anyway, then you just purge it again.

Thus as I see it you just hold those topics around longer without any real benefit.
Title: Re: Auto Purge Old Topics
Post by: imrich on October 08, 2009, 02:37:19 PM
I understand this, thanks.

I was hoping to use it for helping to automate moderation of a board I have.

As an example, members can post 'for sale' items in the 'for sale' board.  But these postings tend to get stale as people post them and then forget about them. To keep them 'fresh' we delete them after 15 days of inactivity.

Sometimes we have someone who was away for a day or two miss the deadline of 15 days and they get upset that the posting was deleted and we have to 'bring it back'.  We do this via the recycle bin.

The recycle bin would be set for a 30 or 45 day purge period. So posts can stay in there a bit longer than the 'for sale' board, but not too long. ;)

If we had the ability to choose which boards posts would be sent to the 'recycle bin' or not, we could have complete control! I shorter period on the 'send to the recycle bin' boards, and a longer period on the 'recycle bin', where posts would be deleted forever would be ideal.

I understand if this mod doesn't support this and for your reasons for doing it. I do appreciate this mod. I wish it was a core feature of SMF!  However, having the ability to schedule a 'delete' (which would send a topic to the 'recycle board' if it exists would be great.

It may be easier to create a new mod, one that moves items to the recycle board if it exists, and then this one that purges them forever. It could be used if no recycle board exists, or to purge the recycle board itself.

Either way, thanks for this mod, I have needed this for a while.

I installed it on my SMF 2 RC1.2 test forum without any errors, and I'll start testing it further.

Thanks again!
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 08, 2009, 02:47:34 PM
Hmmm, interesting idea.

I'd possibly see the necessity of having it be able to move topics to different boards, e.g. move some to recycle bin, others to just a read-only archived board.

I'll play around with how that might work in interface terms and likely bring out Auto Move Old Topics, though I am also debating making an all-in-one mod for all three at some point.
Title: Re: Auto Purge Old Topics
Post by: imrich on October 08, 2009, 02:50:38 PM
Thanks for considering it.

I'll keep an eye on this thread in anticipation. :)
Title: Re: Auto Purge Old Topics
Post by: Smog on October 10, 2009, 02:19:13 PM
A really handy mod, thanks!  :)
Title: Re: Auto Purge Old Topics
Post by: darrenbeige on October 10, 2009, 03:15:13 PM
Quote from: Arantor on October 08, 2009, 02:47:34 PM
Hmmm, interesting idea.

I'd possibly see the necessity of having it be able to move topics to different boards, e.g. move some to recycle bin, others to just a read-only archived board.

I'll play around with how that might work in interface terms and likely bring out Auto Move Old Topics, though I am also debating making an all-in-one mod for all three at some point.

Auto Move Old Topics sounds very neat indeed.
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 10, 2009, 03:19:29 PM
AMOT will be 2.0 only but I'm really leaning towards the idea of a single mod for 1.1 as well.

In hindsight a mod that adds all three for 2.0 would be no different to having each of the three separate mods just all attached together in a single package.
Title: Re: Auto Purge Old Topics
Post by: swtdivalove on October 10, 2009, 03:24:55 PM
An interesting idea to go with this is the ability to Auto Archive also once the pruning is done and if selected to auto archive.

Maybe even setting it as a CSV that can be downloaded also?  This would save having to download the entire database and sifting through tons of stuff that may or may not pertain to the actual archive.
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 10, 2009, 03:31:02 PM
What do you mean by 'auto archive'? There are at least three different meanings that could be derived to, one of which is what this mod already does, one of which is what Auto Move Old Topics would do and the last is to automatically store it in a zip file as a partial SQL backup.

I do not plan on writing a backup script.
Title: Re: Auto Purge Old Topics
Post by: darrenbeige on October 10, 2009, 04:11:50 PM
I'd support a complete package for 1.1 (although I'd probably just scratch completely the auto-locking code), but if you don't I am still inclined to port the 'Auto Move' mod to 1.1
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 10, 2009, 04:13:56 PM
Except that the key part of it is a scheduled task, which just doesn't exist in 1.1, which is why I was so determined I'd never backport it.

But if you have three parts, there is really sufficient impetus to make a single scheduler to hook all three into.
Title: Re: Auto Purge Old Topics
Post by: darrenbeige on October 10, 2009, 04:58:36 PM
I haven't really examined SMF2 or its Scheduled Tasks, but aren't they just an equivalent of a cron?
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 10, 2009, 04:59:35 PM
They are an equivalent of cron, but there isn't a cron interface in 1.1, at least not directly.

There also isn't a handy area mod authors can just drop settings into (unlike 2.0's Admin > Modifications area)
Title: Re: Auto Purge Old Topics
Post by: darrenbeige on October 10, 2009, 06:43:12 PM
Couldn't you just direct people in tge installation instructions to also run the cron?
Title: Re: Auto Purge Old Topics
Post by: swtdivalove on October 10, 2009, 06:54:40 PM
Quote from: Arantor on October 10, 2009, 03:31:02 PM
What do you mean by 'auto archive'? There are at least three different meanings that could be derived to, one of which is what this mod already does, one of which is what Auto Move Old Topics would do and the last is to automatically store it in a zip file as a partial SQL backup.

I do not plan on writing a backup script.

My apologies, I did not know or did not understand that it was doing all of these things.
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 10, 2009, 06:57:25 PM
It isn't as simple as that, in fact.

The 2.0 mods also currently rely directly on a 2.0 only feature to simplify the admin area; there is no feature in 1.1 that provides a dedicated configuration area for mods (whereas 2.0 has Configuration > Modifications)

So it's a further edit to set that up too.

But even getting past that, setting up cron is not available on many shared hosts, even those with cPanel access, meaning the option is completely useless for them. It would be a support nightmare for me to write a mod and attempt to support it on every variation of host out there, whereas it would be feasible to have a scheduled task setup.


Edit: It doesn't. I wanted to know what you meant by auto archive, since it has 3 meanings, one already covered, one due to be covered and one I'm not going to write.
Title: Re: Auto Purge Old Topics
Post by: darrenbeige on October 11, 2009, 03:51:32 AM
Arantor, if you're planning a mod for 1.1 that will include a scheduled task element, you might aswell release the component as a separate mod entirely, and then merely depend on that with these three mods.

With regards to there being no direct modification panel, I for one would merely hardcode my 'decision' in (deleting any redundant options), adapting the code from 2.0 and setting a cron. Now, I realize that many users of SMF don't want/can't do that, but it is that much of an ask to request in the Installation to say 'setup a cron that will run every day which will execute this file: cron.php', and have the modSettings appear as a subsection of Boards, or underneath Moderators labelled 'Automatic Moderation'.

Thanks,
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 11, 2009, 05:17:59 AM
No, I can't do that. One of the guidelines for mods is that they must be able to stand alone and not require any pre-existing mod. It can use features given by a mod but only if it works on its own.

As for your suggestion, actually, yes IMO it would be too much to ask of many users. Many of our users are on shared hosting that does not allow access to cron configuration, and the ones that do usually have all different options for cron meaning that it would be a support nightmare because every single case will be different.

Engineering a standalone scheduled tasks component that is as powerful as 2.0's is (i.e. that could support hook ins like 2.0's does) would basically mean backporting the entire system back to 1.1, which is not only a large job, it is also bordering on contravention of the license of SMF since it's redistribution of SMF sources.

It would be far easier to build a single one for this mod to support the three tasks (and only these three tasks) which is the route I'm planning on taking, especially since I originally intended never to backport any of this to 1.1.
Title: Re: Auto Purge Old Topics
Post by: darrenbeige on October 11, 2009, 06:16:01 AM
Fair enough. Would the scheduled tasks code you are trying to add slow down a 1.1 installation considerably?
Title: Re: Auto Purge Old Topics
Post by: imrich on October 11, 2009, 08:35:06 AM
I'd love to see the three in one mod. :)

It also may be nice to be able to select 'auto purge stickies' per board, to allow for flexibility, but this is not a hard requirement yet.

Thanks for your consideration.
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 11, 2009, 05:00:33 PM
Quote from: darrenbeige on October 11, 2009, 06:16:01 AM
Fair enough. Would the scheduled tasks code you are trying to add slow down a 1.1 installation considerably?

No, but it *would* slow it down a little. I'm planning to not use DB queries (unlike 2.0) meaning that it would be much messier to add full blown scheduled tasks.

Quote from: imrich on October 11, 2009, 08:35:06 AM
I'd love to see the three in one mod.

For 1.1 it would be a single mod. For 2.0... it would actually look no difference to if you installed all three separately.

Quote from: imrich on October 11, 2009, 08:35:06 AM
It also may be nice to be able to select 'auto purge stickies' per board, to allow for flexibility, but this is not a hard requirement yet.

That'd be a rewrite, not a little feature add. Possibly doable for 1.1 version but I doubt I'll do that to be honest.
Title: Re: Auto Purge Old Topics
Post by: Arantor on October 11, 2009, 07:33:52 PM
Right. I thought more about this.

I will do Auto Move Old Topics, for those who just want the individual options.

Then at some point after - NOT immediately - I will write Auto Maintain Old Topics, which has all three in a single mod package, runs on both 1.1 and 2.0 (since it actually makes sense for me to do that in hindsight) but tie it into the board configuration rather than the setup I originally had. I suspect the 2.0 version will only be done in time for RC2 though.

Just seems to me to be the cleanest way to approach all this.
Title: Re: Auto Purge Old Topics
Post by: darrenbeige on October 12, 2009, 01:20:29 PM
That's sound like a good way of going about it.
Title: Re: Auto Purge Old Topics
Post by: imrich on October 19, 2009, 08:07:42 AM
I think I found a small bug with this mod.

In SMF 2.0 RC1.2, if you use the Aministration Center's 'Quick Search' feature and type in any text, you receive the error message:

Quote
Fatal error: Call to undefined function ManageAutoPurge() in . . . /forum/Sources/Admin.php on line 888

The error message complains that there is no ManageAutoPurge() defined, although I see this in Admin.php


// Mod authors if you want to be "real freaking good" then add any setting pages for your mod BELOW this line!
array('ManageAutoPurge', 'area=modsettings;sa=autopurge'),



I'll look into this some more, but let me know if you find anything on this.


Title: Re: Auto Purge Old Topics
Post by: imrich on October 19, 2009, 08:13:34 AM
Hmmm... looking into the mod, this code:

// Mod authors if you want to be "real freaking good" then add any setting pages for your mod BELOW this line!
array('ManageAutoPurge', 'area=modsettings;sa=autopurge'),


Really should have been this instead:


// Mod authors if you want to be "real freaking good" then add any setting pages for your mod BELOW this line!
array('ModifyAutoPurge', 'area=modsettings;sa=autopurge'),


Title: Re: Auto Purge Old Topics
Post by: Arantor on October 19, 2009, 10:04:34 AM
Indeed it should. I never realised that before, to be honest. (You're the first person to point it out to me, so thanks :))

Note that Auto Lock Old Topics (and possibly a few others) are similarly affected.

Thanks for pointing it out :) I'll release a fix momentarily.
Title: Re: Auto Purge Old Topics
Post by: imrich on October 19, 2009, 01:27:20 PM
Glad to help
Title: Re: Auto Purge Old Topics
Post by: steve51184 on July 09, 2010, 09:49:57 AM
would it be possible to have an option to move the topics and not delete them?
Title: Re: Auto Purge Old Topics
Post by: Aunt Sally on July 16, 2010, 06:48:36 PM
Is there a way (or a mod) to auto purge old topics on SMF 1.1.11 ?

I can do it manually but it would save a lot of scheduled work to do it automatically.

Title: Re: Auto Purge Old Topics
Post by: GazOutEast on November 22, 2010, 11:43:06 AM
Hi Arantor

I'm hoping you'll update the Auto Purge Old Topics for 2.0 RC4 real soon

I just did the daftest thing in upgrading a site that depends on it (from RC2 to RC4) without thinking to check that the mod had been updated.

Now I have to manually prune 260 freelance job-listing boards every day.

Dohhhh - I feel a right wally, right now.

Gaz
Title: Re: Auto Purge Old Topics
Post by: willemjan on March 25, 2011, 06:26:24 AM
Does this mod work on RC5?
Title: Re: Auto Purge Old Topics
Post by: Arantor on March 25, 2011, 11:10:04 AM
*shrug* Probably. There's no technical reason why it shouldn't.
Title: Re: Auto Purge Old Topics
Post by: rocknroller on April 02, 2011, 01:52:48 PM
great mod, ty
Title: Re: Auto Purge Old Topics
Post by: willemjan on April 04, 2011, 05:57:14 AM
Quote from: Arantor on March 25, 2011, 11:10:04 AM
*shrug* Probably. There's no technical reason why it shouldn't.

Just so you know... It does ;)
Title: Re: Auto Purge Old Topics
Post by: imrich on June 15, 2011, 07:47:35 AM
Will you be updating this for 2.0 final? I hope so, thanks!
Title: Re: Auto Purge Old Topics
Post by: amiralib on February 10, 2012, 05:21:56 AM
hurry up .... we need it
2.0.2
Title: Re: Auto Purge Old Topics
Post by: Shambles on February 10, 2012, 08:13:49 AM
Works flawlessly on 2.0.2
Title: Re: Auto Purge Old Topics
Post by: 6Dasher on August 07, 2012, 10:23:54 AM
Hi,

I used to use the old version and was glad the update came out. It installed without a hitch on 2.0.2.
Title: Re: Auto Purge Old Topics
Post by: Arantor on January 27, 2014, 05:18:17 PM
I've updated this for 2.0.7 (and taking it back over)
Title: Re: Auto Purge Old Topics
Post by: Hj Ahmad Rasyid Hj Ismail on July 22, 2014, 10:51:53 PM
Nothing serious to report. The mod is working fine. Just minor undefined errors which I am too lazy to find a fix.  ;)

http://anypost.qom.my/index.php?topic=471.new
8: Undefined index: autoPurge_0

http://anypost.qom.my/index.php?action=profile;u=937
8: Undefined index: autoPurge_0

1667: // figure out the timestamp for each board - and build a list
1668: $topics_to_purge = array();
1669: if(count($boards_to_purge)) {
1670: foreach($boards_to_purge as $board_id) {
1671: $setting = 'autoPurge_' . $board_id;
==>1672: if($modSettings[$setting] > 9999)
1673: $modSettings[$setting] = 9999;
==>1674: $timestamp = time() - ($modSettings[$setting] * 86400);
1675: $topicquery = 'SELECT t.id_topic
1676: FROM {db_prefix}topics t
1677: INNER JOIN {db_prefix}messages m ON t.id_last_msg = m.id_msg
1678: WHERE t.id_board = {int:id_board}
1679: AND m.poster_time <= {int:timestamp}';
1680: $topicquery .= (!empty($modSettings['autoPurge_sticky']) && $modSettings['autoPurge_sticky']) ? '' : ' AND t.is_sticky = 0';
Title: Re: Auto Purge Old Topics
Post by: Arantor on July 22, 2014, 11:03:41 PM
That's interesting. How did you configure it in the admin panel?

I'll try and look at this one tomorrow but it's been years since I last looked at it, I don't really remember how it works but I'll try to figure it out.
Title: Re: Auto Purge Old Topics
Post by: Hj Ahmad Rasyid Hj Ismail on July 22, 2014, 11:20:34 PM
Normal setting. Auto Purge checked. 5 days. Auto purge working fine though.
Title: Re: Auto Purge Old Topics
Post by: Arantor on July 24, 2014, 07:59:09 AM
What settings are in the smf_settings table whose names begin with autoPurge_ ?
Title: Re: Auto Purge Old Topics
Post by: Hj Ahmad Rasyid Hj Ismail on July 24, 2014, 11:21:14 AM
autoPurge_1   5
autoPurge_sticky   1
Title: Re: Auto Purge Old Topics
Post by: Arantor on July 24, 2014, 11:23:38 AM
Except the error being thrown relates to an autoPurge_0 which I don't understand.
Title: Re: Auto Purge Old Topics
Post by: Hj Ahmad Rasyid Hj Ismail on July 24, 2014, 11:32:49 AM
I sorted the table and there was no other data except the above. May be I should uninstall and reinstall. I will report this later.
Title: Re: Auto Purge Old Topics
Post by: Hj Ahmad Rasyid Hj Ismail on July 26, 2014, 07:15:30 PM
Well, just to report, despite uninstall and reinstall, it is still there. The same undefined error.

By the way, can this mod be extend to members? Auto Purge Inactive Members (may be with warning like after 3 times warnings or so)?
Title: Re: Auto Purge Old Topics
Post by: Arantor on July 26, 2014, 07:22:34 PM
Not without a complete rewrite and to be honest I'd do it over from scratch if I were going down that road
Title: Re: Auto Purge Old Topics
Post by: @rjen on April 06, 2023, 03:56:32 PM
Version history:
2.0 - 6 April 2023
Compatibility for 2.1.x (all hooks)

Taken over by @rjen

*** support for old version dropped ***
Title: Re: Auto Purge Old Topics
Post by: stoo23 on September 10, 2023, 03:42:10 AM
Hi there,

I was wondering if this Mod' can be used with version 2.1.4 AND is it possible to have it function basically on Only One board ??

We have a use for that function, which in theory this mod could be perfect for, just wanted to check first (although I do have a test forum to try it on) :)

thanks in advance
Stewart
Title: Re: Auto Purge Old Topics
Post by: @rjen on September 10, 2023, 04:04:02 AM
Yes on both questions
Title: Re: Auto Purge Old Topics
Post by: stoo23 on September 10, 2023, 04:11:17 AM
Fantastic,.. thanks  ;)  :)  8)
Title: Re: Auto Purge Old Topics
Post by: stoo23 on September 13, 2023, 09:04:27 PM
Hi again, well, the Mod' certainly works (as described)  :)  BUT

On my 'test' forum, it seems to be creating 'cron' related errors ??
as the Mod IS working, is Not a Big issue but would be great to work out why and Fix it before I install it on the Main Forum.

Auto Purge_1.PNG

Auto Purge_2.PNG

Any ideas or help, would be greatly appreciated.
cheers,
Stewart
Title: Re: Auto Purge Old Topics
Post by: @rjen on September 14, 2023, 01:01:17 AM
I have seen those too, and I now why they are there: it is because the mod moves the topics with the standard SMF function. When permanently deleting topics (no recycle bin) the function attempts to check the post count of the current member. Since the con job does not actually have a member id this message is the result.

It is annoying, but as far as I can see has nog negative impact
Title: Re: Auto Purge Old Topics
Post by: stoo23 on September 14, 2023, 04:13:20 AM
OK, I was wondering about the 'reference' to a member.

We ARE using a 'Recycle Bin' though or won't that make Any difference ??
Title: Re: Auto Purge Old Topics
Post by: @rjen on September 14, 2023, 05:48:13 AM
I remember now: the way I adapted the mod skips the recycle bin.

It's been while, not sure though ...
Title: Re: Auto Purge Old Topics
Post by: stoo23 on September 14, 2023, 06:37:42 AM
From my tests so far, it Does NOT 'skip' the Recycle Bin, as it IS sending the Deleted posts TO our 'recycle bin' ??
 ???  :-\
Title: Re: Auto Purge Old Topics
Post by: stoo23 on September 20, 2023, 08:26:43 AM
Well, I removed the selectable SMF Recycle Bin and the Auto Purge Mod works, Without causing Any cron errors.

It would appear that the existence of the Recycle bin is the cause of the cron errors.
Shame that wasn't 'fixed' / tidied up in the Code.  :(

The mod still works, just litters the Error Log with cron errors.
Title: Re: Auto Purge Old Topics
Post by: @rjen on September 20, 2023, 10:23:20 AM
Sorry you are disappointed with the mod. It is indeed related to the recycle bin. If you have a problem with the errors you are free to uninstall the mod.

If I find some time I may be able to analyze the cause further.
Title: Re: Auto Purge Old Topics
Post by: stoo23 on September 20, 2023, 07:17:49 PM
Oh, No, as suggested clearly above, the Mod still works and Will do what we needed it to do,.. was merely 'commenting' on the fact it generated Errors when an 'optional' (later) SMF Feature was utilized.

The cron errors in NO Way cause Any 'issues' other than requiring them to be removed from the error logs  ;)  :)

Thanks for your replies.  :D  8)
Regards,
Stewart
Title: Re: Auto Purge Old Topics
Post by: @rjen on October 25, 2023, 01:36:41 PM
Well, finally had a look into the exact cause, and I can confirm that the Cron errors are related to the use of the recycle bin.

Note: when I ported this mod to 2.1.4 I made an update: the old mod would delete the topics directly, skipping the use of the recycle bin completely. I always found this a bit annoying: not being able to monitor exactly what topics were deleted so I changed it to use the recycle bin..

It is controlled by the code in the Auto_purge.php file

if(count($topics_to_purge)) {
require_once($sourcedir . '/RemoveTopic.php');

// let's do this: remove topics, don't remove post count, do NOT ignore recycling
foreach($topics_to_purge as $purge_id) {
removeTopics($topics_to_purge, false, false);
}
}

The errors can be avoided by skipping the recycle board and changing the false to truein this line...

removeTopics($topics_to_purge, false, false);

On a more technical note: the mod is using the standard SMF function "removeTopics" which in itself call the function "moveTopics" to move topics to the recycleboard.
Now this second standard SMF functions produces the error message when being called from CRON, since there is no active user in the form a a value for $user_info['id']

// Mark target board as seen, if it was already marked as seen before.
$request = $smcFunc['db_query']('', '
SELECT (COALESCE(lb.id_msg, 0) >= b.id_msg_updated) AS isSeen
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}log_boards AS lb ON (lb.id_board = b.id_board AND lb.id_member = {int:current_member})
WHERE b.id_board = {int:id_board}',
array(
'current_member' => $user_info['id'],
'id_board' => $toBoard,
)
);

I am not sure if I can get around this problem, but perhaps one of the SMF dvelopers can give a hint to a more suitable solution?

Title: Re: Auto Purge Old Topics
Post by: Sesquipedalian on October 25, 2023, 05:04:32 PM
Here's a quick workaround that you could add to your function:

global $user_info;

$user_info['id'] = !empty($user_info['id']) ? $user_info['id'] : 0;
Title: Re: Auto Purge Old Topics
Post by: @rjen on October 26, 2023, 02:04:50 AM
Quote from: Sesquipedalian on October 25, 2023, 05:04:32 PMHere's a quick workaround that you could add to your function:

global $user_info;

$user_info['id'] = !empty($user_info['id']) ? $user_info['id'] : 0;

I tried that and I am getting a bit further, but now we are running into more errors due to other functions assuming stuff..

QuoteGuest
 https://test.fjr-club.nl/cron.php
 /home/xxx/test/Sources/Subs-ReportedContent.php (Line 425)  Backtrace information

Type of error: Cron
Error messageSelect
2: Undefined array key "mod_cache"

QuoteGuest
 https://test.fjr-club.nl/cron.php
 /home/xxx/test/Sources/Subs-ReportedContent.php (Line 425)  Backtrace information

Type of error: Cron
Error messageSelect
2: Trying to access array offset on value of type null

QuoteGuest
 https://test.fjr-club.nl/cron.php
 /home/xxx/test/Sources/Subs-ReportedContent.php (Line 435)  Backtrace information

Type of error: Database
Error messageSelect
Databasefout: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 5

This seems to be be a bit of a domino's: one step after another falling over...
Title: Re: Auto Purge Old Topics
Post by: Marina3 on November 03, 2023, 06:01:43 AM
Errors:
Hook call: function "eiu_modifications" could not be called.
The callable eiu_modifications could not be called.

Link: index.php?action=admin;area=modsettings;sa=auto_purge
I use SMF 2.1.4 and php 8.2.
Title: Re: Auto Purge Old Topics
Post by: @rjen on November 03, 2023, 07:25:41 AM
That's a hook that has nothing to do with this mod
Title: Re: Auto Purge Old Topics
Post by: @rjen on November 03, 2023, 07:58:46 AM
It's related to the email inactive users mod...

https://www.simplemachines.org/community/index.php?msg=4154967