Support Forum
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
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...
Visit Cruise Talk Central and Mr Papa's World
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 ?
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?
YELLOW
SWORDFISH
|
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 ?
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...
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)