vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   show postid in post (https://vborg.vbsupport.ru/showthread.php?t=106068)

harmor19 01-23-2006 02:51 AM

show postid in post
 
I am using a data manager to send text to a post.
Is there a code that will show the postid of the post it's on?

I already tried $post[postid]

In theory this is how the link is supposed to be

hosting.php?do=accept&postid=880058&userid=82213

Zachery 01-23-2006 02:54 AM

Quote:

Originally Posted by harmor19
I am using a data manager to send text to a post.
Is there a code that will show the postid of the post it's on?

I already tried $post[postid]

why not just edit the postbit template?

if you are doing it inside of files

$vbulletin->post['postid']

harmor19 01-23-2006 02:56 AM

I guess when in doubt use $vbulletin->


Edit:
It didn't work.

Zachery 01-23-2006 03:16 AM

Quote:

Originally Posted by harmor19
I guess when in doubt use $vbulletin->


Edit:
It didn't work.

Ok, how about some more info?

The postid is already inside of the postbit template, what exactly are you trying to do, and how?

harmor19 01-23-2006 10:21 AM

This is part of the data manager that I have in my hack

PHP Code:

$postdm = new vB_DataManager_Post($vbulletinERRTYPE_STANDARD);

    
$postthreadid $ht['host_thread'];
    
$postuserid $vbulletin->userinfo['userid'];
    
$postpagetext "[b]Upgrade Hosting[/b]\n
                     [b]Subdomain:[/b] "
.$_POST['subdomain'].".iconrate.net\n
                     [b]Username:[/b] "
.$_POST['susername']."\n
                     [b]Password:[/b] 
$pass\n
                     [b]Plan:[/b] "
.$hp['title']."
                     \n\n
                     [url=\""
.$vbulletin->options['bburl']."/hosting.php?do=accept&postid=".$vbulletin->post['postid']."&postuserid=".$vbulletin->userinfo[userid]."\"]Accept[/url] | [url=\"".$vbulletin->options['bburl']."/hosting.php?do=decline&postid=".$vbulletin->post['postid']."&postuserid=".$vbulletin->userinfo[userid]."\"]Decline[/url]"

In the two links I have "postid=".$vbulletin->post['postid']."

I want to do this because when I click the link I want to automatically edit the post.

Marco van Herwaarden 01-23-2006 10:56 AM

If you want to have the postid of the post you are going to create, it is not there until after the post is made.

harmor19 01-23-2006 06:56 PM

Tell me if the following will cause conflict if I have a large userbase.

Before I process the post data manager I get the last postid
PHP Code:

$getpost $db->query_read("SELECT * FROM " TABLE_PREFIX "post WHERE postid ORDER by postid DESC ");
    
$post $db->fetch_array($getpost); 

Then I add one to it.
PHP Code:

$postid $post['postid'] + 1


Marco van Herwaarden 01-23-2006 07:13 PM

Well what you try is selecting all posts, so yes that would put a high load on the server. If you really want it like this then use the following:
PHP Code:

 $post $db->query_read("SELECT * FROM " TABLE_PREFIX "post ORDER BY postid DESC LIMIT 1"); 

But this would be very unaccurate, and likely to fail regular, since another post could have been made in this time.

I still don't understand why you want to create a post that contains the postid of the post itself.

harmor19 01-23-2006 07:24 PM

The reason why I want the postid in the post is because I have two links.
When I click the link I want to automatically edit the post and remove the two links and replace them with the respected text.

Marco van Herwaarden 01-23-2006 07:29 PM

Why not just a link in the postbit when displaying the post?

harmor19 01-23-2006 07:30 PM

explain please.

Marco van Herwaarden 01-23-2006 07:43 PM

You are now trying to put the link in the posttext itself. Why not just put the link somewhere in the postbit when displaying the post (when you display it, you already have the postid).

Otherwise the best would be to first create the post, retrieve the postid of the created post, then edit the posttext.

harmor19 01-23-2006 08:06 PM

I understand, kind've how the signature is already in the template.

Is there a conditional for threadid?
Something like...
<if condition="$threadid == 2">Links here</if>

Marco van Herwaarden 01-23-2006 08:17 PM

Use $post[threadid]

harmor19 01-23-2006 08:41 PM

Thanks, I got it now.


All times are GMT. The time now is 04:39 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.01276 seconds
  • Memory Usage 1,760KB
  • 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_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)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