News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

SMF & WordPress

Started by Stixsmaster, March 31, 2007, 08:15:55 PM

Previous topic - Next topic

jjgallow

Hello CosminB,

First of all, with my bridge you do not need a universal login screen.

Some may choose to have one for look and feel, but users will be integrated regardless of which system they log in from.


A single database is a neat idea, and others have suggested it.  You can actually run both wordpress and smf off of one database with my bridge, if you like.  It will, however, pull user information from two different sources in the database.

If you want to make a true, single user database, you could....but data is only a small part of the problem.   SMF and wordpress encode their passwords differently, and they cannot be read by the other.  They also handle their cookies entirely differently, and have different paths. 

Basically, you will run into all the same integration problems I am trying to fine-tune right now.  The only real difference is that you will have had to change so much of the code that they will likely be incompatible with most plugins, and you will be re-writing your code every time either system upgrades their version.  Rest assured, one year from now very few websites will be running on Wordpress 2.2 and SMF 1.1.3.   You'll either have to be one of those few, or constantly re-write your code to keep up with the times.

JMHO  :)

CosminB

My mistake, I meant a single table for users. I made a second database just to test your plugin, and both WP and SMF use it. That's really not a problem. But it seems you understood me - I want WP & SMF to share the users table.

I know it's tricky, but I'm in the process of learning PHP and MySQL and this site I'm working on is a good (though hard) way to start. But there's another reason for wanting an unique users table. I plan to build a database of places in the city (restaurants, museums, cafes, bars, hotels etc) where registered users can leave comments and rate those places. So if I use your plugin I'll have 3 user tables, or at least 2, if I use WP's table with this places database.

I know CSS, HTML, Photoshop (for the graphic design part), and I'm a noob with PHP & MySQL. I have a basic idea of what to do, but I don't really know where to start with the coding.

Just thought you could help me a bit with some general tips like "do that, there". No code... you know. But I understand what you say, that is hard and I'll analyze the situation.

P.S.: I thought about the password problem too, but figured I can encode them in a way and make both WP & SMF use that encoding, since I'm basically making an all new users table and making WP use SMF's table or viceversa. Maybe I'm still missing something.

darkhors3

JJ

Thanks for the quick update, I will give it a whirl!

Based on the other comments, I really like where this piece is going. How complex and how far do you think you are going to take this development? I ask because I personally like SMF as the best forum software and want to stick with it.

If intrested, someone else has been going the same route as you on the phpBB side in developing an integrated WP/Forum solution. WP-United hxxp:www.wp-united.com/ [nonactive] has some pretty neat ideas which you could "copy" for use with SMF. Thought I would toss that out for you to see.

Keep up the great work!

mpMS

hi darkhors3,

thanks for the tip. Probably the link you've gave may help jj solve some of the issues in bridging WP with SMF. I am currently monitoring this thread since I already have both CMS.

:)

jjgallow

Hey Cosminb,

Absolutely, a single-user table would be a neat project...I'm not trying to be unhelpful.  If I can explain it another way:

Using a single database means changing the way SMF and Wordpress read and store their data.  This means a lot of modification, and it means that any other plugin or upgrade which tries to read that data normally will not function.

Using SMF and Wordpress's original databases, like this bridge, means that instead of changing the way they interpret data, the bridge just lets each program know what the other did.  This means that it will not affect future upgrades or plugins.  Nothing has "changed" about either program.

So...you either have one user table and change the scripts....or you have the two original databases...leave the scripts the same, and communicate between them.

Aside from my explanation..my guess is you would want to start at the database query level.  In wordpress, the file you would need to get to know is /wp-includes/query.php.  In smf, it would be /sources/subs.php.   This is not fun stuff, imho...but good luck!

jjgallow

#145
Hey darkhors,

Thanks,

Great tip, darkhors!  I'm sure that will help!  There must be some great developers over there.  Honestly, any endeavour to get phpbb to work with wordpress is more ambitous than this.  At least smf and Wordpress have some basic structure in common.

I will definitely be looking at what they've done there.

To answer your question about how far I'd like to take this...pretty far...but the current pace of development won't keep up.  This is taking up too much time.  I'd eventually like to see a lot more than just user integration.  Site integration...and new features that share both programs...would be great to see.

CosminB

Thanks for clearing that up for me, jj. Actually, I was expecting it to ruin some features of both SMF and WP, and again, as you said, upgrades would be a big issue. I guess what I really want is a full blown, custom made CMS, but as you can imagine I don't have the time nor knowledge for pulling that kinda stuff. Not to mention that even if I was a PHP/MySQL/JS/Ajax/HTML guru, that's not something you should do on your own. It helps if you have even a small team. That being said, I decided to drop the whole idea. Instead, I'll go with Mambo for CMS, WP for blogging and SMF for the forum. Also, I might need a gallery, and I'll probably go with Gallery2. These should integrate fine, right?

I'll try to tweak all those to my need as much as I can and just hope I'll learn a lot. As for your plugin, thank you for all the effort you've put in it and I'll keep an eye on it for any problems. :) So far it works great, but I haven't done much yet as I'm only testing the whole thing (Mambo, SMF and the rest).

haymann

Hello jjgallow,

Thank you for your work on this bridge, I can't imagine the work involved in that. Hard enough for me to install the two products let alone try to get them to work together!

A quick question for you. I get the following error after activating the plugin and trying to import the users (already had SMF, just did a fresh install of WordPress).
QuoteWarning: main(): open_basedir restriction in effect. File(smf_api_1.1.php) is not within the allowed path(s): (/opt/wordpress/:/tmp) in /opt/wordpress/wp-content/plugins/WP_SMF/wp_smf.php on line 385

Fatal error: Can't load smf_api_1.1.php, open_basedir restriction. in /opt/wordpress/wp-content/plugins/WP_SMF/wp_smf.php on line 385
The error might have showed up immediately after activating the plugin, but it isn't visible until I view my WordPress site, the WordPress admin section and SMF page throw no errors.

I am running this on a hxxp:www.contribs.org [nonactive] and I can modify the basedir settings, I just don't know what to allow and was hoping you might be able to provide some insight...

To the rest of you users, now that you have your SMF and WP installs integrated so nicely, have you had any luck in finding matching themes?

Thanks again for your hard work jjgallow, I am looking forward to my install working properly!

jjgallow

#148
Hello haymann,

I am definitely not an expert with the open_basedir setting, or with SME 7 server, but generally open_basedir is disabled in etc/httpd/conf/httpd.conf.

The disabling would usually look like this:
Quotephp_admin_value open_basedir none

Alternatively, you could just set a much less restrictive open_basedir.  You might choose this on a shared host if you are concerned that others may be able to run your scripts.   It might look something like this:

Quoteopen_basedir= /opt/"

good luck!

p.s...I have modified the script to make this line more compatible...but I cannot promise it will work.  Even if it does, you're likely to run into this problem again as you clearly have quite restrictive settings.

jjgallow

This is just a little note of information for someone who may have trouble down the road:

If you're running WPMU with the main site on a subdomain, like wpmu.yourdomain.com, you could run into cookie troubles with the WP_SMF bridge. To fix it, you need to set your cookies globally. In wp-settings.php, change this line:

Quotedefine('COOKIE_DOMAIN', '.' . $current_site->domain);

to this:

Quotedefine('COOKIE_DOMAIN', '.' . "yourdomain.com");

where "yourdomain.com" is the domain name of your site WITHOUT any subdomains in it.

cheers :)

jjgallow

OK, SO:   New Version!

Thanks to all of you for helping me improve this bridge!  I have to give special thanks to brainiac744 here...there are some major changes in this version that would not have happened without him.

Version 1.09 is out, and I would recommend upgrading for those of you who have active sites.  Both plugins have had significant improvements made.

http://www.earthorbit.com/opensource

Special note on this version:  It will correct a major oversight of previous versions which allowed usersnames to be created in Wordpress with upper-case letters.  None of these users will be able to log into wordpress, as it requires lower-case usernames.

If you see that you have users in your wordpress database with upper-case usernames, clicking on "Repair User Links" in version 1.09 will correct all your users and make them functional.

As always, it is highly recommended to backup your database before using the "Repair User Links" tool.

The other highly notable change is vastly improved cookie handling for logins/logouts.   (mpMS, you may want to see if this does the trick for you.  And by the way...your username is uppercase--probably another reason it never worked for you in Wordpress!)

haymann...I've done my best to make this script work error-free for you!  Give it a try...if not...you just need a less restrictive open_basedir.

As for my revised version plans:   Very close to stable right now, in terms of user integration.  The next version... Version 1.1...I hope to officially declare "Stable" and seek approval from the SMF moderators.  Moving forward from there will be Site Integration.

mpMS

Already downloaded it and will upgrade existing bridge. Will post details on this thread. Thanks for the update.  ;D

haymann

Quote from: jjgallow on July 28, 2007, 05:52:44 AM
haymann...I've done my best to make this script work error-free for you!  Give it a try...if not...you just need a less restrictive open_basedir.
Excellent!! No errors now. I was able to get rid of the error by setting open_basedir to none, but I set it back to what it was and no errors :)
Quoteyou're likely to run into this problem again as you clearly have quite restrictive settings.
Yeah, by default SME is pretty security conscious. Seeing as how the server is usually setup to host the company's email, firewall, network storage, etc... I think that is usually a good thing ;D

Quick question, how do I "reset" so I can run through the entire plugin activation sequence again?

Thanks again for your help!
Ryan

jjgallow

hello Haymann,

Welll, for  WP_SMF, deactivating..then reactivating...then clicking on "repair user links" should usually reset it sufficiently.

If you REALLY want to reset the thing, after deactivating it...delete the wpsmfusers table in your wordpress database.


On the SMF side...uninstalling and reisntalling SMF_Wordpress should be suffiicient.

glad  to hear you're error free,

cheers  :)

haymann

I wanted to go through the whole process again because I was trying to remember if there was the option to put in the db name, db username, & db password because I had SMF in a different db. I was getting some sort of connection error. Disabling the plugin, deleting the wpsmfusers table and then reactivating the plugin did not take me through the entire process again. No matter though, I moved my SMF tables into my WP db and ran repair user links and everything worked great!

Hopefully my last question... I have no users for WP yet as I just installed it the other day; I do have users for SMF though. Your plugin imported my SMF users into WP just fine, but when I logged into SMF I noticed that most of my boards were hidden. Long story short... All of my existing SMF users have an upper-case letter as the first character of the user name. The plugin created new SMF users with all lower-case. I couldn't see most of the boards because I was logged in as a new user w/ basic access.

So my question is, what is the best way to avoid duplicate accounts? I am thinking that I will need to change all the user names manually in SMF and then re-run the plugin. This isn't a huge deal as I don't have a large number of users, but I wanted to ask incase you had a better suggestion.

Thanks again for this, I really appreciate folks like you that know how to do the things that I don't and are willing to share your work.

brainiac744

I'd just like to say that you've done an EXCELLENT job on this bridge and everything seems to be working perfectly for me now. Kudos to you :)

jjgallow

Thanks brainiac744,

I'm really glad it's worked for you! 

jjgallow

Hello haymann.


My apologies, my instructions on resetting the plugin were not really accurate.  What I should have said is:

If you want to COMPLETELY reset the plugin:

1:  Deactivate it in Wordpress, Uninstall it in SMF.

2:  **Remove Any users that the bridge created in Wordpress and SMF.**

3:  Delete the wpsmfusers table in Wordpress database.

4:  Reactivate it in Wordpress, Reinstall it in SMF.

5:  Click on "Repair User Links".


As you can see, I never told you to remove the users the bridge created.  That would have been all the lowercase users in Wordpress.  I do not believe you needed to do this for a database change, but ...Now you need to ...sorry  :)

My suggestion would be to delete all the lowercase users created in Wordpress and SMF, as well as the wpsmfusers table.

To explain:

The wpsmfusers table links the users from either platform.  When you deleted it, they were no longer linked.  The difference of upper case and lower case made the users appear different to the bridge, and without the wpsmfusers table, it decided to bridge another account for them.

On my end, I will correct the program to make it always read smf users in lower case...so this won't happen in future versions.  Meanwhile...sorry about that...I hope this solves your problem though  :)

jjgallow

Quick update:

I made some small changes to the script just now.  I've updated my site with the new code, but have not changed the version number for it.  Just some minor code changes that will prevent situations like haymann's from happening...mainly to do with better case sensitivity between wordpress and smf.

On another highly uninteresting note:

It turns out that wordpress CAN register users with Upper case letters, although it handles them very poorly compared to SMF.  WPMU definitely cannot handle them at all.  Bottom line,  the bridge is still far better off registering them all in lower case for wordpress.

Good luck everyone...I think this thing is nearly stable, and the updates should start to slow down  :)

haymann

Cool! Maybe I should have waited...
I used the "old" new plugin last night and it was still having trouble with my account. I have an admin account in SMF that has a name other than admin. When I would run the plugin, log into WP, and then head to SMF I would be logged in, but as a limited user w/ no post history. I didn't have any of my users try it to see how it went for them. As I said a little earlier I don't have many users on SMF and none on WP so I went to the SMF tables and converted the user names to lower case and re-ran the plugin. As near as I can tell everything works great!! I am very happy!

Maybe I should have waited to change them so I could test your latest... Oh well, I'm sure it works. You have made life easier for everyone that wants to run WP and SMF together!

Advertisement: