vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Condition "if you have posted in this thread (https://vborg.vbsupport.ru/showthread.php?t=285876)

Scanu 07-23-2012 02:41 PM

Condition "if you have posted in this thread
 
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
PHP Code:

if (in _array ($bbuserinfo['username'],$array)) {
Do 
something



kh99 07-23-2012 02: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:

Code:

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


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

Scanu 07-23-2012 03:12 PM

It works great thank you kh99 you are the best

--------------- Added [DATE]1343064496[/DATE] at [TIME]1343064496[/TIME] ---------------

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 03: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 03:56 PM

How to remove your posts form the array $ids (that you gave me in the other thread)

kh99 07-23-2012 04:09 PM

Oh, I see - well, you could modify the above plugin code like this:

Code:

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 04:44 PM

Awesome thank you


All times are GMT. The time now is 06:04 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.01967 seconds
  • Memory Usage 1,717KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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