Calculate end_date | Support Questions | Support Forum

A A A

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Calculate end_date
March 6, 2019
4:07 pm
Pedro
New Member
Members
Forum Posts: 2
Member Since:
March 6, 2019
sp_UserOfflineSmall Offline

Hi,

I have created with your plugin extra fields a new field fecha_fin_aventura (datetime),

Your proposal is:

start date + Duration of listings in free mode (in days) = end date,

and I want:

fecha_fin_aventura + Duration of listings in free mode (in days) = end date

Because I want to remove the ads in other date.

I see ad-functions.php and I change $start_date to $fecha_fin_aventura and is same.

 

/**
* Generic function to calculate an date relative to a given start date.
*
* @since 2.0.7
*/
function awpcp_calculate_end_date($increment, $period, $fecha_fin_aventura) {
$periods = array('D' => 'DAY', 'W' => 'WEEK', 'M' => 'MONTH', 'Y' => 'YEAR');
if (in_array($period, array_keys($periods))) {
$period = $periods[$period];
}

// 0 means no expiration date, we understand that as ten years
if ($increment == 0 && $period == 'DAY') {
$increment = 3650;
} else if ($increment == 0 && $period == 'WEEK') {
$increment = 5200;
} else if ($increment == 0 && $period == 'MONTH') {
$increment = 1200;
} else if ($increment == 0 && $period == 'YEAR') {
$increment = 10;
}

return date('Y-m-d H:i:s', strtotime("+ $increment $period", $fecha_fin_aventura));
}

/**
* If an Ad was passed, calculates Ad End Date from current End Date.
* If no Ad was passed, calculates Ad End Date as if Ad would have
* been posted at the current time.
*
* TODO: Use the new $ad->calculate_end_date() method.
*/
function awpcp_calculate_ad_end_date($duration, $interval='DAY', $ad=null) {
$now = awpcp_datetime( 'timestamp' );
$end_date = is_null($ad) ? $ad->ad_enddate : 0;
// if the Ad's end date is in the future, use that as starting point
// for the new end date, else use current date.
$fecha_fin_aventura = $end_date > $now ? $end_date : $now;
return awpcp_calculate_end_date($duration, $interval, $fecha_fin_aventura);
}

 

Can you help me please?

WordPress 5.0.3
AWPCP: 3.9.5.
awpcp-extra-fields-3615

March 7, 2019
8:20 am
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 5362
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Pedro,

Thank you for your post. 

We typically don't provide support for custom coding questions, but I can see if the developer is able to take a look here. We are working on a major release right now, so I'm not sure how quickly we'll get a response here, but I will update the issue when I do hear something. 

March 8, 2019
9:14 am
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 5362
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Pedro,

Thanks for your patience. The developer says that there is no easy way to achieve what you are asking for here. 

With our hefty feature list and our ongoing support work, we lack the bandwidth to do that kind of customization for sites. There are a few other great resources to help you out here.

1) Tilden Tasks: https://tildentasks.com/ They will also do longer WordPress tasks, but they break it down to 1 task per day.
2) Codeable, which has WordPress expert developers available for short-term projects: https://codeable.io/
3) The last option would be hiring a developer on Upwork (formerly known as oDesk) 

Best of luck with this customization. 

March 10, 2019
3:57 pm
Pedro
New Member
Members
Forum Posts: 2
Member Since:
March 6, 2019
sp_UserOfflineSmall Offline

Thank you

Forum Timezone: America/Denver

Most Users Ever Online: 163

Currently Online:
23 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Johnny B: 140

godie: 120

kerdezo: 99

laburke: 94

NAIN KHAN: 93

salvig67: 84

sctpfwape: 75

rude: 72

purplepaula: 72

WAYTOBAYWTB52: 71

Member Stats:

Guest Posters: 32

Members: 38136

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 7036

Posts: 31284

Newest Members:

kurnailstop, motordkrental, nailsjuliitaxd, Mark, Rachael, SHERI, bhawanaconsultancy, alexlug, ludniko, Matakoi

Moderators: awpcp: 7530, AWPCP Support: 5362, Bobbie Devereux: 0

Administrators: wpengine: 0, awpcp: 300

Skip to toolbar