Please excuse the length of this post, but it seemed more appropriate in this instance to set sections in a single post rather than breaking it up...
1. BRIEF REPLIES
2. PONDERING FURTHER
3. NEW IDEA! (is it any good?)
=============================================================================
1. BRIEF REPONSES
@Matt: that's interesting. However, unless I missed something, it seems the question still remains "How would your wrapper be facilitated to decide/choose THE FORUM FROM THE OTHER BBS? I.e., where's it obtaining its INITIAL directive-var INFO from?"
I capitalized words I am adding here to try to make it less ambiguous.
So in your example, for instance, we do not know how or 'where/from' "alt" is intended to be intialized... how does the function know its gotta be 1 or 0?
And then where does the external db_table info get initialized?
***To be clear, I am more concerned with first discussing clarity to the general logicistics than worrying right now over any particular code or coding.**
Seems to me its critical to consider How any query is going to know it is being 'sent' anything from 'outside' the currrent BBS - where and how that is initially 'set' and 'held' for reference(?) Seems this will probably set the tone for decisions as to how anything shall be handled.
(...please read on, I had an idea...)
---------------------------------------------------
@r2d2:
1) yes to 'replies expected in both BBS's'.
2) Sorry, I posted and then I realized I misunderstood your post. I still may have it wrong, but it seems the intention might be to pull off the array I proposed for config.php?
If so, and maybe even if something else, sort of similar to my question with Matt's idea, how/where is the 'impetus' initially pulled from and then planted?
=============================================================================
2. PONDERING FURTHER.......
twohawks wrote:The idea would be adjusting the entry in config.php to something like...
$db_prefix = array(main, common);
...so in effect I think all you would need to do is adjust the db(.php) function handling slightly
Please Check My Logic Here....(New idea in #3 hinges on this one)
So we have 'this'>BBS and 'that'>BBS and then 'common'>BBS, where 'this' and 'that' represent unique BBS's, and 'common' is a BBS created for sharing ALL its db-tables with both the other BBS's ...and so 'common' is not a BBS anyone ever logs into directly.
What initially occurs to me in this scenario is that, in effect, ...well, a couple things...
-1- 'common' BBS would only need to be setup for the sake of initial creation of its tables, and then its prefix added to the config file (per the above suggested array) of any BBS that will attach to forums and topics that may be later created in 'common',
-2- when the admin creates a forum from within 'this' or 'that' BBS, in order to designate it as a "shared" forum a method would need to have been created to facilitate choosing which BBS to place a new forum into ...say, the primary (native) one or the 'common' one for sharing purposes. (SideNote: the reason we would not have the admin log into 'common' BBS directly for doing this is because then he/she could not readily assign permissions, because no relevant users/groups actually exist in 'common' BBS)...,
-3- anytime a new forum is created in 'common' it will immediately appear in both 'this' and 'that' BBS's (because all 'common-forum-tables' are always referred to, just as natively as any primary/native tables are),
-4- hence, any topics or posts added from either BBS into any 'common-forum' would naturally appear in both BBS's.
-5- because the 'common' db-tablesets would be present and accessible as natively and commonly to either BBS where 'common' is added to its $db_prefix array --> each BBS could set its own unique users permissions in the normal way and without conflicts;
...for instance, in 'this-BBS' you could set user permissions like you would for any other primary/native forums that were created there, and there would be no conflict with doing exactly the same thing independently in 'that-BBS'.
-6- users in each BBS would see each other's handles, but be unable to view each other's profiles (acceptable) or non-shared topics/posts (of course).
---------------------------------------------------
Unless I have grossly overlooked something, this seems like an elegant, or at least simple and workable, solution(?WHAT DO YOU THINK?), that is, short of having better 'logical' clarity on Matt's or r2d2's suggestions ...as to where the initial tie-in is intended for the desired "other forum's tables" (and maybe its there and I missed it? sorry).
NOTED SHORTCOMINGs WITH THIS METHOD:
It would seem that if there was possiblity for an elegant solution that does not rely on creating another BBS tableset (e.c. 'common'), or impose any sharing limitations, ...that would be the ideal really.
Conversely to what I have proposed above, a third ('common') BBS doesn't facilitate "true sharing" of any forums that may pre-exist in already established working BBS's - which seems would more naturally and effectively serve an admin's needs.
For instance, one BBS has a discussion or lesson underway and now the admin wants to share that with another group (another school)..., my above proposed solution would require moving the forum to the 'common' BBS - maybe doable, but that may introduce too many undesired ramifications to deal with (haven't even begun to think about it).
....what to do... ? .... ? ... ? ....
=============================================================================
3. **NEW IDEA** : instead of intercepting db_query to try to solve this, will intercepting forum_ids provide a more wholisticly viable solution?
IF the proposed logic above has sound viability while maintaing a fair amount of its proposed simplicity..., then... being inspired by the excellent feedback so far and thinking harder about my questions regarding how to initially tie into another BBS's forums...
...PLEASE CHECK ME ON THIS IDEA -->>
Based on the logic for tying into a third 'common' BBS, how about selectively tying directly into any foreign forums you choose?...
---REQUIRES 3 LOGICAL MODS (?)----------------------------------------
Short Version:
1) Pull in a list of forums from the other BBS for the Admin to make selections from (in admin_forums.php),
2) When selected, a unique forum_id is generated same as when you create a new one, but additionally a unique decimal number is formulated for identifying the specific foreign forum, and then that decimal value is addended to the fid,
3) Then when any fid/f_id is called in a query, if it contains a decimal value a function parses the value for targeting whichever foreign forum is being referred to.
...after that, everything should follow suit without any modifications to queries or code...
Details:
1. Create a Method for the Admin to choose any foreign BBS Forum(s) from within admin_forums.php.
HowTo-Logic:
- Create a new array variable in config.php named $db_foreign_prefix: where you would input foreign prefix values.
- Create a table for storing unique values assigned to each foreign prefix, say for now, double-digit integer assignments starting at 10 (and auto-incrementing). (Have to create a simple function for generating the assignments when new entries aare found in the new variable.)
- In admin_forums.php (perhaps a plugin) create a section that will access, iterate, and list foreign BBS forums for the admin utilizing these $db_foreign_prefix table values,
- And create checkbox selection ability for these.
- Wont need a new page that facilitates setting options for ones that get selected because, by making the foreign forum selections appear native to the current BBS (see ahead) we'll be able to rely on all the existing native functions just as they are...
2. When a foreign BBS forum is selected for inclusion, then a unique id is added into the current BBS's "forums datatable", same as when you create a new forum, but with a twist...
HowTo-Logic... Challenge: create a unique id# that doesn't conflict, but in fact blends in, with native forum_id's (fid's or f_ids) auto-increment-numbering:
- upon selection of a foreign forum, allow the usual creation of a new auto_incrementing unique f_id (integer) assignment in the forum table for it,
- but then (new function) retrieve and augment that value with a unique re-calculated decimal value where the digits represent:
-- a)the foreign BBS's id listed in the above new table, and
-- b)the foreign BBS's forum_id addend to that.
...and then replace the unique id# in the table with this new one.
--> So for instance, say
- the new f_id auto-assignment = 101,
- the foreign BBS prefix value = 22, and
- the foreign BBS's f_id = 55 [and we'll be adjusting that to, say, 6-digits, so this final result = 000055]
...then the new f_id for this "attached-to foreign share" becomes: 101.22000050
...or something generally along those lines ***so that we can keep the native AND THE foreign forum_id assignments together in one-and-the-same forum table without having to augment the existing structure.
Now we would have a unique f_id that can be parsed to always reference a real external BBS's forum.
3. If this logic is not flawed, then it would seem all that's left is to add a function that parses any f_id (or fid) values when a db_query is initiated (perhaps simply in functions.php?).
If the unique decimal value is present in the f_id, it is parsed in order to "lock" on to a foreign forum as a top level reference for everything that follows (topics, posts, etc,),
...so it would seem nothing further would need to be fussed with. No db_query changes would be required anywhere. The only thing required is to cause our function to trigger anytime an fid/f_id is referenced in any query. I would presume to be setting this 'call' up in the relevant db.php file.
Solves the issue of not wanting to pull in all the forums from "the other BBS" everytime viewforums is loaded, or wrestling with how to isolate and access only 'shared' forums.
Solves the isolation issue imposed by using a 3rd 'common' BBS.
======================================================================
How's my logic holding up?
What do you think of the idea of this approach?
Last edited by twohawks (2009-07-06 10:46:57)
TwoHawks
Love is the Function.
No Form is the Tool.