News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Wakaba and SMF (works!) Support needed please

Started by crimpson, March 10, 2014, 02:53:25 AM

Previous topic - Next topic

crimpson

Revised

I've been working to incorporate Wakaba into my SMF site.
See what I've gotten so far: Mysite
It works perfectly despite Wakaba being a perl based system. (I'm a noob so I'm not a 100% on all the compatibilities)

I put this in futaba_style.pl in the body section
<?php 
include '../header.php';
include 
'../../header.php';
include 
'../ssi.php'
include '../../ssi.php'
?>



The first problem I realized: Each topic that is created in the wakaba system gets its own .html page generated for it. example: first topic created was assigned /res/1.html, second got /res/2.html and so on. So the "Reply" link redirects the browser to that html.

So I configured the settings in config.pl so that all the pages were generated with the php extension (starting line 120) with the above code automatically included by the futaba_style.pl so that every page included the forum header.php (and footer)

Also the problem was with the "require 'header.php'" command. When a user clicked on the "reply" button the site would fail to load because the "required" header could not be found buy looking one directory up instead of two. I fixed that by using include instead of require so that if the header file was not found the page would continue to load and it would find the header in the second include command... make since?
---------------------------

Now, what I'm having trouble accomplishing is getting the posts to automatically include the user info from smf system... at minimum a link to their profile or private message. Wakaba is already set up to separate users who make posts and logging their IP for banning. There are input fields for link and name and all I have to do is echo the smf user's name and profile link into those fields and it will be incorporated into their post.

Something like $context['user']['link'] -or- global $user_info
view the attached image postblock.jpg
The field "link" automatically links the user "name" to whatever link is inserted in the "link" field any time a post is made. This needs to be the link to the user's profile.
The field for "name" needs to echo the smf's user name and whala! problem solved.
The "name" and "link" fields can easily be hidden so that users cant input their own data.

By default the link field is left blank and the user name is "anonymous" unless specified.
Here's the solution I'm thinking of:

So what I'm stuck on is how to get the user's name and profile link from smf inserted into those fields so that it's stamped in with their post.

Here's the code lines (in the futaba_style.pl attached) that generate the input fields for "name" and "link"
line 90

<if !FORCED_ANON><tr><td class="postblock"><const S_NAME></td><td><input type="text" name="field1" size="28" /></td></tr></if>
<tr><td class="postblock"><const S_EMAIL></td><td><input type="text" name="field2" size="28"</td></tr>

"EMAIL" is the "Link" field.
What I tried was something like this:

<tr><td class="postblock"><const S_EMAIL></td><td><input type="text" name="field2" size="28" value="<?php global $user_info?>"</td></tr>

or something like this:

<if !FORCED_ANON><tr><td class="postblock"><const S_NAME></td><td><input type="text" name="field1" size="28" value="<?php echo $memberContext[$user]?>" /></td></tr></if>
<tr><td class="postblock"><const S_EMAIL></td><td><input type="text" name="field2" size="28" value="<?php echo $memberContext['link']?>"</td></tr>

I 'm probably way off with the php command I'm trying to use.
I have little idea what I'm doing, learning as I go and those were just guesses. It didn't work. of course ssi.php has been included.
I imagine what I'm trying to accomplish should be pretty easy, I'm just not proficient enough with php code.
By the way, the futaba_style.pl is the main file that drives the entire Wakaba (imageboard) layout. Modifying this file reflects on the entire system and every page and post that's created within the Wakaba system. I've attached it if anyone wants to see the entire code (which isn't that big really).

Whatever is stored in the "EMAIL" field, labeled "Link" when viewing in the browser, gets stored in the system somehow and the Wakaba scripts automatically tie that "link" with wht the post made by that user. I think it's information stored in the database. Anyway, I'm pretty sure that if i can just get that field automatically populated with a link to the whoever's posting profile, than my problem would be solved.

If the user is a guest... I'm not really sure. I guess the command to fetch their profile link would be ignored, they wouldn't have access to input their own data in the "name" and "link" fields and it would just revert to the default "anonymous". If there is a problem with this than I can just make it so that only registered users can access the imageboard link.

---------------------------------------------------------------------------------------------------------

I was looking at how Spatry did this with phpfreechat here. It seems pretty similar to what I'm trying to do.

Storman™

Congrats on getting your integration working and for posting details on how you achieved it. The info could be helpful to others which is appreciated.

However, the topic probably doesn't belong in the SMF support board so I'm going to move it the "Portals, Bridges, and Integrations" board where it's probably more relevant.

Cheers  ;)

drguild

Cane across this while browsing looking for the exact thing you did.

I tried to do this not too well years ago but thinking of getting a site up again with a forum / imageboard for a semi public community possibly in the next few months.

So just was looking into it again to see what's what out of interest and see if it could be achieved better.

So posting here to say this post is helpful and thanks for sharing and I'll be looking at it myself in the nearish future.

Advertisement: