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
laurent enselme
Member
sp_UserOfflineSmall Offline
Aug 8, 2015 - 3:06 pm

Hello,

I'm going to use a lot this plugin as soon has i'll have finished to configure my forum, that perfectly meets my needs except that once the date has been set I wish this may be readily visible , such as in the title of the topics (see attachment), would be a great help for moderators and members too - is that possible please ? Thanks in advance

Sans-titre-1-1.jpgImage Enlarger

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 8, 2015 - 6:18 pm

sure... we should actually make this easier for you... and save some queries... but this should work for you...

in you topic view template, ie spTopicView.php of the SP theme you are using, find the topic header display... something like this:

                    sp_TopicHeaderIcon('tagClass=spHeaderIcon spLeft');
                    sp_TopicHeaderName('tagClass=spHeaderName');

from our default theme...  after that, just add:

                    $topic_expire = spdb_table(SFTOPICS, "topic_id=$spThisTopic->topic_id", 'expire_date');
                    echo 'Topic Expires: '.date('l, F j, Y', strtotime($topic_expire));

which will output the topic expiration date...  feel free to customize as you like including date formatting...  I dont know if you have all topics expiring or not, so you might need a check for it existing...

as always, we strongly recommend that you make a child theme or a custom theme for this change to keep from losing your changes on update...

btw, in next release of the plugin (maybe this weekend), will make it easier so you dont have to do that db query...

Avatar
laurent enselme
Member
sp_UserOfflineSmall Offline
Aug 9, 2015 - 5:43 am

Hi Mr Papa and thank you very much.

 

It's almost working, but i got an error message saying that there is an invalid database request, and the date shown is 01/01/1970

 

I'm using the Unified theme, pasted the first line of the code in the very beginning of the file spTopicView.php, just before # == ADD POST FORM - OBJECT DEFINITION ========================

Then i have pasted the second line where i wanted the dateto be shown, just after:

if (function_exists('sp_RelatedTopicsButton')) sp_RelatedTopicsButton('tagClass=spRelated spLeft spButton', __sp('Related Tags'), __sp('Get a list of related topics based on tags for this topic'));
}

 

The result is exactly what i needed excepted the error.

I did something wrong ?

Sans-titre-1-2.jpgImage Enlarger

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

Is it just that there was a faulty entity in Steve's code. It should be:

$topic_expire = spdb_table(SFTOPICS, "topic_id=$spThisTopic->topic_id", 'expire_date');
echo 'Topic Expires: '.date('l, F j, Y', strtotime($topic_expire));

Note the -> in $spThisTopic->topic_id...

Could that be the problem?

andy-signature.png
YELLOW
SWORDFISH
Avatar
laurent enselme
Member
sp_UserOfflineSmall Offline
Aug 9, 2015 - 9:17 am

Thank you, but no the problem is still the same.

 

Btw here is what i git in the error journal:

 

9 août 2015 à 15:14 | spaErrError | 2 | database


file: /var/www/catalogues/wp-content/sp-resources/forum-themes/unified/templates/spTopicView.php
line: 13
function: spdb_table
error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1

SELECT expire_date FROM wp_sftopics WHERE topic_id=

 

Could help ?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 9, 2015 - 9:51 am

Could you copy and paste this part of the code here that you have used on your template please?

andy-signature.png
YELLOW
SWORDFISH
Avatar
laurent enselme
Member
sp_UserOfflineSmall Offline
Aug 9, 2015 - 9:58 am

Edit: solved - working fine, was my fault the second time 🙂

 

Thanks a lot for the help !

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 9, 2015 - 1:36 pm

interesting... we might need to check how my code (pasted directly from my working test) got converted to html entities... that should not be happening...

but glad you got it working...

Avatar
laurent enselme
Member
sp_UserOfflineSmall Offline
Aug 11, 2015 - 7:48 am

Got a new question about this plugin please.

In the topic list, is it possible to have a visualization when an expiration date has been set ?

Something like that:

Sans-titre-1-3.jpgImage Enlarger

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 11, 2015 - 1:58 pm

I will let @mr-papa correct me if I am wrong as well as give more detail - but I do know that we have added a new template tag for this in the next plugin release which will along very soon now.

andy-signature.png
YELLOW
SWORDFISH
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