News:

Join the Facebook Fan Page.

Main Menu

BoardJump

Started by Robert., January 10, 2012, 01:10:25 PM

Previous topic - Next topic

Robert.

Link to Mod

Boardjump mod v1.0
Description
With the boardjump mod you can jump to other boards quickly, like the jumpbox in the topic list. Unfortunately there is only 1 file edit required, because I didn't know where to put it elsewhere. I searched quite a long time, but I couldn't find it so I just decided to do a file edit instead. This mod requires SMF 2.0.x. This could work on other versions, but those are untested. Thanks to the SMF customization team for the rewrite. :)

Changelog
1.0
==============
- Initial release


Support
Support is available in the support topic, but I prefer answering support questions at my own site instead. You can use the English Help board for that.

Enjoy!

Robert.

Thanks for the approve :)

Bugo

QuoteUnfortunately there is only 1 file edit required, because I didn't know where to put it elsewhere.
You know there is a simple solution, with 2 hooks, 1 source file and 1 template file.

File hooks.php
<?php

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif(!
defined('SMF'))
die('<b>Error:</b> Cannot install - please verify that you put this file in the same place as SMF\'s index.php and SSI.php files.');

if ((
SMF == 'SSI') && !$user_info['is_admin'])
die('Admin privileges required.');

// Hooks
$hooks = array(
'integrate_pre_include' => '$sourcedir/Subs-BoardJump.php',
'integrate_load_theme' => 'boardjump_load_theme'
);

if (!empty(
$context['uninstalling']))
$call 'remove_integration_function';
else
$call 'add_integration_function';

foreach (
$hooks as $hook => $function)
$call($hook$function);

if (
SMF == 'SSI')
echo 'Database changes are complete! Please wait...';

?>


File Subs-BoardJump.php
<?php

if (!defined('SMF'))
die('Hacking attempt...');

function 
boardjump_load_theme()
{
global $context;

if (empty($context['current_action']))
{
loadTemplate('BoardJump');
$context['template_layers'][] = 'boardjump';
}
}

?>


File BoardJump.template.php (board list on top)
<?php

function template_boardjump_above()
{
global $context$txt;

if (empty($context['categories'])) return;

echo '
<div class="windowbg" style="margin-top: 10px;">
<span class="topslice"><span></span></span>
<div class="content">
<form action="">
<label for="jump_above">'
$txt['jump_to'], ':</label>
<select name="board" id="jump_above">'
;

foreach ($context['categories'] as $category)
{
echo '
<optgroup label="'
$category['name'], '">';

foreach ($category['boards'] as $id_board => $board)
echo '
<option value="'
$id_board'">'$board['name'], '</option>';

echo '
</optgroup>'
;
}

echo '
</select>
<input type="submit" class="button_submit" value="'
$txt['go'], '" style="text-transform: capitalize;" />
</form>
</div>
<span class="botslice"><span></span></span>
</div>
<br class="clear" />'
;
}

function 
template_boardjump_below()
{
}

?>


Or ... file BoardJump.template.php (board list on bottom)
<?php

function template_boardjump_above()
{
}

function 
template_boardjump_below()
{
global $context$txt;

if (empty($context['categories'])) return;

echo '
<div class="windowbg" style="margin-top: 10px;">
<span class="topslice"><span></span></span>
<div class="content">
<form action="">
<label for="jump_below">'
$txt['jump_to'], ':</label>
<select name="board" id="jump_below">'
;

foreach ($context['categories'] as $category)
{
echo '
<optgroup label="'
$category['name'], '">';

foreach ($category['boards'] as $id_board => $board)
echo '
<option value="'
$id_board'">'$board['name'], '</option>';

echo '
</optgroup>'
;
}

echo '
</select>
<input type="submit" class="button_submit" value="'
$txt['go'], '" style="text-transform: capitalize;" />
</form>
</div>
<span class="botslice"><span></span></span>
</div>
<br class="clear" />'
;
}

?>

Robert.

Thanks, considering that for the next version. :)

Ascot

Hi, can you show us some pictures or video on how it's working?
Were added Bugo's changes since his last response?

Robert.

Quote from: Ascot on May 15, 2012, 01:12:11 PM
Hi, can you show us some pictures or video on how it's working?
Sure, but I don't really have much time now. I'll try adding it as soon as possible, please send me a pm if I don't within a month. ;)

QuoteWere added Bugo's changes since his last response?
Nope, not yet, haven't edited this mod since the initial release. ;)

Ascot

Hi, can someone help  me to put this on a portal block?
I use simpleportal.

boo2

Quote from: Bugo on January 10, 2012, 05:30:12 PM
QuoteUnfortunately there is only 1 file edit required, because I didn't know where to put it elsewhere.
You know there is a simple solution, with 2 hooks, 1 source file and 1 template file.
Dr. Deejays didn't work so I followed your post and hooks worked fine, put all the files where they are supposed to go but it didn't say what makes it show up? And where?

I too would like to put it in a block on simple portal where it would be most useful to me, but I have tried bits of the code in a block and can't make it work, because I really don't know what the code means.. lol

Doesn't look like Dr. Deejay is coming back. Could you explain how your code works? I have all installed by have no idea how to make it show up where I need it. I hope this thread isn't dead, would like to see this work.
Using smf 2.0.2 and
Ignore User Button 1.0
Adk topic button 1.0
Bookmarks 2.5
Ultimate Profile 0.9.1
Dynamic_Memberlist 2.0.6
SimplePortal 2.3.5
Buddies List 1.0.1
Simple Audio Video Embedder 2.0.6
Default Avatar    2.2 
SMF Gallery Lite 3.1.3
Quote and Split 0.1.2

Bugo

Quote from: boo2 on October 04, 2012, 12:26:36 AM
I too would like to put it in a block on simple portal where it would be most useful to me, but I have tried bits of the code in a block and can't make it work, because I really don't know what the code means.. lol
Well, just create a PHP block and paste this code:

global $context, $sourcedir, $modSettings, $txt;

if (empty($context['categories']))
{
require_once($sourcedir . '/Subs-BoardIndex.php');
$boardIndexOptions = array(
'include_categories' => true,
'base_level' => 0,
'parent_id' => 0,
'set_latest_post' => true,
'countChildPosts' => !empty($modSettings['countChildPosts']),
);
$context['categories'] = getBoardIndex($boardIndexOptions);
}

if (empty($context['categories'])) return;

echo '
<div class="windowbg" style="margin-top: 10px;">
<span class="topslice"><span></span></span>
<div class="content">
<form action="">
<label for="jump_below">', $txt['jump_to'], ':</label>
<select name="board" id="jump_below">';

foreach ($context['categories'] as $category)
{
echo '
<optgroup label="', $category['name'], '">';

foreach ($category['boards'] as $id_board => $board)
echo '
<option value="', $id_board, '">', $board['name'], '</option>';

echo '
</optgroup>';
}

echo '
</select>
<input type="submit" class="button_submit" value="', $txt['go'], '" style="text-transform: capitalize;" />
</form>
</div>
<span class="botslice"><span></span></span>
</div>
<br class="clear" />';

boo2

Wow, that's great Bugo. After hours of messing with this thing it's a real treat to see it work.

Three things:

1. Could you make it go to the selected item with out the go button, like the regular jumpto does?

2. And I have Adk Topic button I found here: http://custom.simplemachines.org/mods/index.php?mod=3073

Could you make a 'separate' jumpto bit of code like this, that does something a bit different than this one, I'd find both useful.  Make another one, that when the item is selected, will take the person directly to the post new topic page for that item? Not sure I said that right, but that is what the adk topic button does. You click the icon next to a particular forum to start a new topic in that forum.

3. Question: would this same code you have for a block work where ever you wanted to put it, for instance would it work in the header, so it would be seen no matter where the person was? I'm sure that would be handy for those that would not want to switch back to the portal to get to it. Dr. Deejay's code placed in board index did nothing at all, but that could be because I have the whole entire info center removed for my purposes. Not sure. I am going to remove Dr. Deejays code, unless there's a reason to keep it, since I am using the code you posted originally.

Hope I am not pushing my luck and asking for too much.  :-\
Using smf 2.0.2 and
Ignore User Button 1.0
Adk topic button 1.0
Bookmarks 2.5
Ultimate Profile 0.9.1
Dynamic_Memberlist 2.0.6
SimplePortal 2.3.5
Buddies List 1.0.1
Simple Audio Video Embedder 2.0.6
Default Avatar    2.2 
SMF Gallery Lite 3.1.3
Quote and Split 0.1.2


boo2

#11
Ok anyone who wants this and is stumped on how to make the block code jump directly to the board with out go button, or to make the jump go directly to make a new topic for that board, heres the answer. Now it works the way I wanted it originally.

http://simpleportal.net/index.php?topic=11912.new;topicseen#new

many thanks to Phantomm for working this out for me.
Using smf 2.0.2 and
Ignore User Button 1.0
Adk topic button 1.0
Bookmarks 2.5
Ultimate Profile 0.9.1
Dynamic_Memberlist 2.0.6
SimplePortal 2.3.5
Buddies List 1.0.1
Simple Audio Video Embedder 2.0.6
Default Avatar    2.2 
SMF Gallery Lite 3.1.3
Quote and Split 0.1.2

Robert.

This mod should work fine on 2.0.3. :)

Fredisland

Hello Robert.
Did you find the time to makethe hook version for your mod ? Because I love the fact options have all a style, they are not only in pure and boring text.
Thank you.
Fred, from France.

Advertisement: