Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #31  
Old 02-08-2004, 01:02 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$DB_site->insert_id() gives you the id generated by the last mySQL INSERT statement (if inserting into a table with an auto-increment column like postid, threadid, etc.).

But you don't need that (see my previous post) if you are using vB functions to create threads/posts - only if you are manually dealing with the database.

> But I can only use $post['threadid'] and $post['postid'] after the build_new_post is hit in the code, correct?
Yes, that's correct.
Reply With Quote
  #32  
Old 02-08-2004, 01:03 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So would this part of the code I edited in to that last post work?
PHP Code:
// build the thread 
build_new_post('thread'$foruminfo, array(), 0$post$errors); 

// Errors? 
if (sizeof($errors) > 0) { 
  
// error processing 

ThreadID $post['threadid']; 
PostID $post['postid']; 

ThreadID and PostID are columns in a table I have created.
Reply With Quote
  #33  
Old 02-08-2004, 01:06 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not really, as there are $-signs missing before ThreadID and PostID and thus it won't compile
But the concept is right.

I don't know what you want to do with your table but you could call

PHP Code:
$DB_site->query("INSERT INTO yourtbl (ThreadID,PostID) VALUES ($post[threadid]$post[postid])"); 
to get the IDs into your table. Or make an update or whatever you want to to with the values.
Reply With Quote
  #34  
Old 02-08-2004, 01:09 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lol yeah. Conceptually it's kewl. That definitely just solved like 5 potential SNAFUs! Trying to think if there were any other questions I had... (re-reading the thread quickly)...
Reply With Quote
  #35  
Old 02-08-2004, 01:16 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, this is a minor one. If you look at the original post that started this thread, it has the title of the thread within the top of the post. I know that with proper use of templates an postbit this can be removed, but is there a way to prevent it from getting into the DB at all?

Also, with
PHP Code:
$DB_site->query("INSERT INTO yourtbl (ThreadID,PostID) VALUES ($post[threadid]$post[postid])"); 
$post[postid] is supposed to be $post['postid'] (quotes) correct? Also, $DB_site->query is just vB's way of doing $result = mysql_query($sql, $connection); right?

Also, what do you guys think about this comment I made earlier:

I'm also looking into how to auto create a forum/sub forum, but for security reasons, I think I might not let the bot have this access, and find out how to do it with normal mySQL statements (or $DB_site->query now that you've shown me its wonders)
Reply With Quote
  #36  
Old 02-08-2004, 01:21 AM
M1th's Avatar
M1th M1th is offline
 
Join Date: Jul 2002
Location: UK
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow... this is almost the thing I need too!!

Er.. I want to create a thread automatically when a member reaches xth number of posts. I want to be able to exclude some forums from their post counts (that i know how to do). What I'm having trouble with is the actual conditional for this and also WHERE to put the code (which php file).

appreciate any help.
Reply With Quote
  #37  
Old 02-08-2004, 01:26 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That might boil down to a cron job, as they could hit that number at any time. There might be a way though for the vB admin system to PM or email you when members hit x # of posts, and you create it manually. then again, if it can notify u, it can make a thread

This will turn into one kickass tutorial for others! Much props goes to you all!
Reply With Quote
  #38  
Old 02-08-2004, 01:28 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

> but is there a way to prevent it from getting into the DB at all?
AFAIK not. This would require a modification of build_new_post().

> $post[postid] is supposed to be $post['postid'] (quotes) correct?
You can ommit the quotes.

> Also, $DB_site->query is just vB's way of doing $result = mysql_query($sql, $connection); right?
Yes. vB uses a class (DB_sql_vb) the wraps mysql_ functions and thus makes database-handling easier.
Reply With Quote
  #39  
Old 02-08-2004, 01:34 AM
M1th's Avatar
M1th M1th is offline
 
Join Date: Jul 2002
Location: UK
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Wired1
That might boil down to a cron job, as they could hit that number at any time. There might be a way though for it to PM or email you when members hit x # of posts, and you creat it manually. then again, if it can notify u, it can make a thread

This will turn into one kickass tutorial for others! Much props goes to you all!
Ah, thats a good way too, though, im not sure how that differs from creating a new thread/post?



Hmm, what I was thinking is, a way to do a check on members post count after they've done a new post. So the code has to go kinda after all that. Question is, where is the best place to put such a code.
Reply With Quote
  #40  
Old 02-08-2004, 01:34 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

>> $post[postid] is supposed to be $post['postid'] (quotes) correct?
>You can ommit the quotes.

Everywhere, or just within $DB_site->query?

> Hmm, what I was thinking is, a way to do a check on members post count after
> they've done a new post. So the code has to go kinda after their own post sql > query or new post function. Question is, where is the best place to put such a
> code.

oooohhhh I get it now. Hrm... I suppose you'd slap that into the build_new_post function, or right after a call to that function. beats me where the best place would be though.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:20 PM.


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.04499 seconds
  • Memory Usage 2,270KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete