News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Auto Lock Old Topics

Started by vbgamer45, August 06, 2009, 12:30:14 AM

Previous topic - Next topic

Arantor

As in, there is already a mod for deletion too, it's just not publicly visible right this moment.
Holder of controversial views, all of which my own.


Marina3

Will this mod work on smf 2.1.2?

Doug Heffernan

Quote from: Marina3 on November 19, 2022, 04:29:14 AMWill this mod work on smf 2.1.2?

You can check the COMPATIBLE WITH field for mods to see on what version(s) of Smf they will work.

Steve

Quote from: Marina3 on November 19, 2022, 04:29:14 AMWill this mod work on smf 2.1.2?
Just tested this so the answer to your question is no, not without emulation (which I didn't test).

Doug's advice is valid though. Check what it IS compatible with. Then if you want to try and install it, backup everything and give it a try. Much better if you could try it on a test forum though.
My pet rock is not feeling well. I think it's stoned.

@rjen

I have taken up a little project to see if I can port this mod to SM2.1 and make it hooks only.

Just looking for an example mod to find what hook(s) to use for the maintenance task? Anyone can give a hint with an example or what Hook to use for the maintenance task?

Thanks in advance...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

Use the callable option in the scheduled tasks table to reference an external file/function, since call_helper should be able to load the file from that if you pass it in correctly when setting it up.

The syntax you will want will be filename.php|function_to_call in that file.
Holder of controversial views, all of which my own.


rcane

Quote from: Arantor on March 30, 2023, 05:37:27 PMUse the callable option in the scheduled tasks table to reference an external file/function, since call_helper should be able to load the file from that if you pass it in correctly when setting it up.

The syntax you will want will be filename.php|function_to_call in that file.

...

vbgamer45

Check out my RSS Feed Poster plugin has a scheduled task option .
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

@rcane literally none of my advice there was meant for you, nor is any of it relevant to you, unless you upgraded to 2.1 already... it's an implementation shorthand on implementing this specific problem as posed by the person before me.
Holder of controversial views, all of which my own.


rcane

Yeah I saw that.  I put that in my reason for editing—that it was the wrong thread I was looking at.

@rjen

I got the mod working, but there is one thing that puzzles me...

I added a scheduled task to the smf_scheduled_tasks table
This task refers to auto_lock
You cannot view this attachment.

I also included a function "scheduled_auto_lock" into my source
You cannot view this attachment.

Now the task is showing in the admin panel, and when I execute it (manually), it succesfully executes...
But I do not know how it gets to call the function "scheduled_auto_lock" or even loads the source file because I do not call it anywhere for the task execution?

What am I mssing here?

You cannot view this attachment.
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Quote from: Arantor on March 30, 2023, 05:37:27 PMUse the callable option in the scheduled tasks table to reference an external file/function, since call_helper should be able to load the file from that if you pass it in correctly when setting it up.

The syntax you will want will be filename.php|function_to_call in that file.

Hold the phone, finally your directions sunk in... this must be what I was missing... should have read better before I posted... lemme check that first

Guess this is what was intended...
You cannot view this attachment.
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Well, seems it still needs something else?

You cannot view this attachment.
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Okay, I managed to make the mod completely working on SMF2.1, but I had to make one file edit: did not manage to make it all hooks :-(

The only way I could get the task to run scheduled was by making this code change...

<file name="$sourcedir/ScheduledTasks.php">
<operation>
<search position="end" />
<add><![CDATA[

function scheduled_auto_lock()
{
global $sourcedir;

require_once($sourcedir . '/Auto_lock.php');
auto_lock_topics();

return true;
}

]]></add>
</operation>
</file>

</modification>
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

@vbgamer45 if you you interested I can share the updated Mod code with you if you want to release it for SMF2.1...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

vbgamer45

Sure, that would be great
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Diego Andrés

I believe pre_include hook might do the trick to make it hooks only?

SMF Tricks - Free & Premium Responsive Themes for SMF.

@rjen

Quote from: Diego Andrés on March 31, 2023, 10:02:43 AMI believe pre_include hook might do the trick to make it hooks only?

let's check that. I guess your idea is to just call the mod source file with the pre_include hook?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Fixed, all hooks. I'll send a copy to vbgamer
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

You don't even need hooks for the scheduled task itself - your issue with the row in the database table is that you used a / as the separator and not a | as the code requires...
Holder of controversial views, all of which my own.


Advertisement: