Something like this (many codes on google):
<?php
function dateDiff($date1, $date2)
{
$date1_ts = strtotime($date1);
$date2_ts = strtotime($date2);
$diff = $date2_ts - $date1_ts;
return abs(round($diff / 86400));
}
if(dateDiff(osc_item_pub_date(), date('Y-m-d H:i:s')) > 50) {
... show my button ...
}
yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees i did it by your help and ChapGPT,
the code you gaved it to me wasn't work at the begining try, but after i asked ChatGPT AI his help, it got worked perfect
![Cheesy :D](https://forums.osclasspoint.com/Smileys/osclass-emoji/cheesy.gif)
-----------------------------------------------------------------------------------------------------------------------------------------
So we can say First this is the code:
<?php
$item_pub_date = osc_item_pub_date(); // Get the publication date of the item
$current_date = date('Y-m-d H:i:s'); // Get the current date and time
// Calculate the difference in days between the publication date and the current date
$date_diff = round((strtotime($current_date) - strtotime($item_pub_date)) / (60 * 60 * 24));
// Only display the "Republish" button if 30 or more days have passed since the publication date
if ($date_diff >= 30 && function_exists('republish_link_raw') && republish_link_raw(osc_item_id())) { ?>
<a class="republish" href="<?php echo republish_link_raw(osc_item_id()); ?>" rel="nofollow"><?php _e('Republish', 'epsilon'); ?></a>
<span class="delim">/</span>
<?php } ?>
replace it with that code in user-item.php:
<?php if(function_exists('republish_link_raw') && republish_link_raw(osc_item_id())) { ?>
<a class="republish" href="<?php echo republish_link_raw(osc_item_id()); ?>" rel="nofollow"><?php _e('Republish', 'epsilon'); ?></a>
<span class="delim">/</span>
<?php } ?>
2- you need to use Backoffice Manager Pro Plugin and active:
Allow users to republish listing anytime, not only when listing is about expire. (6)
Done
Thank you Buddy for your Help
![Grin ;D](https://forums.osclasspoint.com/Smileys/osclass-emoji/grin.gif)