vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Manage Comments/Questions for your WebSite with this Script. (https://vborg.vbsupport.ru/showthread.php?t=12371)

dubucm 03-26-2001 08:22 PM

Hi everyone,
First I apologize for my "frenchie" english :).

Vbulletin is a great forum software.... but many of us are webmaster from website with articles, tutorials, contribution and more :).

We are all using PHP/MySQL to have "automated" website.

As far as i am concern, my website deals with Flash. And i needed to have comments/questions forums for all of my tutorials and contributions.

My website is "automatic" and a user can add a script/tutorial so i was obliged to found a way to automatically create this comments forum. ( and with VBulletin on my website i did not want to create a comments table .... )


So here is a script with some usefull function to do that.

It creates a thread and insert a message in it. ( you should create a forum not visible from the users and use it's forum id ).

You can easilly understand how it works i think. :).
Do not h?sitate for questions... i'll help you.

( Just wanna thanx TubeDog for his helps ).

I'll improve the script adding those features :

- Functions to retreive number of comments/questions for an article.

- E Mail sending to the articles author for each new responses.

- and more ... jsut ask away :).

here it is :
PLEASE TAKE CARE OF CHANGING i conid by iconid ( the same for ipad dress by ipaddress etc.. ( see the post from tubedogg bellow ) due to a "bug" i cannot fix it manullay in my post sorry.

PHP Code:

<?
function InsertThread($THREADTITLE)
{
global $mysql_link_forum,$mysql_link_corpo,$db_forum,$db_corpo;
mysql_db_query($db_forum,"INSERT INTO thread(threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastposter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes("$THREADTITLE")."','".time()."','38','1','0','martin','2','martin','".time()."','1','1','0')",$mysql_link_forum) or die ("REQUETE PB1.");
// give the thread id
$threadidresult = mysql_db_query($db_forum, "SELECT threadid FROM thread WHERE title='".addslashes("$THREADTITLE")."'" , $mysql_link_forum) or die ("REQUETE PB.");
$threadid = mysql_result($threadidresult,0,0) or die ("REQUETE PB.");
return $threadid;
}
function InsertPost($THREADID,$MESSAGE) 
{
global $mysql_link_forum,$mysql_link_corpo,$db_forum,$db_corpo;
mysql_db_query($db_forum,"INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$THREADID','','martin','2','".time()."','','".addslashes("$MESSAGE")."','1','1','127.0.0.1','1','1')",$mysql_link_forum) or die ("REQUETE PB2.");
}
function UpdateTutTable($THREADID,$TUTID)
{
global $mysql_link_forum,$mysql_link_corpo,$db_forum,$db_corpo;

mysql_db_query($db_corpo,"update TUTORIALTABLE set threadid='$THREADID' where artid='$TUTID'",$mysql_link_corpo) or die ("REQUETE PB3.");
}
function AddTutForum($TUTID)
{
global $mysql_link_forum,$mysql_link_corpo,$db_forum,$db_corpo;
$result_tut = mysql_db_query($db_corpo,"SELECT title,description FROM TUTORIALTABLE WHERE artid='$TUTID'",$mysql_link_corpo) or die ("REQUETE PB4.");
list($THREADTITLE,$MESSAGE) = mysql_fetch_row($result_tut);
$MESSAGE.="<br>Use this thread to post all your comments / questions on this article.";
$THREADID=InsertThread($THREADTITLE);
InsertPost($THREADID,$MESSAGE);
UpdateTutTable($THREADID,$TUTID);
echo "DONE";
// jsut to see if everythin as well worked. :)
}
// MAIN PROGRAM
$dbhost='';
$dbname_forum='';
$dbname_corpo='';
$dbpass_forum='';
$dbpass_corpo='';
$dbuser_forum='';
$dbuser_corpo='';
$db_forum = '';
$db_corpo = '';
$mysql_link_forum = mysql_connect($dbhost,$dbuser_forum,$dbpass_forum) or DIE ("Impossible de trouver la serveur de donn?e1");
$mysql_link_corpo = mysql_connect($dbhost,$dbuser_corpo,$dbpass_corpo) or DIE ("Impossible de trouver la serveur de donn?e2");
AddTutForum($TUTID);
?>

it's really a little contribution but it's my first one... and i know vbulletin since only 1 week ... :)

03-26-2001 09:40 PM

This is my fault, cause I gave you the code (but I think it's really vB's fault, because I double-checked the code!!), but in the insert thread function, you need to change
Code:

dateline,i conid,visible
to
Code:

dateline,iconid,visible
and in the insert post function, change
Code:

showsignature,ipad dress,iconid
to
Code:

showsignature,ipaddress,iconid
Looks good! :)

03-26-2001 09:46 PM

Yes it's already done in the script I gave.. I had some mysql error ... :) but it was so strange to have i conid... so a little "phpmyadmin trip" and it was corrected.

Tommorrow i'll add some functions :).

But do you know how i can have an e mail automaticcaly send to the author of the article when a message is posted in the thread ?

03-26-2001 09:49 PM

Wow ... i think in fact it s when we cut/paste the script he automatically add a space between i and conid ... but i don t know why ... :).

I'll try to fix it manually by editing my post :).

andy_C 06-03-2001 05:17 PM

Any updates on this project? Looks very very good

andy_C 06-10-2001 02:27 PM

bump:eek:


All times are GMT. The time now is 05:52 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01083 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete