Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Discussion Expiration (Testing only)
Read the documentation very carefully.
DO NOT INSTALL IT ON PRODUCTION ENVIRONMENT. THIS IS TESTING ONLY
First before you do anything. Download, install and enable jQuery ext
Did u do what I wrote above. If not then do that right now
OK Now download the extension from HERE
extract and copy it in your extension Folder
Did u enable Jquery yet?
Now enable Discussion Expiration. refresh page
You will see a new Heading under "Extension Options" called Discussion Expiration
Click on it and select the Categories you want the Discussion to expire.
Just because u have the ability to choose all the categories. It makes no sense to do so. Think long and hard about which categories should have this capability. If you have a category about Events, then this will be perfect for it.
When you create a new Discussion and select the category, you will see a new field appear.
Use the included Date Picker to pick an expiration date.
All Bug reporting during the testing phase needs to be in this thread. You have to give me detail explanation of the problem. lame complaint won't get u any help.
Now that I think of it. this extension should have been called "Fresh Before".
DO NOT INSTALL IT ON PRODUCTION ENVIRONMENT. THIS IS TESTING ONLY
First before you do anything. Download, install and enable jQuery ext
Did u do what I wrote above. If not then do that right now
OK Now download the extension from HERE
extract and copy it in your extension Folder
Did u enable Jquery yet?
Now enable Discussion Expiration. refresh page
You will see a new Heading under "Extension Options" called Discussion Expiration
Click on it and select the Categories you want the Discussion to expire.
Just because u have the ability to choose all the categories. It makes no sense to do so. Think long and hard about which categories should have this capability. If you have a category about Events, then this will be perfect for it.
When you create a new Discussion and select the category, you will see a new field appear.
Use the included Date Picker to pick an expiration date.
All Bug reporting during the testing phase needs to be in this thread. You have to give me detail explanation of the problem. lame complaint won't get u any help.
Now that I think of it. this extension should have been called "Fresh Before".
0
This discussion has been closed.
Comments
The installation and use so far have been perfect.
When u installed the extension, the time of installation is stored, and from then on. it checks back after 24 hrs from installation. Plus the time is server time. If ur Server is outside US then it will be time of that country.
Check ur database and see if the date is stored or not
The date and info are stored perfectly
In my case I will be expiring them to 'deleted' since I don't need them searchable. Is this the only line I would change or are there other points in your code.
default.php
$query = "UPDATE LUM_DISCUSSION SET Active = 0 WHERE DateExpire > 0000-00-00 AND NOW() > DateExpire;";
if (time() > $Context->Configuration["DISCUSSIONEXPIRATION_LASTCHECK"] + 86400 )
this checks if the current time is (24hr * 60min * 60sec) more than last check. If u remove the 86400 (=24hrs) then it should do it the moment u refresh ur discussion page. remember the check is done when the discussion page is refreshed.
Fatal error: Call to undefined method DiscussionGrid::GetDefinition() in /home/vanilla/extensions/DiscussionExpiration/default.php on line 101
Same thing happens if you use 60 seconds.
fixing it. and will upload it
It should be
if (time() > $Context->Configuration["DISCUSSIONEXPIRATION_LASTCHECK"] + 86400 ) { function CloseExpiredDiscussions (&$DiscussionGrid) { $query = "UPDATE LUM_DISCUSSION SET Closed = 1 WHERE DateExpire > 0000-00-00 AND NOW() > DateExpire;"; $result = mysql_query($query); if (!$result) echo $DiscussionGrid->Context->GetDefinition('DiscussionExpiresError'); } $Context->Configuration["DISCUSSIONEXPIRATION_LASTCHECK"] = time(); $Context->AddToDelegate('DiscussionGrid', 'PostRender', 'CloseExpiredDiscussions'); }
with no number or with another number I get
"Error Occured. Discussions were not closed"
so it looks like its trying to perform the action, just not succeeding.
UPDATE: Solution
Change
$query = "UPDATE LUM_DISCUSSION SET Closed = 1 WHERE DateExpire > 0000-00-00 AND NOW() > DateExpire;";
TO:
$query = "UPDATE LUM_Discussion SET Closed = 1 WHERE DateExpire > 0000-00-00 AND NOW() > DateExpire;";
Doing this it does work! pretty sweet man.
I did see one other error. If you enter a old day you get your warning BUT at the very top of the page you also get :
Notice: Trying to get property of non-object in /home/vanilla/extensions/DiscussionExpiration/library/Function.DiscussionExpiration.php on line 43
$query = "UPDATE LUM_Discussion SET Closed = 1 WHERE DateExpire > 0000-00-00 AND NOW() > DateExpire && Closed=0 && Deleted=0;";
btw there is no column Deleted in Discussion table.
I think i will make a check on the category. plus it shouldn't be a whisper either.
one question Does adding more "Where" clause slow down the query cause ur doing more checks per row, or does it speed up the query cause u will be changing less rows per query.
For example I might not care if a deleted (non active) discussion is closed. But If i check for it. I'm wasting my time. cause i don't care about it. But if i don't check then I'm altering more rows. Which one is more troublesome?
Should whispered discussions be closed or not.
Should I check for categories or not. If the admin changes his mind about a particular category then, discussion from that category won't be closed even though it has date expiration. Should it be closed or no? I'm thinking if the admin changed his mind then he prolly doesn't want the discussions to expire even though it has expiration date. Decisions Decisions.
regarding updating error messages. I'm making it o it tells u what u wrote and what u should have written. instead of just telling u what u should have written
2. hmm... I agree with jeff.
3. I would still close it. Say an administrator wants to expire only one discussion in a category--he would turn it on, go in to it, change it, then turn off the expriy for the category. You should probably post a notice that says something like The category x has discussions in it that are set to expire. Do you still want to expire them? ... then list them with yes/no buttons. Admin can then clear any expirations he wants and click done to go back to the forum.
Another thought is to sink/unsticky discussions rather than close on their expiration.
How will i track what should happen when the expiration is passed. It can be set to do multiple things. UnStick and Close after expiration. or sink and unstick but not close. So every Discussion will now a expiration preference column.
So I should allow multiple effects. There are essentially 3 options that we can use per discussion. Closed, Sink, Sticky. Checkboxes can be added. What i won't do is have different dates for different results. that will be hard to do.
Should this be role specific as well. or everyone should be allowed to expire discussions.
Admin Side calender of all Discussions set to expired can also be shown. click on the date to see a list of all Discussion set to close/unstick/sink on that date. there I can have a "clear the date" checkbox.
Its kind of pointless to have both close and sink at the same time--as sink is just a lesser form of close.
Maybe serialize the array of changes into one field? Then convert them to an array and loop through each change...
Or maybe this would be better left for a general "Vanilla Cron" extension that does more complex changes directly with SQL--like adding roles or categories or posts.
this query works
SELECT Name, DateExpire FROM LUM_Discussion WHERE Active=1 AND DateExpire>0000-00-00;
but this fails
SELECT Name, DateExpire FROM LUM_Discussion WHERE Active=1 AND DateExpire>0000-00-00 AND Closed =0;
ok now in the settings page u should see a list of all open discussion that are set to expire.