Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Topic Expire Plugin question
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 11, 2015 - 8:34 pm

No, that is not quite correct..   the change to the topic expire plugin was such to expose the expiration date in the standard forum and topic view classes so they could be more easily used...  in the code I provided previously, you had to do the query yourself...  once released, you will just need to do the display code (which will aid page loading times too)...

so to do what you want, easiest thing to do is add the following code to your spFunctions.php file of your them...

add_filter('sph_TopicIndexStatusIconsLast', 'my_expire_status');
function my_expire_status($out) {
    global $spThisTopic;
    $topic_expire = spdb_table(SFTOPICS, "topic_id=$spThisTopic->topic_id", 'expire_date');
    if ($topic_expire) $out.= sp_paint_icon('spIcon spIconNoAction', SPTHEMEICONSURL, 'sp_DeletePost.png', 'This topic has an expiration date');
    return $out;
}

as always, you should have a child or custom theme vice editing ours directly...

We can consider adding the capability for the status icon, as well as expiration date, directly into the plugin, but afraid that wont make it into the plugin release due any day..  would take bit more time to implement and test... and with WordPress 4.3 due in about a week, we will be focused on that...

you can customize the tooltip text if you like... and the icon... I just picked on that comes with all our themes...

Avatar
laurent enselme
Member
sp_UserOfflineSmall Offline
Aug 12, 2015 - 6:38 am

Thank you very much Mr Papa, working perfectly, and good luck for the updates !

Btw you stil have a problem with the ">" wink

"topic_id=$spThisTopic->topic_id", 'expire_date');

Avatar
laurent enselme
Member
sp_UserOfflineSmall Offline
Aug 12, 2015 - 8:07 am

If it can help someone else, i have modified a bit the code, now showing the date in the topic list too:

 

add_filter('sph_TopicIndexStatusIconsLast', 'my_expire_status');
function my_expire_status($out) {
global $spThisTopic;
$topic_expire = spdb_table(SFTOPICS, "topic_id=$spThisTopic->topic_id", 'expire_date');
if ($topic_expire) $out.= sp_paint_icon('spIcon spIconNoAction', SPTHEMEICONSURL, 'sp_DeletePost.png', 'Ce sujet expire le ' .date('d/m/Y', strtotime($topic_expire)));
return $out;
}

Sans-titre-1-4.jpgImage Enlarger

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 12, 2015 - 8:40 am

Nicely done there!
We have opened tickets to do something 'official' when we are able.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 12, 2015 - 9:25 pm

yup. nice!

going to open a ticket because that htmlentities conversion should not be happening...  might be something has happened in tinymce in wp 4.3 and need to investigate before they release it...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625