URL to your eFiction: http://www.pokegirl.org/fiction
Version of eFiction: 3.3
Have you bridged eFiction, if so with what?: Yes, php-fusion
Version of PHP: 5.2.3
Version of MySQL: 5.0.27-standard-log
Have you searched for your problem: Yes
If so, what terms did you try: php-fusion bridge logged out
Have you looked at the FAQs: Yes, but 3.0 bridging is not listed.
State the nature of your problem: Users Other Than Admin logged out of eFiction automatically
Right, logged in as a user and I am automatically logged out.
Taking a closer look at the code, I think I've found the problem - the bridge:
Creating a user in php-fusion does nothing to the e-fiction tables as nothing has been modded on that side, so the authors table and authorprefs table only have the original admin record.
Since the editbio.php has been replaced with the bridged version which just goes directly to the php-fusion edit_profile.php, the lines are never inserted into the database.
This then has a knock on effect in get_session_vars.php, where it tries to get the information from the authors tables and the authorprefs table. It can't because they do not exist, so it defines USERUID, USERPENNAME, uLEVEL isMEMBER and isADMIN as false, thereby automatically logging the user out of eFiction instantly.
Any clues on what should be changed to create the user information?
The way the bridges should work is that when you first visit the eFiction side it checks to see if you have author preferences, and if it does not find them the script creates them for you. The eFiction author table should not get a copy of the data, just authorprefs.
As to the problem...are you using subdomains at all?
Yes, I am using a subdomain. The subdomain is http://pokegirl.shadowtavern.com.
This takes you to the php-fusion part. I then installed eFiction as a folder under php-fusion in a folder called Fiction, so both php-fusion and eFiction are on the same subdomain, and they are both using the same database.
The problem is that the original file that wrote those lines if they didn't exist was editbio.php, and that has been replaced with one that redirects to the php-fusion edit_profile.php, so no records are ever created.
Right, I got a couple of quiet hours last night to sort this out.
The underlying problem is that there is no script once the bridge is in place to create a row in the authorprefs table, therefore when get_session_vars.php was called it would return no rows because it was trying to link the fusion_users and the fanfiction_authorprefs, so it set all the variables to false.
At first I modified the get_session_vars.php to check each time and create a default row if it didn't exist and then call the row again.
However that was a bad, brute force way of doing it, as that check didn't need to be run every time get_session_vars.php was included in a page.
So I looked into php-fusion, and slightly modified the register.php, for a more elegant solution. In the activate part of the file (when the user clicks on the activation link) it has these lines:
$result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('".$user_info['user_name']."', '".md5($user_info['user_password'])."', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0000-00-00', '', '', '', '', '', 'Default', '0', '', '', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$activation')");
$result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code='$activate'");
and I added in between the INSERT and the DELETE another INSERT to create the line in the authorprefs. There is also another line to set a table prefix if you have one (I didn't), so the code then looked like this:
$result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('".$user_info['user_name']."', '".md5($user_info['user_password'])."', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0000-00-00', '', '', '', '', '', 'Default', '0', '', '', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$activation')");
$fanfictiontable_prefix = "";
$result = dbquery("INSERT INTO ".$fanfictiontable_prefix."fanfiction_authorprefs(uid, userskin) SELECT user_id, skin FROM (fusion_users, ".$fanfictiontable_prefix."fanfiction_settings) where user_name = '".$user_info['user_name']."' ");
$result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code='$activate'");
If you want me to paste the entire register.php then let me know.
I hope this helps people,
~ Foz