PDA

View Full Version : Sneak Preview: Forms/Profiles for Forums


Zamtil
06-22-2001, 08:57 PM
Although I'm not quite ready for a release, I thought I'd announce this hack and get some feedback while I'm still in the development stages.

What does it do? Well, take a look first: http://www.noows.com/showthread.php?s=&threadid=1042

It allows you to associate a predefined fill-in-the-blanks form with a forum. Every thread can have form data associated with it, much like every thread can have a poll. Actually, with this hack, every thread can have both!

In my case, I run a small guild/gaming site where players of EverQuest want to display their in-game character information. Many players have multiple characters, etc, which really doesn't make extending the membership profiles easy or practical.

How does it work? ... Create a new thread/post as usual, associate a poll if the user wants. Once submitted, the thread starter or forum moderators, will have access to an 'edit form' button (same style/position as the existing 'new thread'/'post reply' buttons in the header/footer of every thread).

By clicking on the 'edit form' button, the user is presented with a fill in-the-blanks form.

formprefix field gets added to the forum table.

A new table, called {formprefix} gets added to your vBulletin database. (in my case, 'eqchar')

formid field gets added to the thread table.

When the user wants to edit a form, form.php processes form_edit_{eqchar}. For those viewing the thread, showthread.php processes form_show_{eqchar}.

Most of the work with this hack will be customizing the form_edit_ and form_show_ templates, as well as your table. Of course, once released I'd hope others would develop and share templates/table structures to truely make this a plug & play hack.

Your custom table must contain an integer field named 'id'.
After that, fields are labled as followed: text_{yourname}, num_{yourname}, and sel_{yourname}. Text type is self-explanatory. Num type ensures the user entered numeric data, or sets value to 0. Sel type is for drop down box selections. It's just a text field, but some extra processing is done to set the selector ("selected") to the current db value if the form is edited.

These same db field names are used as $formvars[text_{yourname}] within your templates to display the database values.

I'll probably add options for radio buttons and checkboxes. I seriously doubt I'll support binaries, as posts support this just fine.

Sorry for the default theme look, will change eventually. I just migrated from PHP-Nuke - what can PHPNuke do that vBulletin doesn't do better? I'm already looking into writing a SIMPLE home page/weblog for vBulletin. I want one-two files that I can drop in on top of vBulletin and go.

Ratorasniki
06-23-2001, 12:52 AM
looks very cool.

\/ash
06-23-2001, 01:38 AM
That will be very usefull for a game page.

chilliboy
06-23-2001, 05:20 AM
Nice!

ToraTora!
06-23-2001, 10:13 AM
i think there is other practical uses for this hack as well.
The one thing i grow tired of, is the lack of tabling in the VB threads as far as post responses go. So, if I wanted to add a area for baseball stats, I would basically have to do it in HTML, and link it to the site, in order for it to appear as a valid "chart", and not a jumbled up mess that appears when you try and do it within the forums itself. Top it off with the fact you have to have HTML on in order to clear up these situations if you wish to have it directly in your site, and not a link, its basically a mess waiting to happen.

Although my opinion on your development may not matter, I would like to be the first to encourage you in the finalization of this hack.
I see roughly 5 or 6 uses for this, that could pertain to many, many areas of use for those in the news, stats, games, etc department...its a excellent idea, and when you have fished this hack, I will be waiting in line for it. :)

chilliboy
06-23-2001, 12:40 PM
Totally Agree ToraTara,

I don't know if this would be possible as I don't know how your coding it, but here is something that I think would be good.

Say you have a 'sports team site' something like this would be really useful for stats on each player, team stats etc etc. Say you or a moderator started the thread, but didn't know a few stats so you would leave these blank. Registered users could, 'fill in the blanks', but before they where submitted to the 'final form' they would have to be verified by the moderator (which you can do through permissions anyway).

Hope you understand the idea - I look forward to seeing it in action.

ToraTora!
06-23-2001, 01:37 PM
That is exactly what was running at our set-up. It was just as a little extra feature, a little update if you will...nothing along the lines of ESPN or anything of that magnitude, but it has turned into a major headache for the guy who is maintainning it for us, and as such, its been sort of dumped on our lap now...lol..
The user that started the project, is basically giving up on it, due to the complete non-freindly tabling, and information interface.
With baseball, just for example, you are constantly changing stats, scores, rain delays...etc...I am glad that at this point, the NBA is done for awhile...lol...

The problem is, that the person taking care of this task, is also HTML illiterate. He had started putting them into the forums, and unfortuantely, as we all know, they wont table up, and he didnt know that. He had sunk in close to three hours lining everything up, and than when he hit submit, and than looked at what he had created, he was a little bit pissed to say the least.

So, i think that this would be a great addition, to a major problem of keeping the viewers of the forums, AT the forums, and not jumping around to other sites looking for info that we could provide at the same level of accuaracy, and than us as administrators can handle the other things, rather than having to go back and enter in all the information, for another members project..lol..

so, yes, the sooner the better...:)

chilliboy
06-25-2001, 03:30 PM
Just out of interest, I would be interested to know how you do it - just a simplified explanation.

Cheers

PS - The 'search' feature didn't go unnoticed either - very slick!

sysmom
06-26-2001, 05:08 AM
I'm VERY interested in this feature, and would like to add it to a game-based board, too.

I can't get to the example of it, server out to lunch message in my browser, but I will look at it tomorrow.

Are you looking for feedback about it specifically, or just a general "Yes I'm interested" type of response here?

-deb

Zamtil
06-26-2001, 06:14 AM
Originally posted by chilliboy

PS - The 'search' feature didn't go unnoticed either - very slick!

The search feature probably wouldn't be part of the hack. I could probably release it, but it'd require 100% customization (it's custom to my table of data). It's not auto-generated like the forms themselves... hmm.

Anyways, got distracted from this hack for a few days, working on a drop-in image gallery, while my guinea-pigs ... er, users ... play with the forms hack and find bugs.

Biggest thing I'm not happy with is the process of filling in a form. You go through the normal new thread/post/poll creation process. Then, when you VIEW the post, you have this button:
http://www.noows.com/images/editform.gif appear with the new thread, post reply buttons at the top/bottom of each thread. Initially, I was gonna code it into the new thread creation process: New Thread->Redirect New Poll (if needed)->Redirect New Form, but I REALLY HATE making code changes to the stock PHP files. As is, there's only 2 minor source code changes: showthread.php and admin/forum.php. Everything else is in a new PHP file, new templates, or template edits.

Unless any of my users find a bug tomorrow, I'll put out release on Wednesday and go from there.

chilliboy
06-26-2001, 08:19 AM
Can you not just drop these from the template? I haven't checked but I thought almost everything was optional via templates. I'm sure you could also do a work around using phpinclude (which means you not buggering source code).

I'm trying to do quite a lot of stuff from phpinclude, which if you know what variables are available to you, can be pretty useful. I'm still trying to find out if I can get the 'name' of the $styleid available to use in phpinclude (which would be dam useful!!!!).

Say you didn't want to use a different replacement set, or template set for you character profiles: Maybe you could just set a new style set for that forum which uses the same temp/rep set.
Call it something like "CharaterProfile" if you had this as a variable to reference in phpinclude you could do something like:

if ($styleid[name]?? == "CharaterProfile")
{
$Varible_for_Edit_GIF = $styleid[name] . "edit.gif";
}

(First you may need to pass the styleid to submit.php - but you can do this via appending &styleid=X in the template - or you could just append your own varibiable - which if present runs another script in phpinclude etc etc)

or something along those lines. If you get away from useing the 'replacement sets' to alter 'replacement variable' and set them from phpinclude you have a lot more flexibility. You can run switch() statements relating to forum: name, number, styleid etc etc then create you replaceables as variable to drop into templates.

Hope this may help you in what you are after - or maybe I'm on the wrong track.

PS - Anyone know with variable holds or how I could get hold of the NAME of styleid in phpinclude I'd be really greatful.

Cheers

Zamtil
06-27-2001, 03:50 PM
As I started to get this ready for release, I realized my 'eqchar' form and table were too long for a simple example. So, for those following this thread, here's your opportunity! I'm looking for ideas for a simple, general purpose form. I'd like to keep this to 5-10 fields MAXIMUM, so people aren't overwelmed when it comes to customizing the SQL and templates.

At least one field should use a drop down selector. Please provide values for the selector.

ToraTora!
06-27-2001, 09:46 PM
sure thing. I will have a example for you later tonight.
Im going to leave out the posting addys and such, but it will give you a basic idea of what i was thinking of.

ToraTora!
06-28-2001, 12:32 AM
http://vmudwnload.tripod.com/vbexample.html

Now, keep in mind none of the functions work other than the reset. :)

We are currently searching server options, so i wasnt able to get everything patted down for posting links, or testing it fully out in PhP land, plus Im not completely sure how you have the hack set up for posting anyways..(my guess is postpoll..some of new thread...vbform...etc...so its a basic shell, hanging on good ol tripod...lol..

Take a look and see what you think.

make sure you have your other browser window the (one that pops up when you click on the link) on full view to get a better picture of how it should look. Tripod has a way of making things look screwed up..I did the code on Arachnophilia, and had it all nice and neat, and "beautified". I dropped it into tripods HTML..and it litterally butchered it...lol...

chilliboy
06-29-2001, 09:04 AM
Any news Zamtil?

Zamtil
06-29-2001, 09:59 PM
Originally posted by chilliboy
Any news Zamtil?

My forums got slammed the last couple days.. some game server down time, everyone headed for the boards. Anyways, I'm going to release my image gallery hack tonight.. packaging it up now. I'll try to do forms sometime this weekend.

ToraTora!
06-29-2001, 10:04 PM
was that stat cateragory suggestion useful? lol
I dont know why i made it up to tell you the truth, due in part a person will be able to select what they want added in there anyways...

The select option will be used though correct?

VirtueTech
07-01-2001, 12:05 PM
Firstly let me say this is a great idea.

It would be great if somehow the process was cut in half. Allowing admins to designate profile forums and then instead of the user having to start a new thread then go and click on "Edit Form" if the script new that the new thread was in the "Profile Forum" to just bring up the "Edit Form" template instead.

I think the process of having to do the two things will confuse some users.

However, this hack is greatly needed and will certainly help in many ways. Thanks Zamtil :)

Zamtil
07-03-2001, 06:17 PM
Originally posted by VirtueTech
Firstly let me say this is a great idea.

It would be great if somehow the process was cut in half. Allowing admins to designate profile forums and then instead of the user having to start a new thread then go and click on "Edit Form" if the script new that the new thread was in the "Profile Forum" to just bring up the "Edit Form" template instead.


Yeah I'm not real happy with the creation process either. I really don't want to hack up 3-4 vBulletin files though, and try to make it a guided process: New Thread->New Poll->New Form.

On the other hand, most of my users want to use the message body for attaching pictures or doing their own weblog, so skipping the message creation part altogether isn't practical.

I haven't forgotten about this hack, but with all the problems people had getting my Image Gallery hack to work over the weekend, I'm a little gunshy about getting this one ready. I considered the ImageGallery hack the simple one to install, and I think I wrote 20 messages troubleshooting it over the weekend. =(

chilliboy
07-03-2001, 07:01 PM
Hi Zamtil,

From what you have said I guess this hack is going to require adding numerous addition fields to existing table am I correct in this??

If this is so - and is one of the reasons why it is difficult to install and probably require a fair bit of time 'bug fixing' - then one way of significantly cutting down the required fields would be to do something like this:

When you are creating a 'customised field' in a submit form you prefix the variable 'name' with 'custom'. So as an example I would have :

variable name: Custom_Name , variable value: some holiday
variable name: Custom_Introduction, variable value: blah blah
variable name: Custom_Description, variable value: blah blah
variable name: Custom_Available Dates variable value: July5
variable name: Custom_Cost variable value: ?500
variable name: Custom_Contact variable value: e-mail@home.com

$Custom_Check = "custom";
$Custom_Field_Seporater = "field split here";
$Values_Seporater = "values split here";


foreach($HTTP_POST_VARS AS $key => $value)
{
$Custom_Field = substr_count($key , $Custom_Check);
if($Custom_Field)
{
$key = str_replace($Custom_Check , "", $key);

$Custom_Data .= $Custom_Field_Seporater . $Values_Seporater . $key . $Values_Seporater . $value;
}
}
// You now have all the custom fields as a string with certain 'seporaters' which can be used to get the information back in the required format for processing later. The string $Custom_Data then gets put in the 'additional content' field in the table.

To get the information back you can do something like this:

// Get the string from the 'additional content' field then:

$Fields_and_values = explode($Custom_Field_Seporater, $Custom_Data);
foreach ($Fields_and_values AS $Extract_Info)
{
$Data = explode($Values_Seporater, $Extract_Info);
$Custom_Field [$Data[1]] = $Data[2];
$Custom_Field [$Data[1]][name] = $Data[1]
}

I should now have an array $Custom_Field which holds the names and values of my custom defined fields which I can put into my related template as variables to be parsed.

This way obviously limits on search capabilities and stuff, but significantly reduces the problems you would have with adding lots of new table field and associated problems. Its also pretty flexible as all the 'custom' data is only ever stored in one field, you don't have to bother with adding new fields to a table everytime you want to add something another value into your
submit form. You may be able to move quite a lot of the 'hacking' into the phpinclude file, which would also be helpful for upgrades etc.

As I don't know how your code works for this I may be barking up the wrong tree, but I thought I'd give you my input in the off chance it would be of use.

Cheers

Zamtil
07-03-2001, 07:19 PM
Originally posted by chilliboy
Hi Zamtil,

From what you have said I guess this hack is going to require adding numerous addition fields to existing table am I correct in this??

foreach($HTTP_POST_VARS AS $key => $value)
{
$Custom_Field = substr_count($key , $Custom_Check);
if($Custom_Field)
{
$key = str_replace($Custom_Check , "", $key);

$Custom_Data .= $Custom_Field_Seporater . $Values_Seporater . $key . $Values_Seporater . $value;
}
}


Nah, only change to EXISTING tables is a custom field (formprefix)in the forum table and (formid) in the thread table.

All the custom data is stored in your OWN table called (formprefix).
I then use code like you used above to convert database fields into PHP variables.

I've had a couple variations on this code, and the original did what you're suggesting - pack the data. But, on my site, I wrote a custom search engine for filtering/displaying the custom table. It can't be searched by vBulletin, but it's still a pretty clean interface, IMHO.

My search: http://www.noows.com/eqprofiles.php

Bit of SQL for custom table:

CREATE TABLE eqchar (
id int(11) NOT NULL auto_increment,
text_name varchar(60) NOT NULL default '',
sel_server varchar(30) NOT NULL default '',
text_guild varchar(100) default '',
sel_religion varchar(20) default '',
num_level smallint(8) default '0',
sel_class varchar(15) NOT NULL default '',
sel_race varchar(15) NOT NULL default '',
sel_sex varchar(8) default '',
num_hp int(11) NOT NULL default '0',
num_ac int(11) NOT NULL default '0',
num_atk int(11) NOT NULL default '0',

The text_, sel_, and num_ prefixes determine how I handle/display/basic error check the data. 'eqchar' is my formprefix for forumid 84 & 69. Every thread in those forums then references an 'id' in the 'eqchar' table. Clear as mud? =)

chilliboy
07-03-2001, 07:33 PM
Sounds:D and I look forward to it.

buda
07-13-2001, 07:30 PM
Very Very Cool Zamtil.

Just One question, when can we get our hands on this?

:D

VirtueTech
07-25-2001, 05:48 AM
Any word on this release yet....I'm very anxious. :)

iaewedar
07-31-2001, 01:15 PM
Heyas Zamtil...just wanted to check in with you to see if you had decided on releasing this one bro. Great work :)

Yozsef
08-02-2001, 06:17 PM
Hey bro, release this already, it works like a champ on your site. :)

water
08-20-2001, 05:19 PM
any news? would love to see this released :)

:water

venti
11-29-2001, 09:18 PM
Zamtil,

This is exactly the thread Ive been looking for. I also have an EQ guild site, and am VERY interested in this hack. Can you please share this hack? If so, Id be very grateful.

Venti
The Honorable Few
~Veeshan

www.thehonorablefew.com/forums
Venti@thehonorablefew.com