TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 696
  • Total: 696

Block for Bookmarks?

Started by MTF95, May 01, 2008, 08:22:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MTF95

Hi!

I'm using tihs mod:
http://custom.simplemachines.org/mods/index.php?mod=864

How do I create a block which shows 5 random bookmarks that the active user has, and a link to show all bookmarks?

Dragooon

This is a shot in dark, but seeing its table structure it should work
Add this in a php Block
global $ID_MEMBER, $scripturl, $db_prefix;
$request = db_query("SELECT t.ID_TOPIC, m.subject, mem.ID_MEMBER, mem.realName
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}bookmarks AS bm ON (bm.ID_TOPIC = t.ID_TOPIC AND bm.ID_MEMBER = $ID_MEMBER)
INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
ORDER BY RAND()
LIMIT 5",__FILE__,__LINE__);
$topics = array();
while($row = mysql_fetch_assoc($request)) {
$topics[] = '<a href="'.$scripturl.'?topic='.$row['ID_TOPIC'].'">'.$row['subject'].'</a> by <a href="'.$scripturl.'?action=profile;u='.$row['ID_MEMBER'].'">'.$row['realName'].'</a>';
}
mysql_free_result($request);
foreach($topics as $t)
echo '<div class="smalltext">',$t,'</div>';

MTF95

I'll try that when I get my new server!

NIBOGO

Quote from: Dragooon on May 01, 2008, 12:58:31 PM
This is a shot in dark, but seeing its table structure it should work
Add this in a php Block
global $ID_MEMBER, $scripturl, $db_prefix;
$request = db_query("SELECT t.ID_TOPIC, m.subject, mem.ID_MEMBER, mem.realName
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}bookmarks AS bm ON (bm.ID_TOPIC = t.ID_TOPIC AND bm.ID_MEMBER = $ID_MEMBER)
INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
ORDER BY RAND()
LIMIT 5",__FILE__,__LINE__);
$topics = array();
while($row = mysql_fetch_assoc($request)) {
$topics[] = '<a href="'.$scripturl.'?topic='.$row['ID_TOPIC'].'">'.$row['subject'].'</a> by <a href="'.$scripturl.'?action=profile;u='.$row['ID_MEMBER'].'">'.$row['realName'].'</a>';
}
mysql_free_result($request);
foreach($topics as $t)
echo '<div class="smalltext">',$t,'</div>';


WOW!!! you are awesome

MatthewSchenker

I don't have the Bookmark modification installed, but I would love to have a bookmark script I could add to a block in my forum.  I think being able to bookmark favorite topics is a great idea.

Is there a script I could run without installing the bookmark modification?

Thanks,
Matt

JPDeni

The only script I know of is the modification. If someone were to write another script, it would be the same as the mod.

MatthewSchenker

Quote from: JPDeni on May 16, 2008, 11:26:14 PM
The only script I know of is the modification. If someone were to write another script, it would be the same as the mod.

But the mod puts the "Bookmark" link in the main menu.  I was wondering how to get the "Bookmark" link to appear in a block.  Maybe in the "User" block?

I apologize if I'm missing something really obvious here!

Thanks,
Matt

b33znutz

installed and works great with the mod! cheers mate! :up: :up:

Angelotus

Hi, can you modifie te code for SMF 2.0?

Dragooon

Eh no because there is no TP For SMF 2?

This website is proudly hosted on Crocweb Cloud Website Hosting.