Pages: [1]
Author Topic: PAS and SMF  (Read 2526 times)
Customers
Jr. Member
*

Karma: 3
Posts: 15


on: Jan 25, 09, 08:34 PM

Hi there,

Due to a forum need and with the user simplicity in mind i wrote i little code that
will insert the same username and password and other user informations in PAS and SMF forum
in the same time. This is let's say BETA ( i've tried it on my server and worked ).

Requirements:

PAS and SMF must use the same database ( but with different table prefixes ) and the same database username and password ( all this is to simplify the script ).

download the attached files ( signup.php and register.php ) - with these file an user can create his account on PAS and SMF in the same time ( with the same user and password ).
I recommend the use of this script on new installations so that the users id in the databases will be the same for PAS and SMF.
note: to ensure that no users is slicker and registers only on forums it is recommended that you disable the user registration in SMF Wink
note: put the files in the root directory of PAS ( SMF doesn't matter where is installed, mine was in PAS root directory under /forum/ )
note: i changed a little the way PAS works on user login -
initial user login in PAS is done by email and password but for more simplicity for users
i changed that by a standard user / password login:

so here are the changes in userhome.php:
- around 224 line there is
Code:
$bOK = EmailValid( $sLogin ) && PasswordValid( $sPassword );

-change it to
Code:
$bOK = NameValid( $sLogin ) && PasswordValid( $sPassword );

- around 230 line there is
Code:
$res = $db->super_query( "SELECT * FROM ".$cMain['dbPrefix']."users WHERE email=\"$sLogin\" AND password=\"".md5($sPassword)."\" LIMIT 1" );

-change it to
Code:
$res = $db->super_query( "SELECT * FROM ".$cMain['dbPrefix']."users WHERE username=\"$sLogin\" AND password=\"".md5($sPassword)."\" LIMIT 1" );

changed a little the toys theme to make register account to point to our new files Wink

-navigate to templates/Toys and open user_login.html and on line 14 replace

Code:
<p>Don't have an  account yet? Create one <a href="!SITEROOT!user/register/">
with
Code:
<p>Don't have an  account yet? Create one <a href="!SITEROOT!signup.php">

note: if you use the MY FAVOURITES block also you need to change the link there.
you can do it by opening block_needaccount.html an on line 5 replace:

Code:
<p>Don't have an account yet? <a href="!SITEROOT!user/register/">
with
Code:
<p>Don't have an account yet? <a href="!SITEROOT!signup.php">

to add a someway to go back to main PAS page and start playing again i changed the SMF theme to include the link in the header part ( in the login / welcome ) part
so ... in SMF directory ( in my case is /forum/ ) go to Themes/default/Languages and open index.english.php and on line 155 replace:

Code:
$txt['welcome_guest'] = 'Welcome, <b>' . $txt[28] . '</b>. Please <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a>.';
with
Code:
$txt['welcome_guest'] = 'Welcome, <b>' . $txt[28] . '</b>. Please <a href="' . $scripturl . '?action=login">login</a> / <a href="' . $scripturl . '?action=register">register</a> or go <a href="../">play</a>.';

in this way when a guest user hits the forum page it will see a the go play link Wink

now go one level upper ( /forum/Themes/default ) and open index.template.php and on line 236 change:

Code:
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />';
with
Code:
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />

and add a new line under the above line:

Code:
<a href="../">Go back to play</a></br />';

in this way when a registered user hits the forum page it will have the option to go back to games Wink

note: this changes must be applied to every theme that you use for SMF.

LATER EDIT:
- version 0.2b uploaded -

added a nice interface based on PAS Toys theme
added a lot of username / password / email checkings
added a redirect for a successful signup
added no-cache to signup page

* signup.php (0.93 KB - downloaded 53 times.)
* register.php (2.78 KB - downloaded 50 times.)
* signup_v2.php (1.53 KB - downloaded 66 times.)
* register_v2.php (5 KB - downloaded 57 times.)
« Last Edit: Jan 26, 09, 05:31 PM by darkplague » Logged
Administrator
Sr. Member
*

Karma: 7
Posts: 486


Email
Reply #1 on: Jan 27, 09, 01:01 AM

That's cool darkplague, thanks for the mod! Smiley


Logged
Jr. Member
**

Karma: 0
Posts: 23


Reply #2 on: Jan 29, 09, 06:40 PM

Another great post, thanks.
Logged
Customers
Full Member
*

Karma: 0
Posts: 43


Reply #3 on: Jan 15, 10, 05:53 AM

What system is SMF?
Logged
Administrator
Sr. Member
*

Karma: 7
Posts: 486


Email
Reply #4 on: Jan 15, 10, 07:04 AM

it's forum, see "powered by" in the footer of this page   Cool
Logged
Customers
Full Member
*

Karma: 0
Posts: 43


Reply #5 on: Jan 22, 10, 06:49 PM

Thx, that's cool. It might be a great idea to create php script which would help us to connect the user table in PAS with our own scripts Wink I am preparing the online php game.
Logged
Customers
Full Member
*

Karma: 0
Posts: 32


Reply #6 on: May 16, 10, 04:13 PM

Hi Sergey,

Could u add a nice interface based on PAS Trendy theme ?
Logged
Administrator
Sr. Member
*

Karma: 7
Posts: 486


Email
Reply #7 on: May 17, 10, 08:21 AM

to the smf forum? sorry, not at this moment... too much work, so the theme will be quite expensive - $100-$150 per copy. I think only a couple of people are interested in it for such a price.
Logged
Customers
Full Member
*

Karma: 0
Posts: 32


Reply #8 on: Nov 09, 10, 05:08 PM

missing activation send email with :

email
username

for memory.

Sergey or darkplague  ?  Grin
Logged
Administrator
Sr. Member
*

Karma: 7
Posts: 486


Email
Reply #9 on: Nov 10, 10, 03:20 AM

darkplague   Lips sealed
Logged
Pages: [1]
 
Jump to: