Hello,
I don't speak english very well, so sorry for this
I "build" a forum dedicated to referencing french free contests (list of websites promotions to win price...) and members who posted a thread have a Textbox field (with a Text Mask Filter to DATE ) MUST be completed.
This date is the deadline for participation for each contest...i'm looking for a way to sort thread by "deadline for participation" ,it would be much easier for my moderators to remove the finished contests topics.
...and maybe after that ,ideally, it's was a way to automatically move or delete topics with time exceeded ?
Tell me if my question is not understandable...
Thanks
If you want sorting, you'll need to make a numerical field for the date.
Use the Integer data type (note, if you change your existing field, you'll lose any stored data!) and use the input/output conversion functions to convert to/from a textual date.
It's a little tricky to do unfortunately.
Example input formatter:
Example output formatter:
Thank for you answer...i make few test and all is not clear for me :/
I complete field with "04/11/1983" result is "11 04 1983" ...result must be "04 novembre 1983" or "04 11 1983" (put text input display format on standby for the moment...is not really a problem)
How output a french date format day/month/year ?
...i'm test with this, without succes :
Quote:<?=date('d m Y', {VALUE})?>
So, after this problem ,I don't understand how sort thread by this date after that too? can you tell me more explications please ?
"make a numerical field"...don't understand... i have make a Textbox field (with a Text Mask Filter to DATE ), is not good?
I have make few search in this forum and i don't see any exemples who can help me...
Now that I think about it, you can probably sort by text, but the date needs to be inputted differently.
If you want to do this, ignore what I said above, and use a custom text mask filter:
Code:
^((?:19|20)\d\d)/(0?[1-9]|1[012])/(0?[1-9]|[12]\d|3[01])$
|
This will allow "1983/11/04" - which makes it sortable.
Note that if you already have existing data, you'll need to convert it to the new format.
For the output format, try something like:
Code:
<?=date('d F Y', strtotime({VALUE}))?>
|
Sorting is explained in the supplied documentation (the "Documentation" folder in the XThreads download package).
Basically, just reuse MyBB's sortby parameter, eg "forumdisplay.php?fid=2&sortby=tf_myfield"
I have try your solution and that don't work...output display is always "01 January 1970"
But with this
Code:
^((?:19|20)\d\d)/(0?[1-9]|1[012])/(0?[1-9]|[12]\d|3[01])$
|
and
Code:
<?=date('d m Y', {VALUE})?>
|
With this code if i put 2015/12/30 on field, the result is 30 12 2015..it's ok for french format display. But the input method YYYY/MM/DD is bad for french people, i need dd/mm/yyyy input and dd/mm/yyyy output.
Is almost perfect, it's just the input format who is strange for us, so a solution will be add a datepicker jquery...i will try this.
Quote:Sorting is explained in the supplied documentation (the "Documentation" folder in the XThreads download package).
Basically, just reuse MyBB's sortby parameter, eg "forumdisplay.php?fid=2&sortby=tf_myfield"
I'm stupid...for this the problem is solved, that work well ^^
Thank you
I finally use datepicker jquery for the input format.
I up this topic beacause i'm looking for how make a "Daily task" who move topics to "trash forum" if the deadline exceeded ? is it possible ?
Thank
Unfortunately you'd need a custom script to go through all the threads and check the date and consider what to do with it.
If moderators are setting the time, you might be able to use the delayed moderation feature.
(10-24-2014 03:51 PM)ZiNgA BuRgA Wrote: [ -> ]Unfortunately you'd need a custom script to go through all the threads and check the date and consider what to do with it.
If moderators are setting the time, you might be able to use the delayed moderation feature.
Thank you, i do a daily php cronjob, it work well but....
(thread is automatically moved if dateline is exceeded and goes to trashbin forum)
...but the moved thread is blank (firstpost only..the firstpost contain only custom xthread fields), i can i fix this please ?
When a edit this blank post i see my xthread fields..so xthread data are not loose, just invisible...need to complete this query, i have forget a thing....
This is my query (i use classic mysql query, this php file is not join to mybb pages):
PHP Code:
UPDATE threads
LEFT JOIN threadfields_data
ON threads.tid=threadfields_data.tid
SET threads.fid='61'
WHERE threads.fid='8'
AND testdate < UNIX_TIMESTAMP()";
|
It can't be done properly with just a query, since counters etc will get messed up.
But for your particular issue, I suspect it's perhaps a template?