Title: vBulletin to eFiction bridge/vBulletin template export to eFiction
Description: This mod contains two parts. The first is a user bridge that will replace the eFiction user tables with the vBulletin user tables. The second part of this mod is an eFiction skin that will load vBulletin templates into tpl variables. This way you can maintain a constant look across your entire site.
Requirements:
eFiction 3.3 or higher
vBulletin 3.6 or higher
vBulletin bridge must be installed for template exporting skin to work.
Example: http://www.necrotania.com
Notes: This mod is based on Tammy's SMF bridge that was supplied with eFiction 3.0 (Thank you Tammy π ). It replaces the author tables with the vBulletin user tables, and uses the forum session information to handle login and logout.
The mod is split into 2 parts. The core is the user table integration that handles all of the login and session data. The other is a skin sharing system that will pull templates from vBulletin and use them in a standard eFiction skin. Both mods require very few changes to ether scripts, instead relying on already established systems.
Details of each mod will be provided in posts below to allow individual tracking of updates.
Integration Notes: eFiction functions can easily be included into vBulletin by using the plugin system. By including corefunctions.php you gain access to several key functions that will help you add eFiction links into the forum area.
Example - This plugin loads the corefunction.php file, and then loads a random story for use anywhere on the page. I have this running at the global_start hook.
define ("_CHARSET", "ISO-8859-1");
define("_BASEDIR", " http://www.necrotania.com/eFiction/");
define ("_PROFILEURL", " http://www.necrotania.com/eFiction/viewuser.php?uid=");
require ("/home/***/****l/eFiction/includes/corefunctions.php");
$ratings = 1;
$ratlist = $vbulletin->db->query_read ("SELECT * FROM fanfiction_ratings");
while($rate = $vbulletin->db->fetch_array($ratlist)) {
$ratingslist[$rate['rid']] = array("name" => $rate['rating'], "ratingwarning" => $rate['ratingwarning'], "warningtext" => $rate['warningtext']);
}
$content = "";
$randomqueryr =$vbulletin->db->query_read('SELECT stories.*,stories.sid, author.username as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM (vb_user as author, fanfiction_stories as stories) WHERE author.userid = stories.uid AND stories.validated > 0 ORDER BY rand( ) DESC LIMIT 1');
while($storiesr = $vbulletin->db->fetch_array($randomqueryr))
{
$content = "<br/><br /><div style='font-size:12px;'>".title_link($storiesr)." by:<a href="'"._PROFILEURL."$storiesr[uid"]'>$storiesr[penname]</a><br /><br />".truncate_text($storiesr[summary],70)."</div>";
}
$efic_rand = $content;
All queries were modified to use vBulletin DB calls. With corefunction.php loaded at the start other queries become easier to format. For example, here is the code I use to show the story list in the profile page.
$content="";
$results = $vbulletin->db->query_read ("SELECT s.*, unix_timestamp(updated) from fanfiction_stories as s,vb_user as a WHERE a.userid = s.uid AND s.validated > 0 AND s.uid = $userinfo[userid] ORDER BY updated DESC");
while ($story = $vbulletin->db->fetch_array($results)){
$content .="<div class='thead'>".title_link($story)." - ".ratingpics($story['rating'])." [<a href="'"._BASEDIR."reviews.php?type=ST&item=$story[sid"]'>Reviews - $story[reviews]</a>]<br /><span style='font-size:10px; font-weight:normal;'>(Wordcount: $story[wordcount] - Reads: $story[count]) - Published:$story[updated]</span></div>".truncate_text($story[summary],150)."<br /><br />";
}
if ($content)
{
$efic_mystory = $content;
} else {
$efic_mystory = "No Stories";
}
$efic_myseries = "TEST";
Ignore the $efic_myseries part, it is the next step but has not been setup yet.
Title: vBulletin to eFiction bridge
Version: 0.9.0b
Description: This is the core of the bridge files, handling session and user information. This has only been tested on UNIX based servers. This also assumes that both eFiction and vBulletin are on the same database.
Please Note: This bridge will not work if your eFiction and vBulletin installs are on separate sub-domains, like efiction.yoursite.com and forum.yoursite.com.
Step 1: Download the following package and extract the contents to your computer. You will have to make some edits to the files before uploading
http://www.necrotania.com/Download/vb_bridge/vbridge.zip
Step 2: Open file queries.php. Locate the following variables in the file and enter the correct information for your site. Make sure to leave all edits inside the " marks and leave the ; at the end of the line
$db_prefix = The Database prefix you are using for your setup. Default is vb_
$path_to_vb = The file path to vBulletin, not the URL. Usually looks like "/www/s/site/htdocs/"
$path_to_efic =The file path to eFiction, not the URL. Similar look to the above
$site_url = The URL to your site home page
$vb_url = The URL to the main forum page of vBulletin
Optional: you may include custom profile fields created in vBulletin. You will need the field name (field3 for example). The format for the entry is
'title you want people to see' => 'field4',
Remember to use quotes around the name and field, and put a comma at the end.
Step 3: Upload queries.php and get_session_variables.php to the /includes/ directory of your eFiction install. Upload the rest of the files to /user/ directory of your eFiction install.
Step 4: Login to vBulletin, then go to your eFiction link. you should now be logged in as that user in eFiction. You may have to clear your cookies and log in to get everything to work the first time.
Version History
0.5b (2/21/2007):
Initial upload
0.8b (8/25/2007):
Corrected all files for eFiction 3.3. Should all be using the new definitions instead of the older variables
Fixed several minor bugs
Improve instruction format
0.8.1b (9/12/2007):
Instruction update to include incompatibility with sub-domains.
0.8.4b (9/12/2007):
Included profile.php file to correct database error
0.9.0b (11/20/2008):
Updated queries.php and get_session_variables.php to work with new versions of PHP, vBulletin, and eFiction
Title: vBulletin to eFiction template export (Skin Sharing)
Version: 0.4b
Description: With the install of the vBulletin bridge you have access to all available vBulletin templates. This mod and skin are designed to utilize this access to pull information from the current style in vBulletin and apply it to eFiction.
Step 1: Download the following file
http://www.necrotania.com/Download/vb_bridge/vskin.zip
Step 2: Upload contents to your /skin/ directory
The core of this process is in the extra_header.php, and the variables.php files. Both are included in the skins, so no system file edits are necessary. Most of the work is done in extra_header, here it loads the vBulletin info, caches templates, and grabs into variables.
The primary problem with this process is that vBulletin skins do not like to be outside of there directory. You will note that below the loading area is an array with URL's that get corrupted and there correct structure. Using the str_replace() function this will correct the errors before the data is passed to the template system.
In the files that I included you will notice 3 tpl variables. Here is the relevent code from varables.php
$tpl->assignGlobal("vb_efic1", $efic_block_1);
$tpl->assignGlobal("vb_efic2", $efic_block_2);
$tpl->assignGlobal("vb_efic3", $efic_block_3);
What this is doing is assigning each tpl variable a section of code pulled from the current vBulletin skin in extra_header.php
eval('$efic_block_1 = "' . fetch_template('efic_block_1') . '";');
eval('$efic_block_2 = "' . fetch_template('efic_block_2') . '";');
eval('$efic_block_3 = "' . fetch_template('efic_block_3') . '";');
The reason for this is that as the user changes there vBulletin skin, you will want to maintain the same look. These are custom templates that I made, modified for each of my site skins to create a block for eFiction contents.
In very basic terms here is what I use the variables for.
efic_block_1 = Start of block up to the title phrase
efic_block_2 = After title phrase up to beginning of content
efic_block_3 = From after the content to the end of the block.
With these assigned to .tpl variables you end up with code looking like this.
{vb_efic1}Site Info{vb_efic2}Content{vb_efic3}
If you customise these templates for each of your site skins you can really maintain a constant look through your whole site.
This part is optional, and removing it will still leave you with the header, footer, and navigation bar of your forum.
Version History:
0.1a (2/21/2007):
Initial upload and writeup.
0.2a (3/2/2007):
File upload and install instructions.
0.5b (8/24/2007):
Updated instructions
Relocated template call to allow for better caching by vBulletin
0.6b (8/28/2007):
Added example code for template exporting.
I'm having major problems with this.. Yes, the script allows me to simultaneously be logged into efiction and vbulletin, but almost no links within efiction work. No links in Member Account work, nor anything in the Admin link section. Also, my efiction skin randomly changes when I click on a link. I have efiction and vbulletin on the same database, and I am sure I modified queries.php correctly according to your instructions. I am running efiction 3.2 and vbulletin 3.6.4
I encourage others to try this mod out and see if they get the same results as me.
Also, what exactly do you mean by this...? Where is the mod?
File: Reserved
Version: 0.1a
Purpose: With the install of the vBulletin bridge you have access to all available vBulletin templates. This mod and skin are designed to utilize this access to pull information from the current style in vBulletin and apply it to eFiction.
The way you have efiction and vbulletin set up on your site is more than exactly how I would want it set up for mine. How exactly did you get efiction to use your skin? How did you get efiction to seemingly open inside of vbulletin with the welcome message and login displayed above?
The mod should be packaged and posted today or tomorrow. It got a bit busy so I have not had a chance to clean it up yet. This part will get you setup to share skins so it will look like eFiction is inside of vBulletin. What it is actually doing is loading parts of your vBulletin templates into .tpl variables that get used in the site...but it still looks good π
Can you post the URL of your site, or PM it too me. I would like to take a look at the links and see what may be going wrong. It should work fine with the included skins.
I have found a bug that prevents the installation and execution of modules. I have gotten part of it resolved but the URL's of the modules do not function correctly. Once I get this fixed up I will post an update.
Hey, did you ever get to fixing that issue we talked about?
Eeeo, forgot to post my update. Sorry about that.
I have a new version to upload that may help your issues. If not I can adjust it to show some debug info.
I will get this posted tonight, again I am sorry about the delay....RL got a bit complecated over the past few weeks.
hello, thank you for sharing but I cannot download it, it gives me a 403 forbidden + a 404 not found error...
I just switched web hosts....something must not be right with the config
I will look into it, thanks for letting me know π
Edit: it was a permission issue. You should have no problem downloading it now.
thank you π Will test it out.
Seems to be working nicely. Haven't tested the skin part yet. @_@
My only question is, as the admin on my board I have the same username/pass as the admin on my efiction site. When i login from the forum it doesn't log me in as the admin. Is there a way to do this?
As it stands now it doesn't let me even just go to the efiction directory and log in as the admin. I have no admin access right now.
You will need to go into the eFiction database table and set the account to be admin. It matches based off of UserID, so whatever uid in the forum is admin, find the same one on the eFiction user table and set admin =1.
One of the future updates I am looking at is to automatically set this based on user group, so you can specify a vB user group as an admin or moderator and the bridge will apply the necessary permissions.
I went into the database and checked. When I originally setup my eFiction. I used the same username/pass on that as on my vbulletin (for the Admin). So when I go into the efiction table for User ID and check it only shows 1 person and that person is set as the admin ID 1. because it's the same name with my vb (same ID on vb and everything for the Admin) shouldn't it automatically work then? Cuz it's still not working for me. Or would I have to have a different admin when I set up eFiction?
^_^
And a usergroup feature would be PERFECT! ^_^
Hmm..it should be working then...as long at everything is up to date. Try logging out, clearing your cookies, and log back in. Sometimes the eFiction cookie causes issues. I remember seeing a similar issue to this in the past, if that does not work I will go over my notes at home tonight and dig up what I found.
The user group mod is something I am actively working on...however to make it easy to use it will end up being a vBulletin plug-in, allowing you to set who has what rights in eFiction via the group config. I will see if I can get some time this week and get the code done on it.
