[DEV] Multiple Boards on a Single Database

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Anti-Spam Guide
the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [DEV] Multiple Boards on a Single Database

Post by the pips »

master412160 wrote:
Somewhere around line 29 is the call to the display forums function.
I made it like this then:

Code: Select all

display_forums('', $config['load_moderators'], false, $board2);
It doesn't particularly matter what variable you use but you'd need set it to the board you want displayed.
1=default
2=1st additional board
4=2nd additional board
8=3rd additional board
etc

Also go into ACP/Forums and for each forum select which board(s) you want it to be visible in.

Regards
Doug
User avatar
master412160
Registered User
Posts: 314
Joined: Sat May 22, 2010 5:45 pm
Name: Max Pen

Re: [DEV] Multiple Boards on a Single Database

Post by master412160 »

The install went succesful! And I see thanks for the explination.


Now I have a new type of error on index:

Code: Select all

SQL ERROR [ mysqli ]

Incorrect integer value: '' for column 'board' at row 1 [1366]

SQL

UPDATE phpbb_sessions SET board = "" WHERE session_id = "id code here"

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/includes/db/dbal.php
LINE: 757
CALL: trigger_error()

FILE: [ROOT]/includes/db/mysqli.php
LINE: 182
CALL: dbal->sql_error()

FILE: [ROOT]/includes/functions.php
LINE: 77
CALL: dbal_mysqli->sql_query()

FILE: [ROOT]/includes/functions_display.php
LINE: 28
CALL: set_board()

FILE: [ROOT]/index.php
LINE: 30
CALL: display_forums()
Regards, Matt.
User avatar
Blue Blood
Registered User
Posts: 767
Joined: Sat Apr 11, 2009 7:09 am
Location: U§A
Name: Blue Blood

Re: [DEV] Multiple Boards on a Single Database

Post by Blue Blood »

Yeah I'm not understanding this ether??
I installed all the edits via automod and installed the DB, refreshed and purged

But this I have no ideal what your talking about here...
Please don't forget that you need to set the board number. You can do this by setting the appropriate board number in index php or calling set_board(VALUE) where value equals the board.
the pips wrote: Somewhere around line 29 is the call to the display forums function.

Code: Select all

display_forums('', $config['load_moderators'], false, $board);
I've modified the function to accept an additional parameter - $board. To display the standard board you should set this to 1. To display another board set it to 2, 4, 8 etc
The board number is stored in the session table so you don't need to change it anywhere else.
Do I do it like this
display_forums('4', $config['load_moderators'], false, $board);
or
display_forums('', $config['load_moderators'], false, $board4);


also are there no template file edits.
I don't see the drop down box on index and in the ACP???
Thanks!!
the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [DEV] Multiple Boards on a Single Database

Post by the pips »

master412160 wrote:The install went succesful! And I see thanks for the explination.
Great!
master412160 wrote: Now I have a new type of error on index:

Code: Select all

SQL ERROR [ mysqli ]

Incorrect integer value: '' for column 'board' at row 1 [1366]

SQL

UPDATE phpbb_sessions SET board = "" WHERE session_id = "id code here"
[/quote]

That's really weird. I've no idea why the session_id is set to 'id code here". Do you have any other mods installed?

[quote="master412160"]

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/includes/db/dbal.php
LINE: 757
CALL: trigger_error()

FILE: [ROOT]/includes/db/mysqli.php
LINE: 182
CALL: dbal->sql_error()

FILE: [ROOT]/includes/functions.php
LINE: 77
CALL: dbal_mysqli->sql_query()

FILE: [ROOT]/includes/functions_display.php
LINE: 28
CALL: set_board()

FILE: [ROOT]/index.php
LINE: 30
CALL: display_forums()
The error is quite explicit, you aren't setting $board to an integer. If you don't pass a value it will default to board 1.

Regards
Doug
the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [DEV] Multiple Boards on a Single Database

Post by the pips »

Blue Blood wrote:Yeah I'm not understanding this ether??
I installed all the edits via automod and installed the DB, refreshed and purged

But this I have no ideal what your talking about here...
Please don't forget that you need to set the board number. You can do this by setting the appropriate board number in index php or calling set_board(VALUE) where value equals the board.
the pips wrote: Somewhere around line 29 is the call to the display forums function.

Code: Select all

display_forums('', $config['load_moderators'], false, $board);
I've modified the function to accept an additional parameter - $board. To display the standard board you should set this to 1. To display another board set it to 2, 4, 8 etc
The board number is stored in the session table so you don't need to change it anywhere else.
Do I do it like this
display_forums('4', $config['load_moderators'], false, $board);
or
display_forums('', $config['load_moderators'], false, $board4);
Set $board to the value you want. Leave it out completely if you want the default board to be presented.
I've got a number of websites that all use the same database. Each website has it's own code so I've set the value accordingly.
For my default website I've left $board out completely.
In my Shopping mod website I've set $board to 2.
In my Calendar mod website I've set $board to 4.

If you want to use the same codebase for more than one website then you'd need to work out a method of setting the board number.
Blue Blood wrote: also are there no template file edits.
I don't see the drop down box on index and in the ACP???
Thanks!!
That was a quick hack to allow demonstrate how you can switch from one board (subset of forums) to another. I can put the code together for you if you'd like.

Regards
Doug
User avatar
master412160
Registered User
Posts: 314
Joined: Sat May 22, 2010 5:45 pm
Name: Max Pen

Re: [DEV] Multiple Boards on a Single Database

Post by master412160 »

I still don't understand how one uses this mod. :|

I want it to work for different code bases of the forums or just for all the same base.

I got currently a real board which I'll call: "board A" and want to have a "board B". so in the drop down on index should show "Main" and "Board B"

Both options explained or coded would be nice.

I removed the 2 from: display_forums('', $config['load_moderators'], false, $board); and now my error is gone but your mod doesn't work for me. I don't know how to use it.

There is no drop down in the acp when editing forums.

Your making this to complex. I can't code, don't know a thing about php.

It should be explained less technically and demonstrated more user friendly. :)

I have installed and used tons of mods but this one is not explained enough.

Actually I don't need explanations but just the codes that make it happen. :D

Regards,
Matt.
Regards, Matt.
the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [DEV] Multiple Boards on a Single Database

Post by the pips »

master412160 wrote:I still don't understand how one uses this mod. :|

I want it to work for different code bases of the forums or just for all the same base.

I got currently a real board which I'll call: "board A" and want to have a "board B". so in the drop down on index should show "Main" and "Board B"

Both options explained or coded would be nice.

I removed the 2 from: display_forums('', $config['load_moderators'], false, $board); and now my error is gone but your mod doesn't work for me. I don't know how to use it.

There is no drop down in the acp when editing forums.

Your making this to complex. I can't code, don't know a thing about php.

It should be explained less technically and demonstrated more user friendly. :)

I have installed and used tons of mods but this one is not explained enough.

Actually I don't need explanations but just the codes that make it happen. :D

Regards,
Matt.
As I've said before, this isn't a conventional mod. All it does is to provide YOU with a way to present a subset of forums to the person viewing.
  • Install the mod
  • Decide on the names for each board
  • Open root/language/en/common.php and edit the descriptions. Add or delete as many as you like but leave at least board_0.
  • open the ACP, Forums
  • For each forum select the board names that the forum is to be visible in. This is a multi-select so you can choose more than one board
  • It's now a case of editing index.php in each code base to assign a board number. My personal preference is to use a variable and I place it near the top, Immediately after $user->setup('viewforum'); is a good place.

    Code: Select all

    $board = 1;
    The only gotcha is that this value is 2 raised to the power of the board number. e.g.
    • board_0 = 1
    • board_1 = 2
    • board_2 = 4
    • board_3 = 8
    • board_4 = 16
I hope that makes some sense but I'll try to put an extra install.xml together for you to present a list of board names. If you've got a particular scenario in mind please do let me know and I'll do whatever I can to help.

Regards
Doug
User avatar
master412160
Registered User
Posts: 314
Joined: Sat May 22, 2010 5:45 pm
Name: Max Pen

Re: [DEV] Multiple Boards on a Single Database

Post by master412160 »

My code in index.php:

Code: Select all

$user->setup('viewforum');
$board = 3;
/** Mod Multiforum */
$board = request_var('board', -1);
display_forums('', $config['load_moderators'], false, $board);
/** End Mod Multiforum */
But I don't find any drop down in the admin panel on the edit forum screen. :|

My code in common.php:

Code: Select all

// add up to 10 entries
	'BOARD'		=> 'Board',
	'BOARD_0'	=> 'Home',
	'BOARD_1'	=> 'Forums',
	'BOARD_2'	=> 'Shop',
	'BOARD_3'	=> '3rd Board',
If you've got a particular scenario in mind please do let me know and I'll do whatever I can to help.
Well what would be ideal for me is the following:

That I have a board A and B that have only 1 thing in common: the same userbase. So board A and B have a connected database for the registration process but nothing else.

So when someone registers on board A they also have a new account on board B.

Board A and B would have two different code bases.

Board A url: www.example.com

board B url: www.example.com/boardb

----

What I said i the above is probably not possible to create or is going to far of course for the purpose of this mod. But that would be the most ideal for me.

The second most ideal is:

What this mod does with a drop down on index allowing people to choose to go from forum to the other forums. As shown on your demo board.
Regards, Matt.
the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [DEV] Multiple Boards on a Single Database

Post by the pips »

I've cobbled a quick installmenu.xml that will add the drop down at the top of the page. Download it from http://www.development.arvclub.co.uk/do ... llmenu.xml

Regards
Doug
User avatar
Blue Blood
Registered User
Posts: 767
Joined: Sat Apr 11, 2009 7:09 am
Location: U§A
Name: Blue Blood

Re: [DEV] Multiple Boards on a Single Database

Post by Blue Blood »

I guess I just dont understand this...

I dont have the dropdown option in the ACP

I have added one but its not working as it should, or think it should...

You have a great ideal and I will be following the project..
I will just wait for a version with more detailed install instructions..

Thanks for the mod!!
User avatar
master412160
Registered User
Posts: 314
Joined: Sat May 22, 2010 5:45 pm
Name: Max Pen

Re: [DEV] Multiple Boards on a Single Database

Post by master412160 »

Agreed to what the person above said and your download url is not working.
Regards, Matt.
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

Re: [DEV] Multiple Boards on a Single Database

Post by all4phone »

Interesting mod, looking forward new release, keep going and thanks for your great work.
master412160 wrote:and your download url is not working.
Click
User avatar
master412160
Registered User
Posts: 314
Joined: Sat May 22, 2010 5:45 pm
Name: Max Pen

Re: [DEV] Multiple Boards on a Single Database

Post by master412160 »

Is this still being worked on?
Regards, Matt.
the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [DEV] Multiple Boards on a Single Database

Post by the pips »

Yes, I'm still working on it but please be aware that it will never be a self-contained mod. You WILL need to add some code to change to a different board.

Doug
User avatar
master412160
Registered User
Posts: 314
Joined: Sat May 22, 2010 5:45 pm
Name: Max Pen

Re: [DEV] Multiple Boards on a Single Database

Post by master412160 »

I don't mind that as long it is explained on what to do exactly. :)

At the moment I don't feel this mod is working out for anyone as per current instructions.
Regards, Matt.

Return to “[3.0.x] MODs in Development”