Author Topic: How To Integrate SMF Forum With Your PTC Site ?  (Read 18513 times)

0 Members and 2 Guests are viewing this topic.

  • Developer
  • Hero Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 7
  • Posts: 933
  • Karma: +58/-2
  • Referrals: 81
    • Cashons Network
    • Email
How To Integrate SMF Forum With Your PTC Site ?
« on: October 14, 2011, 12:58:36 PM »
- Original Poster of this idea is our members Omega C. and rights are reserved to him
- This is for aurora based sites but idea can be modified for other sites too
- The integration works only on SMF 1.1.x series as the current api is for it , for SMF 2 there's no official api yet , but there's some modified one i'm testing now
- Here are the details :

1) Download SMF api file from here : http://download.simplemachines.org/?tools
file named : SMF 1.1.x API

2) Upload it to the directory called forum in your site cpanel where you have the SMF forum installed

3) Find this file : members/join.php ( take a backup copy of it first )
find this line :
Code: [Select]
$sql=$Db1->query("UPDATE stats SET new_members=new_members+1 WHERE date='$today_date'");

add after it :
Code: [Select]
// smf api   
$username = $_POST['uUsername'];
$email = $_POST['uEmail'];   
$passwd = $_POST['uPassword'];
require_once("forum/smf_1-1_api.php");
         smf_registerMember($username, $email, $passwd, $extra_fields = array(), $theme_options = array());   
// api end         

4) Find this file : members/login.php ( take a backup copy of it first )
find this line :
Code: [Select]
header("Location: setcookies.php?".iif(isset($returnTo),"view=$returnTo","view=account&ac=main")."".iif("$id","&id=$id").iif($ptype,"&ptype=$ptype").iif($step,"&step=$step")."".iif(isset($ac),"&ac=$ac")."&sid=$sessid&sid2=$sessid2&siduid=$userid");

add after it :
Code: [Select]
// smf api               
include_once ("forum/smf_1-1_api.php");
$cookiename = $smf_settings['cookiename'];
$username = $form_user;
$password = $form_pwd;
unset($_COOKIE[$cookiename]);
smf_setLoginCookie(3600, $username, $password, $encrypted = false);
smf_authenticateUser();               
// smf api end     


5) find this file : public_html/logout.php ( it will be in home directory , back it up  )
find the following line :
Code: [Select]
$Db1->sql_close();

add after it :
Code: [Select]
include_once ("forum/smf_1-1_api.php");
$cookiename = $smf_settings['cookiename'];
$username = $_POST['username'];
$password = $_POST['password'];
setcookie($cookiename);
smf_setLoginCookie(3600, $username, $password, $encrypted = false);
smf_authenticateUser();

- That's all now the forum is integrated to your site  :)



  • Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 41
  • Karma: +0/-0
  • Referrals: 1
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #1 on: April 17, 2013, 10:09:18 AM »
Thanks and after adding it how to integrate database members join site can automatic login to forum?  :thinking:

  • Developer
  • Hero Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 7
  • Posts: 933
  • Karma: +58/-2
  • Referrals: 81
    • Cashons Network
    • Email
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #2 on: April 21, 2013, 07:44:55 AM »
Thanks and after adding it how to integrate database members join site can automatic login to forum?  :thinking:

Isn't that the idea from integrated forum ?
So with this members will be registered , logged in or out automatically

  • you're welcome
  • Sr. Member
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 303
  • Karma: +4/-0
  • Referrals: 3
    • GoldSmugglers
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #3 on: April 21, 2013, 08:02:28 AM »

is there any cost of it such as maintenance in SMF forum?

  • Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 41
  • Karma: +0/-0
  • Referrals: 1
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #4 on: April 21, 2013, 12:19:13 PM »
Doesnt seem its working members complained login page dissapeared you couldnt login luckily i backedup files dont know why it happnened!
Also logout page showed this
Warning: include_once(forum/smf_1-1_api.php) [function.include-once]: failed to open stream: No such file or directory in /home/upospbut/public_html/clixpalace.com/logout.php on line 18

Warning: include_once() [function.include]: Failed opening 'forum/smf_1-1_api.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/upospbut/public_html/clixpalace.com/logout.php on line 18

Warning: Cannot modify header information - headers already sent by (output started at /home/upospbut/public_html/clixpalace.com/logout.php:18) in /home/upospbut/public_html/clixpalace.com/logout.php on line 22

Fatal error: Call to undefined function smf_setLoginCookie() in /home/upospbut/public_html/clixpalace.com/logout.php on line 23
« Last Edit: April 21, 2013, 05:54:55 PM by ammad »

  • Developer
  • Hero Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 7
  • Posts: 933
  • Karma: +58/-2
  • Referrals: 81
    • Cashons Network
    • Email
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #5 on: April 23, 2013, 08:01:01 AM »
Hello , are you sure you uploaded smf api inside your forum folder ? also this is for smf 1.1x wont work on smf 2 versions as mentioned in topic

  • Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 41
  • Karma: +0/-0
  • Referrals: 1
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #6 on: April 24, 2013, 06:55:11 PM »
Hello , are you sure you uploaded smf api inside your forum folder ? also this is for smf 1.1x wont work on smf 2 versions as mentioned in topic

How can i install SMF 1.1.x by Softaculous
 

  • Developer
  • Hero Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 7
  • Posts: 933
  • Karma: +58/-2
  • Referrals: 81
    • Cashons Network
    • Email
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #7 on: April 25, 2013, 08:29:20 AM »
How can i install SMF 1.1.x by Softaculous

You can't install it from there , It needs to be manually installed
Download it from here : http://download.simplemachines.org/index.php?archive;version=67 ( SMF 1.1.16 - install ) then upload it to your forum directory and remove all previous forum related files , Then do the install either on new database or current smf database

  • Developer
  • Hero Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 7
  • Posts: 933
  • Karma: +58/-2
  • Referrals: 81
    • Cashons Network
    • Email
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #8 on: April 25, 2013, 08:30:28 AM »
 is there any cost of it such as maintenance in SMF forum?

Integration guide is free as i posted it above , You would only pay if you asked a coder to do it for you that's all 2 or 3$ max

  • Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 41
  • Karma: +0/-0
  • Referrals: 1
Re: How To Integrate SMF Forum With Your PTC Site ?
« Reply #9 on: April 25, 2013, 03:54:22 PM »
Ok i have installed it !
I have some questions what about members who joined before this forum was created they wont have account in forum ?

 

advertise here