Part of the EllisLab Network
   
 
CodeIgniter SMF 1.1.x Integration v0.1
Posted: 23 June 2009 12:22 AM   [ Ignore ]  
Summer Student
Total Posts:  22
Joined  12-02-2008

This is my little helper that integrate SMF 1.1.x with CodeIgniter by smf 1.1 api. I’m thai so may be my language may not be good.

How to Install
1. Download this file and unzip to your application folder.
2. change smf.php config file at config folder you will see $config[‘smf_path’] change it to your smf path.
3. See an example in controller/cismf.php.
4. Just change username and password to your smf account.
5. Enter your SMF board to see the result.

To Solve Log off bug
I have found bug that I cannot log off my smf account in smf board if I logged in by this api but It easy to fix.
1.Just go to your SMF Admin.
2.Go to Server Setting->Feature Configuration.
3.Tick “Enable local storage of cookies” off.
4.The problem are gone.

The bug that I didn’t fix right now (and may be I cannot fix)
First, when u enter smf board without log in and then you log in by API you will see you have 1 guest and 1 user in users online that cause it doesn’t delete the first session. I don’t know how to fix this right now.

Please enjoy my little helper, and give me some comment about my helper.

P.S. My Environment : SMF 1.1.9 , PHP 5.2.6 , MySQL 5.0.51b

Download Here : CodeIgniter SMF 1.1.x Integration

Profile
 
 
Posted: 23 June 2009 09:53 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  230
Joined  06-12-2009

Oh interesting! Gonna check it out.

 Signature 

- Simon

Profile
 
 
Posted: 24 June 2009 07:57 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  230
Joined  06-12-2009

Alright I have tried it.

I put the helper and config files on the server then edited the controller example to use my login. It doesn’t produce any output, something must be wrong.

My forum url is in ‘/forum’ while CI app is in ‘/system’

/
/forum
/system

Like so.

I changed the config file to ‘phpci/forum’. I wonder if that is the problem.

UPDATE: I found this bit of code in the helper file:

// Hopefully the forum is in the same place as this script.
$ci =& get_instance();
$ci->config->load('smf');
$path = $ci->config->item('smf_path');
require_once(
'./'.$path. '/Settings.php');

I am pretty sure helpers are in the helper dir of the application while the smf installation is going to be in the ‘root’ of the application, it can’t find that Settings.php.

Like so:

domain.com/phpci/forum/Settings.php
domain.com/phpci/system/application/helpers/smf_auth_helper.php

 Signature 

- Simon

Profile
 
 
Posted: 24 June 2009 11:06 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  22
Joined  12-02-2008

Ok i change code that line to this

require_once($_SERVER['DOCUMENT_ROOT'].'/'.$path.'/Settings.php');

and your config file may be like this

$config['smf_path'] = "phpci/forum";

Thank for your test smile

P.S. I changed my old code to like this now.

Profile
 
 
Posted: 24 June 2009 02:31 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  208
Joined  05-09-2008

Interesting…  I’ve got a project I’ll be starting sometime next week that would require integration with SMF.  I’ll take a look within the next few days, as I get time.

 Signature 

Daniel Moore
http://www.danielwmoore.com
Using .htaccess to remove index.php

Profile
 
 
Posted: 25 June 2009 02:05 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  230
Joined  06-12-2009

Changed it in my local version as well. I am just not getting anything from the controller example. Not even a echo, something must be wrong.

Are you pulling any PHP5 specific things?

 Signature 

- Simon

Profile
 
 
Posted: 25 June 2009 10:31 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  22
Joined  12-02-2008

Hmmm… I don’t know but I think I didn’t do any PHP5 specific.

You can try just download SMF 1.1 API at http://download.simplemachines.org/?tools

and make it to helper like “smf_auth_helper.php”

and load it like my example.

I think you must see some errors and fix it step by step.

Profile
 
 
Posted: 26 June 2009 03:14 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  230
Joined  06-12-2009

Don’t want to re-invent the wheel if it works for you though. smile

 Signature 

- Simon

Profile
 
 
Posted: 22 July 2009 02:22 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  230
Joined  06-12-2009

Well I have it working pretty much, but I didnt write a library.

It’s pretty easy, put this in a header or config or whatever:

require_once('forum/SSI.php');

You can now call still like ‘ssi_login()’

If you want to detect if someone is logged in you define:

global $context

Then $context[‘user’][‘id’] = user_id

There is also all kinds of stuff like ‘is_admin’ etc. I have chosen to only use the login/account stuff. I then have a table of my own with personal settings of which the ID matches the ID of the forum accounts. Works perfectly fine for me.

 Signature 

- Simon

Profile
 
 
Posted: 22 July 2009 02:56 AM   [ Ignore ]   [ # 9 ]  
Summer Student
Total Posts:  22
Joined  12-02-2008

That’s very nice and simple.

Profile
 
 
Posted: 22 July 2009 03:20 PM   [ Ignore ]   [ # 10 ]  
Grad Student
Rank
Total Posts:  81
Joined  12-22-2006

I’m really interested in the integration between codeigniter and smf, so I’m in love with them smile

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120552 Total Logged-in Users: 33
Total Topics: 126602 Total Anonymous Users: 2
Total Replies: 665571 Total Guests: 313
Total Posts: 792173    
Members ( View Memberlist )
Newest Members:  vaalionClarkKentBaoHeredamferchiivanzDr.JohnRamin.HossainikreesmheatJackEdwards