Page 8 of 14

Re: [Beta] Post Expire 0.4.0

Posted: Mon Apr 13, 2009 3:27 pm
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:

Re: [Beta] Post Expire 0.4.0

Posted: Mon Apr 13, 2009 5:42 pm
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.

Re: [Beta] Post Expire 0.4.0

Posted: Mon Apr 13, 2009 6:14 pm
by Lisbon
Ok ;)

Now i have like this:
Image

I´m goin whating for a result.

Tks for help

Re: [Beta] Post Expire 0.4.1

Posted: Mon Apr 13, 2009 9:08 pm
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.

Re: [Beta] Post Expire 0.4.1

Posted: Mon Apr 13, 2009 9:52 pm
by janine
Ahhh crazygandalf you're the best!! I will install tonight. Yippee!! :D

Re: [Beta] Post Expire 0.4.1

Posted: Tue Apr 14, 2009 12:06 am
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;
		}

Re: [Beta] Post Expire 0.4.1

Posted: Tue Apr 14, 2009 12:36 am
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.

Re: [Beta] Post Expire 0.4.1

Posted: Tue Apr 14, 2009 1:44 pm
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 .

Re: [Beta] Post Expire 0.4.1

Posted: Tue Apr 14, 2009 8:03 pm
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.

Re: [Beta] Post Expire 0.4.1

Posted: Tue Apr 14, 2009 10:25 pm
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?

Re: [Beta] Post Expire 0.4.1

Posted: Wed Apr 15, 2009 1:45 pm
by usenet2you
thanks for the update, i will install it very soon! =D nice new features! thanks for adding it.

Re: [Beta] Post Expire 0.4.1

Posted: Wed Apr 15, 2009 2:36 pm
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

Re: [Beta] Post Expire 0.4.1

Posted: Wed Apr 15, 2009 9:15 pm
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. :-)

Re: [Beta] Post Expire 0.4.1

Posted: Wed Apr 15, 2009 11:12 pm
by janine
The edits work fine. It's showin gthe correct expire time now. Thanks so much! :D

Re: [Beta] Post Expire 0.4.1

Posted: Thu Apr 16, 2009 1:33 am
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