Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Using XThreads Custom Thread Field to Hold Additional Data
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #7
RE: Using XThreads Custom Thread Field to Hold Additional Data
(03-29-2011 06:44 AM)RateU Wrote:  
(03-28-2011 11:52 PM)leefish Wrote:  I just think requiring the user to "mark" the thread will risk us having incomplete data.
I'm sorry, I can't understand what you meant by the 'incomplete data'?
By incomplete data I mean that there would be the chance that a downloader did not mark all the threads they downloaded - sometimes deliberately not, sometimes because they forgot.


(03-29-2011 06:44 AM)RateU Wrote:  
(03-28-2011 11:52 PM)leefish Wrote:  If this was a new install I would think it would be better that the action of downloading the item automatically updated the existing table.
If you already edit the XThreads file, I think you can stick the code there.

By the new install I was referring to a MYBB install rather than an XThreads Install. In an existing forum then there probably are downloads already, so having the user mark as download is the way to go as data is already incomplete. Its also a lot easier than trying to hook into XThreads.....(maybe thats because I am a noob at coding though)

However, on a NEW FORUM INSTALL, with XThreads in there from day one,  then catching the data at the moment of download is the way to go (IMO). That way you get a complete record.


(03-29-2011 06:44 AM)RateU Wrote:  
(03-28-2011 11:52 PM)leefish Wrote:  I already have something "hooked" onto that bit of the xthreads.attach.php...... if it was possible to add them both then that would be cool, but I see that there may be an issue with guest downloads.
Probably create other dedicated table with this structure:

did => Primary Key
aid => attachment id
tid => thread id
uid => user id (downloader)
lastupdate => the updatetime of the attachment being downloaded. Probably you need to edit your query to load the update time of the attachment being downloaded, and record the result into this field.

Update/insert the fields when a user download an attachment.
Hmm, I am unsure as to the did as the primary key - I would have thought the user ID, then check to see if they had already downloaded? Table design is a new area for me though, so you are probably right.



(03-29-2011 06:44 AM)RateU Wrote:  
(03-28-2011 11:52 PM)leefish Wrote:  but I see that there may be an issue with guest downloads.
Check whether the user has an uid or not before run the update/insert query?
See the point from Zinga -I was unable to work out  how to hook into WHO had downloaded stuff  - now I see why..... so in order to see IF its a guest I would need to load the session (and the mybb core) - would that have a slowdown effect?



(03-29-2011 06:44 AM)RateU Wrote:  
(03-28-2011 11:52 PM)leefish Wrote:  I would definitely see this as a thing for the downloader/admin to use, and for the actual uploader to have no visibility on WHO downloaded the thread. In my experience it could cause squabbles and friction if an uploader discovers that user x downloaded and did not thank the thread (simmers are very emotional).
I think in showthread you can check whether a user is admin or not before run a query (if you want to display who downloaded the attachment in this page) from the table (select uid, and put tid in WHERE clause)?

Yes, I would do that too Smile



(03-29-2011 06:44 AM)RateU Wrote:  In usercp (using a specified action maybe), run a query (put uid in WHERE clause). I think you need to join the xtattachments table with this query, so you can compare the lastupdate and the updatetime.
Re the "My Downloads" view - yes, definitely a USERCP thing - the way I have it at the moment with my stats for uploaders is that the user will see threads in their stats  IF they have uploaded something - I would think a similar approach would work to check if user id is in the table then show results.


Re the remark from Zingaburga:
Aha - when I fastened on the query I have I found that it was rather difficult to get that user data - that explains why I was unable to do anything other than play about with the actual xattachments data. Of course, for what I have now, who downloaded was not a consideration.


[Image: leelink.gif]
MYBB1.6 & XThreads
03-29-2011 08:34 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: Using XThreads Custom Thread Field to Hold Additional Data - leefish - 03-29-2011 08:34 AM

 Standard Tools
Forum Jump: