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?
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>';
I'll try that when I get my new server!
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
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
The only script I know of is the modification. If someone were to write another script, it would be the same as the mod.
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
installed and works great with the mod! cheers mate! :up: :up:
Hi, can you modifie te code for SMF 2.0?
Eh no because there is no TP For SMF 2?
Ew, that's true yes, I guess there will be a tp for 2.0 after a final release?
When is the next version of TP coming out? (http://docs.tinyportal.co.uk/index.php?topic=15)
Same goes for TP for SMF2, we have not even come to an alpha stage of tp for SMF 2