View Full Version : [BETA] Favorite Threads
Ok my version of the save threads hack is now in beta. I would appreciate if you could test it by going to Favorites (http://www.hedgehogwheels.com/forums/favorites.php).
If you already have an account than please use it or create one (I dont mind!).
Features:
- Users can add a thread to their favorites by using a link on each thread page.
- Users can create folders to categorize their threads
- Users can open and close folders to hide/show their threads
- Users can move muliple threads in and out of folders
- Users can delete multiple threads
- Users can create a new folder at the time of adding a thread or can visit favorites and create folders.
- Folders can be deleted and re-named
- If a thread is deleted by an admin/mod then it won't show up in the users's favorites anymore
- the threads appear just as they would on the forumdisplay with hot/newfolders, thread icons, last poster, etc etc
Only thing missing is for me to break it into pages and any other ideas by you. Please test it out, try to break it and give me ideas for other features. Hopefully this is something that can be included into vB by default.
Caveats - "Invisible Threads" would show up as I don't use them and forgot to hide them in the favorites (will do).
[Edited by rangersfan on 10-23-2000 at 09:19 PM]
Its Brillant :)
I made a folder for myself on that test account. Hope it was allowed?
Yes make whatever you want, delete whatever you want (it is a test to find bugs!)
cheers
and so far I found no bugs. :)
Same here.
/me goes back to reoing his forums after he messed up installing the ignore hack.
Anyone every thought of a hack, where the hack would allow other hacks to work, without editing the orgianl files?
Well this hack does not require you to edit any code, and you only have to edit two templates, one to place the link to add a thread in showthread and one to favorites.php in fivelinks.
Here is something to think about...
If a thread is moved to a Private forum it should be deleted from a user's saved threads just as if it was deleted altogether.
Recently I have had my moderators start moving threads to a forum called "purgatory" instead of deleting them. This is for questionable threads only and allows us to "restore" them in necessary.
I have thought about that scenario but doing that will require editing postings.php to modify the favorites table. Simple issue and I will leave it up to those who use the hack to make the change or not since a person would only be able to see the thread title, not be able to open it.
This hack has won a spot in my Sig.
Well Done RangersFan :)
What a cool hack! I'm sure our users will absolutely love that. Where can we get a hold of the code for this hack?
Thanks, rangersfan!
Later today (hopefully) after I add the code to check if threads or invisible or unavailable to a user. The scenario is possible that a user adds a thread and then loses access to the forum the thread lives in or the thread is moved to a forum the user doesn't have access to.
Ok I hacked the hack so that if a thread is "invisible" it will not be shown in the users favorites.
Also it nows checks if a user has access to a thread before showing it in their favorites.
The idea is that a user may have added a thread and now has lost access to it for reasons shown in my previous post. The thread isn't actually removed from his/her list but is just not shown to them. This will allow it to "re-appear" to them if they are again given access to it. The thread table is very small as it only contains 3 id fields, the thread id, the id of the folder it goes in (if it has one) and the id of the field itself.
Below is my access checking code. My main goal has been as little database access as possible and I believe John needs to do this sort of thing in other places to help the optimization. I could have queried the database for every thread to decide to post it or not but that is bad design and something vB is very guilty of doing. My way of doing it is to build parts of your query using logic and then put your constructed query to work in the main query:
// These usergroups really need to be re-done, this is a nightmare!
// This gets the forums that our usergroup has SPECIFIC canview access to (0 or 1)
$q_perms = $DB_site->query("SELECT forumid,canview FROM forumpermission
WHERE usergroupid = $bbusergroupid");
// This gets our generic canview access
// If we do not have a specific access defined in the first query than we use the second query
// for our access to that forum.
$q_uperms = $DB_site->query_first("SELECT canview FROM usergroup WHERE usergroupid = $bbusergroupid");
$canview = $q_uperms[canview];
// $canview = 0 / We can't view any forums unless we have specific access to above
// $canview = 1 / We can view all forums unless we have specific access not to above
if ($canview == 1) // We view all forums by default, hide those we have explicit non access to
{
while ($query = $DB_site->fetch_array($q_perms))
{
$onethread = 0;
if ($query[canview] == 0)
{
if ($onethread == 0)
{
$forums .= " AND (forumid <> $query[forumid] ";
$onethread = 1;
}
else
{
$forums .= " OR forumid <> $query[forumid] ";
}
}
}
if ($onethread == 1)
{
$forums .= ")";
}
}
else // We can view no forums by default, show those we have explicit read access to
{
while ($query = $DB_site->fetch_array($q_perms))
{
$onethread = 0;
if ($query[canview] == 1)
{
if ($onethread == 0)
{
$forums .= " AND (forumid = $query[forumid] ";
$onethread = 1;
}
else
{
$forums .= " OR forumid = $query[forumid] ";
}
}
}
if ($onethread == 1)
{
$forums .= ")";
}
}
$q_thread = $DB_site->query("SELECT thread.iconid, icon.title AS icontitle, icon.iconpath, open, thread.title AS threadtitle,
lastpost, postusername,lastposter, views, replycount, fav_threads.userid, fav_threads.threadid,
fav_threads.folderid, folder
FROM fav_threads,thread
LEFT JOIN fav_folders ON (fav_threads.folderid = fav_folders.folderid)
LEFT JOIN icon ON (icon.iconid = thread.iconid)
WHERE fav_threads.userid = $bbuserid
AND thread.threadid = fav_threads.threadid
AND thread.visible = 1
$forums
ORDER by folder,thread.title");
I then take "$forums" and place it into my main query that retrieves the threads. Remember I only have one query that gets everything for showing the threads (it gets the icons, the posters, everything that is shown normally when you look at a list of threads in a normal forum). Can we say forumdisplay is need of a query optimization (I think so).
Let me put in page breaks for long pages and I will be done (which isn't easy as I like to make sure to return you to the page you were on from any function you may access)
[Edited by rangersfan on 10-24-2000 at 01:12 PM]
Ok I do believe the hack is finished. Pageing is in place and no problems so far. Give me time to convert the templates to the proper vB format and I will release it. (My templates are different as I put all the links and graphics in an include file so I can use them across other pages outside the actual forum)
This is really cool.. I think though that TWTCommish deserves at least partial credit. If at least only for the Idea.. I can use this for another feature I wanted to do as well... Very Very Nice.
Wow! This is great! I feel like a kid on Christmas morning waiting to see what the great Rangersfan is gonna bring for presents!
Great job on the hack so far Rangersfan, and thanks for invoking the inspiration TWTCommish...You deserve a great deal of credit indeed.
Thanks for making a great product better guys! This hack should definately be looked at for inclusion in the default code. Bravo for the reduction in sql queries as well, mySQL DB would not be able to handle much more than she is.
rick
Please close this thread Ed.
Who install this hack ?
i want to see other demo .
cos i am worry about editing the database .
Thank you :)
I installed it and it was simple to work.
Not much editing to your database as it adds a few tables.
Originally posted by freddie
Please close this thread Ed. Sorry 'bout that -- missed it :) If you need to discuss for whatever reason, use a new thread or something.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.