For a few weeks/months I’ve been struggling with the following matter at hand.

Old environment:
– Joomla website in “/
–  Smf installation in “/forum

Joomla was simply the front-end, providing news to our users while Smf was responsible for registrations, logins and maintenances of  members.

for years this worked perfectly but as time moved on a change for our site was necessary. Regarding the important use of Smf in this case  it was clear where our starting point would come from.

New environment: 

– WordPress installation in”/
– Smf installation in “/forum

I wanted to make sure that:

  1. users from Smf were able to login to WordPress
  2. users from Wp were able to login to Smf
  3. information from Smf could be used in Wp
  4. and the forum was integrated in WordPress

And so began an epic struggle:

Step 1. A bridge

bridgeSince Smf and WordPress are too different handling registration, logins, logouts and managing their “content”, we need something to overlap this, hence a bridge.

A search revealed that  a lot of these “bridges” are available for different types of blogs, forums and/or CMSs and most of them provide a basic functionality to sync the different databases so a login eg is possible in both.

Let’s see what’s out there.

My first approach was using a wp bridge for smf:  SMF Bridge

WP-SMF-Bridge is a simple user registration and logon bridge between WordPress and Simple Machine Forum. To get this working, it is highly recommended that you have a fresh, unmodified install of SMF 1.1 or higher installed and running alongside an install of WordPress. It must be installed in a subdirectory under your WP install and should not be being accessed through a sumdomain. For example, if your website’s address is mysite.mydomain.com, your forums should be somewhere like mysite.mydomain.com/myforum. Also, WordPress must be able to access your SMF configuration files, otherwise it won’t work!

Unfortunately, this plugin has not been updated since 2010-5-26 and didn’t make me use the SSI.php functions in wordpress.

Second approach: SMF2WP

SMF2WP is a simple one way bridge from Simple Machine Forum (v2.0.1 tested) to WordPress (v3.2.1 tested). This means, this one uses databases of SMF Forum and sync to WP database every time a user performs log-in action in both WP and SMF. […]

This plugin will do these following tasks:

  1. If a user log in WP, then that user will be logged in SMF using SMF2API.
  2. If a user logout WP, then that user will be logged out SMF using SMF2API.
  3. If a user log in SMF, will be logged in WP as well.
  4. If a user log out SMF, will be loged out WP as well.

When I was busy with this project, SMF 2.0RC came out and at that time SMF2WP didn’t work for me, so I was pushed in another way of achieving my goals.

Instead of using a WordPress plugin, why not go the other way around ? Use a Smf plugin which does the same. Since SMf was our basis from the beginning, this deemed to be a good solution.

Third approach: BlogBridger

BlogBridger is an Open Source PHP Application to bridge WordPress 3.0+ with SMF 2.0. It is released under the Mozilla Public License v1.1. BlogBridger makes no code changes to SMF, operating soley on it’s integration hooks. It is easy to install, uninstall and manage.
Features:

  1. Installable on new OR existing SMF and WordPress installations
  2. Migrates users to both SMF or WordPress if they do not exist in the other
  3. When a user logs into SMF, they are also logged into WordPress (vice versa)
  4. Assign WordPress roles to SMF member groups when exporting users from SMF
  5. Assign SMF Member groups to WordPress roles when importing users from WordPress

This could work ! After setup and installation I tried to login with wordpress and: Success! I was able to login using my smf credentials.

With this I was one step closer for reaching my goal.

2. How do you want your login sir ?

Login of SMF

I wanted to get rid of the login page that wordpress provides, so a few files needed some adjustments: ssi.php and header.php. (Ofcourse the wp-login.php can still be used, I simply did not let it show in my widget structure.)

This also allowed me to use the functions residing in smf.

ssi.php can be found in “/forum” and header.php can be found in
your “/wp-content/themes/<themename>” folder.

header.php

We need to change the  first lines. by adding ssi.php.
Change

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
  4.  
  5. <head profile="http://gmpg.org/xfn/11">
  6. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
  7.  
  8. [...]

to

  1. <?php
  2. require_once('/forum/SSI.php');
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  5. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
  7.  
  8. <head profile="http://gmpg.org/xfn/11">
  9. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

With this added line we can use variables from smf, let say: the loginbox

<div id=loginbox>
<?php  ssi_login(); ?>
</div>

But this gives us the entire loginform, we only need the username and password textfields. Thus requiring a little adjustment in ssi.php

Ssi.php

Change

  1. // Shows a login box.
  2. function ssi_login($redirect_to = '', $output_method = 'echo')
  3. {
  4. global $scripturl, $txt, $user_info, $context, $modSettings;
  5.  
  6. if ($redirect_to != '')
  7. $_SESSION['login_url'] = $redirect_to;
  8.  
  9. if ($output_method != 'echo' || !$user_info['is_guest'])
  10. return $user_info['is_guest'];
  11.  
  12. echo '
  13. <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '">
  14. <table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
  15. <tr>
  16. <td align="right"><label for="user">', $txt['username'], ':</label>&nbsp;</td>
  17. <td><input type="text" id="user" name="user" size="9" value="', $user_info['username'], '" class="input_text" /></td>
  18. </tr><tr>
  19. <td align="right"><label for="passwrd">', $txt['password'], ':</label>&nbsp;</td>
  20. <td><input type="password" name="passwrd" id="passwrd" size="9" class="input_password" /></td>
  21. </tr>';

to

  1. // Shows a login box.
  2. function ssi_login($redirect_to = '', $output_method = 'echo')
  3. {
  4. global $scripturl, $txt, $user_info, $context, $modSettings;
  5.  
  6. if ($redirect_to != '')
  7. $_SESSION['login_url'] = $redirect_to;
  8.  
  9. if ($output_method != 'echo' || !$user_info['is_guest'])
  10. return $user_info['is_guest'];
  11.  
  12. echo '
  13. <form id="loginform" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '">
  14.  
  15. <label for="user">USERNAME</label>
  16. <input type="text" id="user" name="user" size="9" value="', $user_info['username'], '" class="input_text" />
  17.  
  18. <label for="passwrd">PASSWORD</label>
  19. <input type="password" name="passwrd" id="passwrd" size="9" class="input_password" />
  20. <!--
  21. <select name="cookielength">
  22. <option value="60">for 1 Hour</option>
  23. <option value="1440">for 1 Day</option>
  24. <option value="-1" selected="selected">until you log out</option>
  25. </select>
  26. -->
  27. ';

Et voila ! Now we only have our needed textfields.

So, what’s our status so far ? Users can login with their forum credentials and are automatically added to the wp_users table in the database.

From this point on you have 2 choices:

You continue to use this combination of blog and forum or start over with your freshly added users, who are now “imported” in wordpress.
I choosed the first.

  76 Responses to “[EN] Integrate SMF in WordPress (and vice versa)”

  1. A program on numerous tools and applications for locksmiithing could play a role
    in your educational program.

    Look at myy pagve locksmith Chicago company, pixelhub.me,

  2. The Center announced in August that Lytle would tip
    down once his successor was called.

    Alsoo visit my web-site … Vascular Clinic

  3. It’s fantastic that you are getting thoughts from this
    paragraph as well as from our discussion made at this place.

  4. If you live where you get a lot of precipitation and snow you need to make sure that it will hold up to these
    type of conditions. Most times, when a new roof is installed on a building
    or home structure, it will be a big task. With little or no
    knowledge about roofing services, it can become
    difficult to understand the reliability and capabilities of a company.

  5. Great blog you have got here.. It’s hard to find good quality writing like yours nowadays.
    I seriously appreciate people like you! Take care!!

  6. For example, programming language principle considers numerous approaches to the
    outline of computation, whereas the research of computer programming itself investigates numerous
    features of the usage of programming language and sophisticated systems Human-computer interplay considers
    the challenges in making computers and computations useful, usable, and universally accessible to humans.
    Computer science started to be established as a
    definite educational self-discipline in the fifties and early
    sixties.

  7. Good post! We wil be linking to this particularly great post on our website.
    Keeep up the gret writing.

  8. In Acts of Creation: America’s Best Hand Craftsmen at Work, Walt Harrington particulars the work lives of fourteen American artisans, experts of their chosen crafts.

  9. There are literally thousands of movies out there, so your movie marathon night time can be whatever you want it to be.
    The movies offered under are just among the collections available.
    The subsequent time you’ve gotten a free evening why not strive
    a solo movie evening marathon.

  10. Most people assume they’re one other form of cable, and they’re close but the expertise behind their supply is different.
    The Secure 5, Buckshot, and Privates will all be
    obtainable direct from Outside Tech in July.

  11. MTV itself now provides streams of artists’ music movies, while AOL ‘s
    lately launched AOL Music features a huge collection of promoting supported streaming
    movies. Quotation wanted At its launch, Apple ‘s iTunes Retailer supplied
    a bit of free music videos in prime quality compression to be watched through the iTunes software.
    The Intercourse Pistols ‘ video for ” God Save the Queen ” was banned by the BBC for calling the United Kingdom
    a fascist regime.

  12. They difficulty licenses in two classes, specifically the S (Salesperson) and E (Estate
    agent) class.

  13. Preschoolers will like to ski, as long as their specific needs are saved in thoughts!

  14. Given that interest associated with online game increases,
    then your fascination to score leading things inside game increases and
    this makes people to search for the cheats the games by the
    assistance that they are able to get large scores without informing others about their particular hacking application.

  15. Hi thee everyone, it’s my first pay a quick visit at tthis web site, and post is in fact
    fruitful in support of me, keep up posting these typess oof
    posts.

  16. This piece of writing presents clear idea in support of the
    new viewers of blogging, that genuinely how to do running
    a blog.

  17. This hack works superb on all Android and iOS products,
    therefore don’t worry regarding the device. Hack doesn’t need root
    or jailbreak the device, so it’s easy and really fast to utilize
    a pleasant hacked hands per hour!

  18. I was wondering if you ever considered changing the layout of your site?
    Its very well written; I love what youve got to say. But maybe you could
    a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having 1 or 2 images.
    Maybe you could space it out better?

  19. Tombstone: this is the lifetime that have actually
    reduced to be less than 40 seconds from the 60 seconds used prior to.

    This is the second change from the offense over
    defense change and the skeletal system boost below
    is going to assist in maintaining the balance of the tombstone.

  20. Howdy I am so excited I found your website, I really found you by error, while I was
    searching on Yahoo for something else, Nonetheless I am here now and would
    just like to say cheers for a marvelous post and a
    all round enjoyable blog (I also love the theme/design), I don’t have time to read it all at the minute but I have saved it and
    also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the
    superb job.

  21. For the duration of latter year’s playoffs she was initially rooting contrary to the T. A. Kings. “They get an excess of. ” The woman stated. I must acknowledge the woman with slightly clairvoyant although I do not imagine she has been predicting a second pot upset ? result. The lady was entertaining for your Mn Outdoors.

  22. Robert/Nick: Very good opinions. Outlined on our site be interested to listen to associated with any kind of advantages in your SEARCH ENGINE MARKETING activities the moment this really is integrated.

  23. Start playing freerolls pokerstars italy download software
    program at french room of all.

  24. The second edition of PokerGuru Online League (PGOL) Season four concluded with an enormous
    INR sixty five.55 lakhs being awarded in prizes throughout
    the 5-day series. Over 2,200 gamers took in the 20 occasion schedule.

  25. La mayor parte dde las compañías no conceden microocréditos
    a loss clientes que están en ficheros de
    morosos como ASNEF,RAI EXPERIAN, aunque cadca vez hay más compañías que dejan dinero a los solicitantes con deudas impagadas registrados een las
    lustas de morosidad.

    Also visit mmy web-site … software Para gestión de créditos y Préstamos personales

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

 
© 2012 Ceekes boarderline Suffusion theme by Sayontan Sinha