[MODDB] Post Expire 1.0.3

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Anti-Spam Guide
Locked
User avatar
Lisbon
Registered User
Posts: 825
Joined: Wed Jan 30, 2008 12:28 pm
Location: Zermatt

Re: [Beta] Post Expire 0.4.0

Post by Lisbon »

Hello.

It´s my again. Another noob question.

This is the config in the ACP:
Image

And this is my permissions:
Image

But, if i make a new topic i dont see the option "topic expire". look:
Image

It´s normal?

Tks for help... I´m noob :oops:
crazygandalf
Registered User
Posts: 148
Joined: Thu Oct 14, 2004 10:53 pm

Re: [Beta] Post Expire 0.4.0

Post by crazygandalf »

Lisbon, here's some quote about permissions from included to my mod readme.txt you should read:
- 'Can set post expire time only' - this option will give your users ability to set expire time only for posts, and only 'delete' action. The topic won't be affected if the first post is set to expire. In this case after expiring the first post will be deleted, but the topic will stay, with another author followed by the first one deleted.
- 'Can set topic expire time only' - this option will give your users ability to set expire time only for topics. They won't be able to set expire time for post written by post replay. Good option for moderators team.
When setting these two options to yes, only the first will aply.
As you see in your situation the bolded thing happened. So it means that only post expire time only is working. Going further you should know what to do next. Just try other settings of permissions. And read carefully what is stated, like words only.
Post Expire - set when your post/topic will disappear/be locked/moved.
GG & Tlen & Skype - for polish instant messangers.
User avatar
Lisbon
Registered User
Posts: 825
Joined: Wed Jan 30, 2008 12:28 pm
Location: Zermatt

Re: [Beta] Post Expire 0.4.0

Post by Lisbon »

Ok ;)

Now i have like this:
Image

I´m goin whating for a result.

Tks for help
crazygandalf
Registered User
Posts: 148
Joined: Thu Oct 14, 2004 10:53 pm

Re: [Beta] Post Expire 0.4.1

Post by crazygandalf »

As I said the newest version came. 0.4.1 BETA
What's new:
- some bugfixes
- minor change - datepicker uses form id instead of it's number (now there shouldn't be so many calls that the datepicker doesn't show)
- added time before expire in ACP for changing colour - Janine's strong wish :)
- added max time expire can be set
- new permission - can use only default move forum - when you want to specify to which forum your users can move topics, and only there
- added parsing 12h time AM/PM - you can now use 12h time. Please read redme.txt how to do this.
Post Expire - set when your post/topic will disappear/be locked/moved.
GG & Tlen & Skype - for polish instant messangers.
User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: [Beta] Post Expire 0.4.1

Post by janine »

Ahhh crazygandalf you're the best!! I will install tonight. Yippee!! :D
User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: [Beta] Post Expire 0.4.1

Post by janine »

I have an error doing the update...

Parse error: syntax error, unexpected T_ELSE in /home/giveaway/public_html/posting.php on line 681

here's lines 668-700 of posting.php. There were no edits to this part of the file per your intructions.

Code: Select all

        if (checkdate($matches[2], $matches[1], $matches[3])) 
				{
        	$post_data['post_expire_time'] = mktime(intval($hour), intval($minute), 0, intval($month), intval($day), intval($year)) - time();
					if ($post_data['post_expire_time'] < 0)
					{
						$error[] = $user->lang['PAST_DATE'];
					}
        } 
				else 
				{
      	  $error[] = $user->lang['INVALID_DATE'];
        }       
    	} 
			else 
			{
    		$error[] = $user->lang['INVALID_DATE'];
    	} 
		}
		
if (intval($config['expire_max_time']) != 0 && (intval($post_data['post_expire_time'])) > intval($config['expire_max_time'])*86400)
		{
			$error[] = sprintf($user->lang['MAX_DATE'], $config['expire_max_time']);
		}
		
		if($post_data['post_expire_time'] == -1) 
		{
			$post_data['topic_expire_type'] = $expire_default_action;
			$post_data['expire_forum_id'] = 0;
		} 
		else if ($post_data['post_expire_time'] != - 1 && ($post_data['topic_expire_type'] == 0 || $post_data['topic_expire_type'] == 1))
		{  
			$post_data['expire_forum_id'] = 0;
		}
User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: [Beta] Post Expire 0.4.1

Post by janine »

And I don't know if it's because of the error in posting.php, but the "time before expire in ACP for changing colour" isn't working either.
User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: [Beta] Post Expire 0.4.1

Post by janine »

Ok, after going through the edits again it said to do this:

Code: Select all

#-----[ FIND ]------------------------------------------
$post_data['date_picker'] = '';


#-----[ AFTER, ADD ]------------------------------------------
$post_data['post_expire_time'] = (isset($post_data['post_expire_time'])) ? (int) $post_data['post_expire_time'] : -1;
But there was this after the find:

Code: Select all

$post_data['post_expire_time'] = ($post_data['post_expire_time'] != 0) ? $post_data['post_expire_time'] : -1;
So I just replaced that bit of the code with the code to add...
I no longer get an error, and the color change is working now. However the post expire time is wrong. I set it to expire at Wed Apr 21, 2009 11:59 pm, but it shows Wed Apr 22, 2009 12:59 am .
crazygandalf
Registered User
Posts: 148
Joined: Thu Oct 14, 2004 10:53 pm

Re: [Beta] Post Expire 0.4.1

Post by crazygandalf »

Janine, you probably did the wrong edit, it's why this error happend. Look carefully at brakets { }. It's easy way to make a mistake.
To the second part there should be all two lines with $post_data['post_expire_time'] define like:

Code: Select all

$post_data['date_picker'] = '';
$post_data['post_expire_time'] = (isset($post_data['post_expire_time'])) ? (int) $post_data['post_expire_time'] : -1;
$post_data['post_expire_time'] = ($post_data['post_expire_time'] != 0) ? $post_data['post_expire_time'] : -1;
It causes Notices in some cases, so I had to this way, as stated above.
janine wrote:However the post expire time is wrong. I set it to expire at Wed Apr 21, 2009 11:59 pm, but it shows Wed Apr 22, 2009 12:59 am .
You're right. It has something to do with timezones. I'll take a closer look at this tomorrow.
Post Expire - set when your post/topic will disappear/be locked/moved.
GG & Tlen & Skype - for polish instant messangers.
User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: [Beta] Post Expire 0.4.1

Post by janine »

You're right. I added that code back and it works fine. I must have made a mistake previously.

I'm in Daylight Savings Time maybe that's why it's an hour off?
usenet2you
Registered User
Posts: 407
Joined: Sat Mar 22, 2008 7:31 pm
Location: The Netherlands

Re: [Beta] Post Expire 0.4.1

Post by usenet2you »

thanks for the update, i will install it very soon! =D nice new features! thanks for adding it.
User avatar
Lisbon
Registered User
Posts: 825
Joined: Wed Jan 30, 2008 12:28 pm
Location: Zermatt

Re: [Beta] Post Expire 0.4.1

Post by Lisbon »

#-----[ FIND ]------------------------------------------
#
if ($config['expire_enable'])
{
$expire_after_show = 0;
$expire_exact_show = 0;

if (!$auth->acl_get('u_topic_expire_only') || ($auth->acl_get('u_topic_expire_only') && $post_data['topic_first_post_id'] == $post_data['post_id']) || ($auth->acl_get('u_topic_expire_only') && $auth->acl_get('u_post_expire_only')))
I dont find this :oops:

my file: http://www.cetos.info/ficheiros/posting.zip
crazygandalf
Registered User
Posts: 148
Joined: Thu Oct 14, 2004 10:53 pm

Re: [Beta] Post Expire 0.4.1

Post by crazygandalf »

OK. I completly forgot about timezones when writing a mod. :-) Here's the solution:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ FIND ]------------------------------------------
#
        	$post_data['post_expire_time'] = mktime(intval($hour), intval($minute), 0, intval($month), intval($day), intval($year)) - time();

#
#-----[ REPLACE WITH ]------------------------------------------
#
        	$post_data['post_expire_time'] = gmmktime(intval($hour), intval($minute), 0, intval($month), intval($day), intval($year)) - time();

#
#-----[ FIND ]------------------------------------------
#
		if (intval($config['expire_max_time']) != 0 && (intval($post_data['post_expire_time'])) > intval($config['expire_max_time'])*86400)

#
#-----[ BEFORE, ADD ]------------------------------------------
#
		else
		{
			$post_data['post_expire_time'] = ($post_data['post_expire_time'] != -1) ? $post_data['post_expire_time'] + $user->timezone + $user->dst : $post_data['post_expire_time']; 
		}

#
#-----[ FIND ]------------------------------------------
#
				'post_expire_time'		=> (int) $post_data['post_expire_time'],

#
#-----[ REPLACE WITH ]------------------------------------------
#
				'post_expire_time'		=> (int) $post_data['post_expire_time'] - $user->timezone - $user->dst,

#
#-----[ FIND ]------------------------------------------
#
				$post_data['date_picker'] = date("d-m-Y H:i", $post_data['post_expire_time']); //Use for 24h time
//				$post_data['date_picker'] = date("d-m-Y h:i A", $post_data['post_expire_time']); //Use for 12h am/pm time

#
#-----[ REPLACE WITH ]------------------------------------------
#
				$post_data['date_picker'] = gmdate("d-m-Y H:i", $post_data['post_expire_time'] + $user->timezone + $user->dst); //Use for 24h time
//				$post_data['date_picker'] = gmdate("d-m-Y h:i A", $post_data['post_expire_time'] + $user->timezone + $user->dst); //Use for 12h am/pm time

#
#-----[ OPEN ]------------------------------------------
#
includes/functions_display.php

#
#-----[ FIND ]------------------------------------------
#
	$current_time = time();

#
#-----[ REPLACE WITH ]------------------------------------------
#
	$current_time = gmdate('U');
usenet2you wrote:thanks for the update, i will install it very soon! =D nice new features! thanks for adding it.
No problem. :D

Lisbon, you probably made these modifications:
http://www.phpbb.com/community/viewtopi ... 5#p9094635
Reverse it and you'll find what you want. :-)
Post Expire - set when your post/topic will disappear/be locked/moved.
GG & Tlen & Skype - for polish instant messangers.
User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: [Beta] Post Expire 0.4.1

Post by janine »

The edits work fine. It's showin gthe correct expire time now. Thanks so much! :D
User avatar
janine
Registered User
Posts: 345
Joined: Sun Mar 24, 2002 6:38 pm
Location: Pa

Re: [Beta] Post Expire 0.4.1

Post by janine »

Actually I have a problem again. I checked the edits three times, so no mistakes by me this time :P

Every reply to a post (that has an expire time set) has an expire date/time automatically set.
This did not happen before.

See what I mean in this thread. Before I added the edits, I replied to my own post here. After the edits, someone else replied and it automatically set an expire date time.
http://www.giveawayspot.com/viewtopic.php?f=15&t=1441

:?

I restored my back up file so it's not doing that anymore. Please help
Locked

Return to “[3.0.x] MODs in Development”