Thanks for your reply
The way things stand at the moment, I have two efiction databases on my server. One is bridged with smf and the other is standalone. The bridged one is the first one I created and the second one is the latest which I just created after giving up on the first one. I just havent deleted the first one yet.
I liked the idea of bridging it with smf but my idea of a bridge is something that stands between two databases and links them together (like what Orstio does with smf & joomla etc) not the way this is which is putting it in the same database and losing functionality. So I gave up on the smf bridged version and decided to start over and created another one. I'm afraid I dont know enough to be able to customise the 'bridge' and integrate smf and efiction above what comes as standard so the result was not good.
However, the original bridged version is still on the server, and having it integrated with smf is the ideal for me. I suppose I hadnt quite given up hope on it lol
I suppose what I would like is something like yours
I would like efiction to use and display the smf user profile (all fields)
I really would rather they were in different databases but I dont suppose that can happen
My smf has many mods, including the shop, so the shop item is of interest to me and also :
# I modified the script (queries.php/get_session_vars.php) to get the Display Name as the pen name instead of the username.
# I've modified the script slightly so that the header of the forum appears by making an adjustment to the header.php file and using the already included SSI.php from SMF
# I modified the script (stories.php) so that posting a new story (or new chapter in a story) increases the post count in SMF.
# I modified the script (stories.php) so that posting a new story adds money to the member for my shop mod in SMF
# I modified the script (reviews.php) so that posting a review increases the post count in SMF
Being able to give them money and increase post count for posting in efiction would be great! That is one of the problems with trying to encourage people to leave the forum and go to efiction, as they would rather post it all on the forum and get money and increase their post count
Also
I also made some changes to SMF by adding links in the member profile that link to a member's stories, series, reviews, challenges, and favorites. There is also a link on each post (above the avatar) that links to a member's stories.
See that's what I was hoping for with the bridge, more integration with the forum. I realise the bridge is basic and that you can modify it but I dont know how to modify it as I am not a coder. However, I am good at following instructions π
Currently, i'm working on a way to move the Story Account preferences to the SMF user profile and have the efiction script read them from there using a mod that allows me to add profile fields. Also working on integrating the story/series/reviews/challenges/favorites lists into the SMF profile to make it fully integrated but that will take more time since it involves making several extra profile pages. All of my SMF changes are mods so that they can be easily added and removed.
this also sounds very interesting
I had got quite depressed about it and put it on the back burner but I am willing to give it a try again.
thanks for your help
(I also forgot about your contest but I might not have a chance to look due to exams)
What version of SMF are you using. I am using 1.1.2 so all of my SMF mods are for 1.1.2. I"m not saying that they couldn't work for another version... I just don't know.
Also do you use SMF Gallery by any chance?
I will have to look through the code I changed, but it shouldn't be too hard to tell you what I changed to make it work.
I don't know why but I can't add attachments anymore... I used to be able to in this forum. But I was thinking of just attaching the modified files.. but no matter I'll just find the changes I made and post them here.
A. W. G. Coleman
Home of the Fantasy/Adventure Series "Quest of the Seal Bearers"
Fanfiction, fanart, contests, prizes!
I am using 1.1.2 and I have gallery lite as well.
that would be really wonderful of you.
thank you
Okay, I'm giving you links to the mods and them some zip files with the modified files in it.
SMF Mod
This mod will add links for efiction and SMF gallery on your profile and on your posts
I use SMF Gallery Pro. I modified the "Custom Links" mod from SMFHacks website (thats the guy that makes SMF Gallery) so if you have the custom links mod for SMF Gallery you need to UNINSTALL and DELETE that mod first before using mine becuase its the same mod, only modified.
I made three versions of the same mod just in case other people might want this. This should work with these versions of SMF
1.1.2,1.1.1,1.1, 1.1 RC3, 1.1 RC2
Mod for those with SMF Gallery Pro and Efiction
http://www.mendala.com/mods/customlink-gallerypro.zip
Mod for those with SMF Gallery Lite and Efiction
http://www.mendala.com/mods/customlink-gallerylite.zip
Mod for those with just Efiction
http://www.mendala.com/mods/customlink-nogallery.zip
Remember you need to have your efiction bridged with SMF for these mods to be of any value.
EDIT:
Currently this mod makes hard-coded links, so you will need to go in the package to change the path to your efiction location. I am working to change that so the links automatically point to your efiction install.
The next post will have the links to the modified files that I have, I need to put them together first.
Let me know if something isn't working.
A. W. G. Coleman
Home of the Fantasy/Adventure Series "Quest of the Seal Bearers"
Fanfiction, fanart, contests, prizes!
thank you very much for doing this.
One question, are there things in efiction that still don't work for you because it is bridged with smf? I cant remember off hand but there were some problems I recall if the forum was bridged, resulting in lack of functionality.
and of course the profiles. My smf profiles have lots of custom fields which is great but when bridged you don't see them and then you also can't use the efiction profile fields so you end up with nothing really. that was one of the main problems so if it could be fixed so that it displayed the full smf profile summary that would be terrific.
Not sure what you mean...?
On my site (don't know if you've seen it), I don't really have "profile" issues. When you are viewing your story archive account there is a link to view/edit your "main" profile (which is the SMF profile). Same thing if you are viewing someone else's profile. There is a link to the "main" profile.
I had to modify a couple of files to get the link to show up when you view someone else's profile. But making it show up in the Story Account Prefs was just a matter of adding a panel to the panels.
I'm not quite sure what you're trying to accomplish with your site so I don't know what kinds of functionality problems you're having, but on my site, there are none... at least none that I care about :). I've pretty much worked around any issues I had by either editing the code or using the built in functionality of efiction.
Can you be more specific (you may need to rebridge your site.)
Other info still coming. Just had to think about this question first. Might take me a couple of days to gather up all the changes I made that you're looking for.
A. W. G. Coleman
Home of the Fantasy/Adventure Series "Quest of the Seal Bearers"
Fanfiction, fanart, contests, prizes!
It might be better if I join up and take a look around. I will try and do so later tonight or tomorrow and then I can see what you have done from a member pov. lol might be easier π
Sounds great! I've been using gallery2 with the SFM g2 bridge, but I'm going to try out the gallery pro mod and see how that works too. I can't wait to try out your mods! I'll let you know how they work for me. And thanks again!
fyi gallery lite is the free version and gallery pro is the commercial version costing $50.
Okay, here are (almost) all the files I've changed in efiction.
http://www.mendala.com/mods/ChangedFiles.zip
DO NOT UNDER ANY CIRCUMSTANCES drop these files into your efiction install. I'm only giving these to you so you can see where I've made changes. I do not recommend just "replacing" them as I may have done things that are specific to just my site.
Queries.php
Note: This is the BRIDGED viersion of queries.php not the regular version.
In this file, I changed
define ("_PENNAMEFIELD", "author.memberName");
to
define ("_PENNAMEFIELD", "author.realname");
This sets the pen name to the "Real Name" in SMF in (almost) every situation.
get_session_vars.php
Note: This is the BRIDGED viersion of get_session_vars.php not the regular version.
In this file you'll see in this seciton of the ORIGINAL code:
// SMF has already loaded it's sessions in queries.php. So we'll pull the data from the $user_info array from there.
if($ID_MEMBER) {
$eficdata = dbquery("SELECT * FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$ID_MEMBER'");
if(dbnumrows($eficdata)) {
$userdata = dbassoc($eficdata);
if($userdata['level'] != "-1") {
$userpenname = $user_info['username'];
$useruid = $ID_MEMBER;
$loggedin = 1;
if(!isset($_SESSION[$sitekey."_skin"])) {
if(is_dir(_BASEDIR."skins/".$userdata['userskin']."/"))
$siteskin = $userdata["userskin"];
else
if($userdata['userskin'] != "default") $noskin = 1;
}
if($userdata['level'] > 0)
$adminloggedin = 1;
if(!isset($_SESSION[$sitekey."_agecontsent"])) $ageconsent = $userdata['ageconsent'];
else $ageconsent = $_SESSION[$sitekey."_agecontsent"];
$level = $userdata['level'];
}
}
}
I changed
$userpenname = $user_info['username'];
to
$userpenname = $user_info['name'];
This sets "Penname" to the SMF "real name" in (once again) almost all the other places that it occurs.
The only time "Penname" is the "username" after these two changes is the Profile.tpl. In those cases you can just use the "{realname}" tpl variable... or change profiles.php... I just use the {realname} variable.
Profile.php
Now having said all of that. I did actually end up modifying profile.php. But for a different reason. I wanted to add something to the {realname} variable so that when I added {realname} to my profile.tpl it added some additional information. I wanted to add a link to the SMF profile. So that when you're viewing a profile of a user in eFiction. you get "Penname: User's Real Name [View Main Profile]" where "View Main Profile" is a link to the SMF profile. In order to pull that off, I edited profile.php.
Note: This is the BRIDGED version of profile.php, not the regular version.
You'll notice that near the top of the profile.php file I've added this variable declaration and assignment.
$viewprofile = " [<a href=""".$path_to_smf."index.php?action=profile;u=".$userinfo['uid'"]."">"._VIEWPROFILE."</a>]";
then I added the variable to the tpl assignment of the "realname" placeholder.
if($userinfo['realName'])
$tpl->assign("realname", $userinfo['realName']." ".$viewprofile);
However, note that I am using a constant called _VIEWPROFILE in my $viewprofile variable. I added the wording for that constant to the /languages/en.php (I did not include that file.) basically adding this constant declaration to the file.
define ("_VIEWPROFILE", "View Profile");
Header.php
This file has a modification at the top (above all the other code.) which puts the fourm header above the efiction install.
// Theme we're going to use
$ssi_theme = 9;
// Layers we're going to use
$ssi_layers = array('main');
// Enable GZip compression (saves bandwidth)
$ssi_gzip = true;
note that the $ssi_theme = 9 is the number of my ssi theme. You'll have to find your theme number by going to your admin panel. Click on your "Current Theme" link. You'll see in your address bar something like this
http://www.yoursite.com/forum/index.php?action=theme;sa=settings;th=9
the th= is your theme number.
You'll also notice that at the top of the header.php, I also add this
global $inefiction;
$inefiction = true;
I created the $inefiction variable to use in my SMF theme. It helps me in my index.template.php to let the script know when I'm inside efiction. That way the "Story Archive" button that i created will stay highlighted when I"m in efiction (that's a whole other modification I'm not going to go into right now)
Stories.php
I have two changes in this file (both in the same spot). Whenever a person adds a story (or chapter to a story) their post count increases, and they get money for the SMFShop mod. (the one made by Daniel15).
You need to go to the newstory function in this file and change the global statement at the very top so that it looks like this:
global $autovalidate, $sid, $action, $sid, $store, $tpl, $storiespath, $admin, $sitename, $siteemail, $allowed_tags, $level, $admincats, $alertson, $dateformat, $url, $tableprefix, $minwords, $maxwords, $useruid, $userpenname, $charlist, $catlist, $classtypelist, $db_prefix, $user_info, $adminloggedin;
Then you need to find this in the newstory function
else if ($store == "files")
{
if(!$newchapter) {
$insertstory = dbquery("INSERT INTO ".$tableprefix."fanfiction_stories (title, summary, storynotes, catid, classes, charid, rid, date, updated, uid, validated, rr, completed, wordcount, featured, coauthors) VALUES ('".addslashes($title)."', '".addslashes(format_story($summary))."', '".addslashes(format_story($storynotes))."', '".($catid ? implode(",", $catid) : "")."', '".($classes ? implode(",", $classes) : "")."', '".($charid ? implode(",", $charid) : "")."', '$rid', now(), now(), '$uid', '$validated', '$rr', '$complete', '$wordcount', '$feat', '".implode(",", $coauthors)."')");
$sid = dbinsertid( );
$inorder = 1;
}
else {
$inorder = $_GET['inorder'] + 1;
}
$insertchapter = dbquery("INSERT INTO ".$tableprefix."fanfiction_chapters (title, inorder, notes, endnotes, validated, wordcount, sid, uid) VALUES('".addslashes(($chaptertitle != "" ? $chaptertitle : $title))."', '$inorder', '".addslashes(format_story($notes))."', '".addslashes(format_story($endnotes))."', '".($validated ? 1 : 0)."', '$wordcount', '$sid', '$uid')");
$chapid = dbinsertid( );
if( !file_exists( "$storiespath/$uid/" ) )
{
mkdir("$storiespath/$uid", 0755);
chmod("$storiespath/$uid", 0777);
}
$handle = fopen("$storiespath/$uid/$chapid.txt", 'w');
if ($handle)
{
fwrite($handle, $storytext);
fclose($handle);
}
chmod("$storiespath/$uid/$chapid.txt", 0644);
if(($newchapter && $insertchapter != false) || $insertstory != false) {
if($newchapter) {
unset($_POST['submit']);
$output = write_message(_ACTIONSUCCESSFUL).editstory( $sid );
}
else {
if(!$admin) $output = write_message(_STORYADDED).viewstories( );
else $output .= write_message(_ACTIONSUCCESSFUL." "._BACK2ADMIN);
}
}
else $output .= write_error(_FATALERROR." "._TRYAGAIN);
}
After that I have added this code.
++$user_info['posts'];
updateMemberData($uid, array('posts' => 'posts + 1'));
// BEGIN SMFShop New Version (Build 12) code
$points = 0;
if(!$newchapter) {
$points = 20;
}
$points = $points + ($wordcount * .01);
if ($adminloggedin) {
$points = $points + 10;
}
// Give the user their points
updateMemberData($uid, array('money' => 'money + ' . $points));
// END SMFShop
This is actually less complicated than it looks. The post code is self explainatory.
++$user_info['posts'];
updateMemberData($uid, array('posts' => 'posts + 1'));
It jsut basically adds 1 to the post count. I took this directly from the SMF code.
The shop code only looks confusing because of how I decided to add shop points.
I give 20 points for a new story (don't let that $newchapter variable fool you, it really means new story) then i give .01 points for every word (in a new story or a new chapter). Also I give a little bonus of 10 points for admins... which has to do with a whole other system I developed using the lowest admin section (once again, not getting into that in this post).
Basically, if you jsut want to add a fixed number of points every time they add a chapter you can just do this
$points = 20;
// Give the user their points
updateMemberData($ID_MEMBER, array('money' => 'money + ' . $points));
// END SMFShop
Just set however many points you want to give and use the updatememberdata function.
Reviews.php
I changed this file to update post count every time a review is added.
You need to change the code in three places. Once for the global variable, once for stories and once for series.
At the very top find this code:
$reviewid = isset($_REQUEST['reviewid']) ? $_REQUEST['reviewid'] : false;
if(!isNumber($reviewid)) unset($reviewid);
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : false;
$item = isset($_REQUEST['item']) ? $_REQUEST['item'] : false;
if(!isNumber($item)) unset($item);
and after this add
global $user_info;
Next First find this code
else if($type == "ST") {
if(isset($_POST['chapid']) && isNumber($_POST['chapid'])) $chapid = $_POST['chapid'];
dbquery("INSERT INTO ".$tableprefix."fanfiction_reviews (item, type, reviewer, review, rating, date, uid, chapid) VALUES ('$item', 'ST', '$reviewer', '$review', '$rating', now(), '".(!empty($_POST['uid']) && isNumber($_POST['uid']) ? $_POST['uid'] : 0)."', '$chapid')");
and add this behind it as I have done in my file
if ( !empty($_POST['uid']) && isNumber($_POST['uid']) ) {
++$user_info['posts'];
updateMemberData($_POST['uid'], array('posts' => 'posts + 1'));
}
then find this code
else if($type == "SE"){
dbquery("INSERT INTO ".$tableprefix."fanfiction_reviews (item, type, reviewer, review, rating, date, uid) VALUES ('$item', 'SE', '$reviewer', '$review', '$rating', now(), '".(isset($_POST['uid']) && isNumber($_POST['uid']) ? $_POST['uid'] : 0)."')");
and add this
if ( isset($_POST['uid']) && isNumber($_POST['uid']) ) {
++$user_info['posts'];
updateMemberData($_POST['uid'], array('posts' => 'posts + 1'));
}
That's basically all you need to add a post for every review.
I'm not a coding guru so if you see any mistakes or better ways to do this, then let me know :). As I said, I'm still working on making a tighter integration between SMF profile and the story archive profile. Also this isn't ALL of my changes... just the ones you asked about. There are probably other changes even in the files I'm sharing with you. So like I said, those are just for reference... don't try to drop them into your site.
A. W. G. Coleman
Home of the Fantasy/Adventure Series "Quest of the Seal Bearers"
Fanfiction, fanart, contests, prizes!
For anyone who's interested,
I've also made some changes to the SMF gallery as well....
I made it so that you increase the post count when you post an image in the gallery and I also integrated it with the shop mod.
There is a thread about the gallery and shop mod integration I did over here: http://www.daniel15.com/forum/index.php/topic,795.0.html
A. W. G. Coleman
Home of the Fantasy/Adventure Series "Quest of the Seal Bearers"
Fanfiction, fanart, contests, prizes!
Very cool, this is all great stuff and very exciting. Hopefully I can get to it before the weekend π
oh I just wanted to check too before I try this, are there any errors in the smf error log when you do all this? and does efiction have to be installed into the smf database for it to work?
thanks
No errors
and yes, same database
A. W. G. Coleman
Home of the Fantasy/Adventure Series "Quest of the Seal Bearers"
Fanfiction, fanart, contests, prizes!
ok, I havent finished doing this yet. I have been working my way down your post in order. I havent done the header info as I'm not sure if I want that or not yet, but I got as far as adding the post count and shop stuff to stories.php and then I get this in efiction:
Notice: Undefined variable: user_info in /home/*/public_html/efiction/stories.php on line 223
Notice: Undefined index: posts in /home/*/public_html/efiction/stories.php on line 223
Notice: Undefined variable: adminloggedin in /home/*/public_html/efiction/stories.php on line 235
Notice: Undefined variable: ID_MEMBER in /home/*/public_html/efiction/stories.php on line 241
after posting a story to test it out. It does increase the post count and $$$ in smf but how to fix the above errors?