PDA

View Full Version : Condition "if you have posted in this thread


Scanu
07-23-2012, 03:41 PM
Hi i'm making a plugin in the showthread hook and i'm looking for a condition (read title)
Or an array of who post in the thread i can make something like this
if (in _array ($bbuserinfo['username'],$array)) {
Do something
}

kh99
07-23-2012, 03:58 PM
If you're using hook showthread_complete, you could do something like make another plugin using hook showthread_postbit_create and code like:

if ($vbulletin->userinfo['userid'] == $post['userid'])
{
$user_posted = true;
}


then just use if ($user_posted) { ...

Scanu
07-23-2012, 04:12 PM
It works great thank you kh99 you are the best

--------------- Added 1343064496 at 1343064496 ---------------

Just a last question: in the other thread you gave me the array $ids that contains all the postid that you see, how can i remove my postid from that array?

For example in thread 1 there are 5 post. The firs post is your, the $ids array contains these post ids: 1, 2, 3, 4, 5. The post id 1 is the one of your post. How do i remove it?

kh99
07-23-2012, 04:47 PM
Are you asking how to remove a value from an array, or are you asking how to keep your posts from displaying?

Scanu
07-23-2012, 04:56 PM
How to remove your posts form the array $ids (that you gave me in the other thread)

kh99
07-23-2012, 05:09 PM
Oh, I see - well, you could modify the above plugin code like this:

if ($vbulletin->userinfo['userid'] == $post['userid'])
{
$user_posted = true;
$user_postids[] = $post['postid'];
}


then do something like $ids = array_diff($ids, $user_postids).

Scanu
07-23-2012, 05:44 PM
Awesome thank you