We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28033
    • 925 Posts
    AFAIK, you can only go to another table in modx_ (or whatever the admin named it to in the MODx install).

    Now, if we could, in a future version, change that to, let’s say, mybb_ (using a forum as an example). The username and password fields would be saved (as long as they used the same table names and whatnot) that way, enabling auto-integration with forums, as well as *any* other script. Of course, if the passwords are saved with different methods, the owner of the site would need to code a script to convert them, but at least the functionality to do this is there.

    Or have the functionality to easily "join" two tables in the database. Obviously, with the password thing, the admin needs to do that themselves, but the joining part could be done easily. IMO, I like this better, because it’s easier for a site owner to do this than to move over tables.

    I think having this could help out WLPE a lot, because having intergration with pretty much any script would make this a universal app for anyone to use. And for the password/etc. conversion, we could have a sticky topic that had all of the code needed to convert the stuff for different scripts (forums, galleries, oekakis, etc.).

    (Thinking about it, this could open up the ability to include non-MODx stuff, like accessing Forum PM’s on the website. I don’t have the skills to even begin with that, though. tongue )
      My Snippets
      -> PopUpChunk v1.0
    • It’s not difficult to access different tables in the same database, just don’t use $modx->getFullTableName(’table_name’) or the $table_prefix value from the MODx config file.

      The trick is to access different databases. In PHP, if you open a connection to a database, it automatically closes any connection to what was opened before. Now all database queries will be addressed to the latest connection. So if you had the MODx database open, then made a connection to the SMF database, the MODx database is closed. As the processing continues, any further queries for MODx will fail, since they’re being made on the SMF database.

      What a programmer needs to do is to explicitly close the SMF database when he’s finished with it and re-open the MODx database.

      I’m probably wrong about the "automatically closes" part, and the original connection (to the MODx database, in this case) is actually still available by something like "$conn = $modxconn", but I’m not sure how to use that.

      http://il2.php.net/mysql_connect
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 28033
        • 925 Posts
        So I would need to open the MyBB database to get the user’s info and join the MODx and MyBB user/pass fields together, close it, open up MODx’s database like normal?

        And obviously, if I extended this to PM’s, I would need to include that somewhere in my code.

        Or could I just be able to join those fields together, then open up the MyBB databasee to "gather" the info for WLPE?

        Or, if there was a way to keep MODx open, just open+close MyBB, which would be the easiest, IMHO.

        (I’m a newbie at PHP, so this is somewhat new for me.)
          My Snippets
          -> PopUpChunk v1.0