The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Hello folks,
I got a question, I want know what's the condition that says whether it's the first post of a given thread or not within a "plugin" (which is linked to "showthread_postbit_create" hook), it's the equivalent of : PHP Code:
Thanks in advance. |
#2
|
|||
|
|||
![]()
That hook is called before the isfirstshown is set, but you can use this:
Code:
if ($counter == 1 AND $fetchtype == 'post' AND $post['visible'] == 1) { } Also, that hook is called froom some scripts other than showthread (newreply.php, editpost.php, comments.php). The above might work because $fetchtype is probably not set in the other scripts, but you could add THIS_SCRIPT == 'showthread' to be safe. |
#3
|
|||
|
|||
![]()
Nice, it works except something, I have something to add just to the first post, but -and you're right about the hook- now I'm getting it for each post of the thread, what's the point kh99?
And where to put THIS_SCRIPT == 'showthread'? |
#4
|
|||
|
|||
![]() Code:
if (THIS_SCRIPT == 'showthread' AND $counter == 1 AND $fetchtype == 'post' AND $post['visible'] == 1) { } |
#5
|
|||
|
|||
![]()
Thank you dear but unluckily it still the same problem, it shows the thing in every post, very annoyed. I think it's logical, as long as we're on the same thread, "showthread_postbit_create" should be called in all posts of the same thread, or what?
|
#6
|
|||
|
|||
![]()
Yes but $counter should only be 1 for the first post. That if condition I posted above is exactly the same as is used to set $post['isfirstshown'].
|
#7
|
|||
|
|||
![]()
Wow, I printed the $counter and I found it's the same (is 1) on every post, it's weird, does this make sense to you?
|
#8
|
|||
|
|||
![]()
No, it doesn't. You said you're using hook location showthread_postbit_create, right? You could post your plugin code if you want us to check it out.
Edit: Actually it might make some sense - are you using threaded or hybrid display mode? |
#9
|
|||
|
|||
![]()
Absolutely I could:
PHP Code:
Honestly I don't know what the display mode is ![]() |
#10
|
|||
|
|||
![]()
Oh...well the reason that it's showing up in every post is because you're changing the cached template, which is used for every post. And if you inserted the value of $counter in the template, it would of course always show a value of 1.
What you could do is, instead of modifying the cached template for every post, change it once and insert some php code that checks $post['isfirstshown']. That will get even trickier because you need to make the replacement string so that the resulting cached template is valid php code that build the string you want. (I hope that makes sense). |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|