PDA

View Full Version : show postid in post


harmor19
01-23-2006, 02:51 AM
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
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
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

$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);

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


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
$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.
$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:
$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.