• SMF with modx from newbie to newbie#

  • Brocoli Reply #1, 5 years, 1 month ago

    Reply
    Hi everyone,

    Here the way I have installed SMF in order to get it well integrated inside modx website (Apache needed for Friendly URLs).

    Step 1: Downloads You need to download:
    - modx 0.9.2 or higher (tested with 0.9.5 below)
    - SMF 1.1.1 or higher (tested with 1.1.2 below)
    - SMF_Forum_Integration_1.0 connector from modx ressources website ("SMF_module.zip or .tgz" can be downloaded here: http://modxcms.com/forums/index.php/topic,3565.0.html )

    Step 2: Installations Install modx in the normal way
    Install SMF in the normal way (in "/forum" directory for example)
    Install SMF_Forum_Integration_1.0 in the normal way

    Step 2.1: Friendly URLs Friendly URLs inside modx must be activated:
    In modx manager -> Tools -> Configuration -> Friendly URLs -> Select yes
    Rename the file "/ht.access" to ".htaccess"

    Step 3: Creation of the forum modx page Inside modx manager, create a new snippet (for exemple 'forumsnippet') with following code:
    <?php
    include_once($modx->config['base_path'] . '/forum/index.php');
    return ;
    ?>
    


    Then create a new html page named for exemple "Forum" and enter an alias name (for exemple: "forum") that contain the previous snippet:
    [[forumsnippet]]
    


    Step 4: Modifying forum index.php file Replace the file "/forum/index.php" by the one joined in this post: Rename "index_php.txt" to "index.php" and put it in "/forum/" (use diff to see the differences if wanted).

    Step 5: Preview When you type in Firefox the url to the forum page (like http://yoursite/forum.html ), you should see the forum inside the template of your web site but not very well displayed.
    If not, then you have an error. You need to try again from step 1.

    Step 6: Forum template To integrate perfectly the forum inside your website, you should create a template of SMF (see SMF documentation to do it).
    When it is done, you need to modify the "index.template.php" file as the one joined in this post (make diff to the "index.template.php" default theme to see the differences):

    Then you need to set this new theme as the default one for your forum: In modx manager -> Modules -> SMF Connector -> Administration Center, Go to the forum and then you should see the forum page and the forum menu. Install the new theme (see SMF documentation to do it) and make it the default one.

    Step 7: Modifying forum php source code You need to modify some source code of SMF as following:

    Directing the link to the forum modx page instead of index.php forum page: In the file "/forum/Sources/QueryString.php", (replace 'index.php' by the alias name of the forum page ('forum.html' for exemple))
    function cleanRequest()
    {
    	global $board, $topic, $boardurl, $scripturl, $modSettings;
    
    	// Makes it easier to refer to things this way.
    	// $scripturl = $boardurl . '/index.php';
    	$scripturl = $boardurl . '/forum.html';
    

    In the file '/forum/Settings.php', remove '/forum' at the end of:
    $boardurl = 'http://yoursite';
    		# URL to your forum's folder. (without the trailing /!)
    


    Removing the copyright alert message: In the file "/forum/Sources/Subs.php", (do not forget the space character at the end of following "Powered by ")
    function theme_copyright($get_it = false)
    {
    ...
    		$forum_copyright = preg_replace('~(<a href="http://www.simplemachines.org/"[^>]+>Powered
     by )</a>~', '$1' . $match[1] . '</a>', $forum_copyright);
    ...
    


    Step 8: Synchronize users Now add the already modx users to the SMF users by doing:
    In modx manager -> Modules -> SMF Connector -> Synchronize Users

    Step 9: The end ! That's all...

    Do not forget to logout from SMF Connector (In modx manager -> Modules -> SMF Connector -> Logout (at right side)) when you want to test from your website otherwise, you'll see the forum as if you'll be connected as the admin of the forum.
    It should work.


  • rthrash Reply #2, 5 years, 1 month ago

    Reply
    Thanks so much for a great overview.


  • pixelchutes Reply #3, 5 years, 1 month ago

    Reply
    Quote from: Brocoli at Apr 19, 2007, 04:15 PM
    Hi everyone,

    Here the way I have installed SMF in order to get it well integrated inside modx website.
    ...
    That's all...

    It should work.

    @Brocoli,

    Wow! Thanks for the detailed tutorial. I have tried this before (briefly; not following these directions) and I recall receiving a few errors, sometimes only the first time you log into the forum, etc.

    It sounds like, if following these instructions, that this implementation is totally error-free? Can't wait to try it out.

    What about session timeouts? I thought I also read somewhere issues pertaining to Web Login session vs. SMF session not being in synch... any insight there?


  • shtuck Reply #4, 5 years ago

    Reply
    my forum is not a subdirectory of my cms folder, but rather a separate folder in my servers root directory

    is it still possible for me to get this to work?


  • pixelchutes Reply #5, 5 years ago

    Reply
    Quote from: shtuck at Apr 23, 2007, 11:01 AM
    my forum is not a subdirectory of my cms folder, but rather a separate folder in my servers root directory

    is it still possible for me to get this to work?

    @shtuck,

    If your "CMS folder" was "yourdomain.com/modx/", pretty sure you could still use this if your forum was "yourdomain.com/forum/". Provided your paths are referenced correctly this should be possible, even though /forum isn't a subdir to /modx.

    I would imagine the more common setup would be MODx installed to www root (e.g. yourdomain.com/ ) with /forum installed within.


  • shtuck Reply #6, 5 years ago

    Reply
    thanks, ill keep trying to get it working


  • pixelchutes Reply #7, 5 years ago

    Reply
    Quote from: shtuck at Apr 23, 2007, 11:59 AM
    thanks, ill keep trying to get it working

    Looking at the code, you'll need to modify this much (at least):

    <?php
    return include_once($modx->config['base_path'] . '/forum/index.php');
    ?>

    ... Since your /forum doesn't exist within $modx->config['base_path'], you'll need to modify the path so this include() doesn't fail. IMO, I would consider moving the forum to your www root (same folder as your CMS)...Of course, that is provided you can do so without impacting other processes.


  • shtuck Reply #8, 5 years ago

    Reply
    i have managed to move the forum into my Modx folder and sync all the users, however when i click the link for the forum instead of it appearing in my layout i get the following error

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error: 	filemtime() [function.filemtime]: open_basedir restriction in effect. File(/Load.php) is not within the allowed path(s): (/home/jackal/:/usr/lib/php:/usr/local/lib/php:/tmp)	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	/home/jackal/public_html/shtuck/forum/Sources/Load.php	 
      Line: 	2135	 
      Line 2135 source: 	$key = md5($boardurl . filemtime($sourcedir . '/Load.php')) . '-SMF-' . $key;


    you can view the site here
    any help would be greatly appreciated

    thanks


  • pixelchutes Reply #9, 5 years ago

    Reply
    Looks like a permissions issue. What are the file permissions (CHMOD) of your /forum and /forum/Sources directories?


  • shtuck Reply #10, 5 years ago

    Reply
    both 755, does that sound about right?

    sorry, im not too sure what it should be