Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Get postid # in a thread? Details »»
Get postid # in a thread?
Version: , by Ian Cunningham Ian Cunningham is offline
Developer Last Online: Jul 2018 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-27-2002 Last Update: Never Installs: 0
 
No support by the author.

Hi,

I have a news catagory in one of my forums, with about 50% of the posts containing attached images... (see http://www.pcreview.co.uk/showthread...=&threadid=154 for example)

I am currently attaching the image, then editing the post and adding [ IMG ] attachment.php?s=&postid=xxx [/ IMG ] in the post, because I now know the postid #

I cant just tell VB to show the image in the post in the news options, because I need it in various places in the post

Is there any way to modify VB so that I can add a string in a post, and when it is posted, it appears as the attached image?

Thanks, Ian

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 03-28-2002, 02:27 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok then stick that line (str_replace(...)) in webnews.php, since you are not passing the post through bbcodeparse().
Reply With Quote
  #13  
Old 03-28-2002, 04:20 PM
Ian Cunningham Ian Cunningham is offline
 
Join Date: Feb 2002
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I still cant get this thing to work, but here's a code snippet if thats any help... where {postid} should appear, it is just blank!

PHP Code:
<?php
//PluhNews 1.5 released under GNU GPL Licence version 2.0 (see copying.txt file for more info)
//Set your permissions in your control panel to make sure that only YOU and who you specify can post news. Otherwise, everyone and their dog can register and post in your news forums, thus posting where your news will appear. But for this script to work it's extra magic, be sure your members can reply to your news posts.

require("./newsconfig.php");
require(
'./admin/config.php');
str_replace('{postid}'$post['postid'], $bbcode);

//scroll down to edit the HTML for the news
//**********************

$newsforums 47;

//Number of news items to show at once
$newsitems 12;

//Path to your forums directory (leave out trailing slash)
$forumspath "/";

//Start the goodies (please do not edit to goodies unless you know what you are doing

//connect
$connection mysql_connect("$servername","$dbusername","$dbpassword") or die ("Cannot connect to server.");

//select database
$db mysql_select_db("$dbname"$connection) or die ("Could not select database.");

// create sql statement
$sql "SELECT threadid, title, forumid, replycount, postusername, postuserid, lastposter, dateline, iconid FROM thread WHERE forumid IN ($newsforums) ORDER BY threadid DESC LIMIT $newsitems";

//execute sql query
$sql_result mysql_query($sql$connection) or die ("Could not execute query.");

if (!
$sql_result) { 
  echo 
"<p>Could not get record.";


while (
$row mysql_fetch_array($sql_result)) {
   
$threadid $row["threadid"];
   
$title $row["title"];   
   
$forumid $row["forumid"];
   
$replycount $row["replycount"];
   
$postusername $row["postusername"];
   
$postuserid $row["postuserid"];
   
$lastposter $row["lastposter"];
   
$iconid $row["iconid"];
   
$dateline $row["dateline"];

//create the second SQL statement to pull the post from the thread it resides in
$sql2 "SELECT postid, threadid, username, userid, title, dateline, pagetext, iconid FROM post WHERE threadid = \"$threadid\" ORDER BY postid ASC LIMIT 1";

//execute second sql query
$sql_result2 mysql_query($sql2$connection) or die ("Could not execute query in second sql statement.");

if (!
$sql_result2) { 
  echo 
"<p>Could not get record in second statement.";


while (
$row2 mysql_fetch_array($sql_result2)) {
   
$pagetext $row2["pagetext"];



//gotta convert that damn unix time crap
$dateposted vbdate("D j M Y, g:i A",$dateline);
//end the goodies

if ($replycount==1) {
 
$commenttext "Comment";
 }
else {
 
$commenttext "Comments";
 }

$bericht=bbcodeparse2($pagetext,"1","1","1","1");
// **********************
//Edit the HTML here (keep in mind that any double quote that is HTML requires a backslash in front of it)


echo "
<a name=\"
$threadid\"></a>
<a href=\"showthread.php?s=&threadid=
$threadid\"><b>$title</b></a><br>
</center>

<blockquote></a>
$bericht</blockquote><center>Posted By <a href=\"member.php?s=&action=getinfo&userid=$postuserid\"><b>$postusername</b></a> at  <i>$dateposted</i>
   -   <a href=\"showthread.php?s=&threadid=
$threadid\"><b>$replycount</b> $commenttext</a></center><p><br><br>
"
;

}
}


//add news search stuff (this is optional - delete if you do not wish to include this, or edit it to meet your needs
echo "<center><a href=\"search.php?s=\">Search the News</a> | <a href=\"forumdisplay.php?s=&forumid=$newsforums\">View All News Posts</a></center>";

//end HTML edit
//**********************

//disconnect
mysql_free_result($sql_result);
mysql_close($connection);
?>
Reply With Quote
  #14  
Old 03-29-2002, 04:19 PM
Ian Cunningham Ian Cunningham is offline
 
Join Date: Feb 2002
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm afraid I'm still a php n00b, so I haven't been able to figre this one out still
Reply With Quote
  #15  
Old 03-29-2002, 04:46 PM
Ian Cunningham Ian Cunningham is offline
 
Join Date: Feb 2002
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have figured out that that code only makes references to the threads, not the posts...

I think I need something like this in there:

PHP Code:
$getpostid=$DB_site->query_first("SELECT postid FROM post WHERE threadid='$threadid'" LIMIT 1); 
but I'm really not sure
Reply With Quote
  #16  
Old 03-30-2002, 05:18 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok replace this:
Code:
   $pagetext = $row2["pagetext"];
with this:
Code:
   $pagetext = str_replace('{postid}', $row2['postid'], $row2['pagetext']);
That should do the trick.
Reply With Quote
  #17  
Old 03-30-2002, 10:17 AM
Ian Cunningham Ian Cunningham is offline
 
Join Date: Feb 2002
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FireFly, you're a genius :laugh:

Thankyou!
Reply With Quote
  #18  
Old 03-30-2002, 10:20 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No problems.
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 04:34 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.05118 seconds
  • Memory Usage 2,305KB
  • Queries Executed 22 (?)
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
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)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