Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 12 Aug 2012, 07:32
Infinity101 Infinity101 is offline
 
Join Date: Feb 2006
Comparing Friend UserID

Hello, I am in the process of writing a script which highlights buddy posts. I'm having trouble however passing a condition to only highlight the buddies and not everyone.

I have tried several conditionals, all either ending in showing no posts, or all posts. Below are variations of code I have used.

In myphp file:

When pulling information (used from misc.php):

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

When Comparing

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Pulling in separate instance (the above would be removed):

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and in template:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I have tried several other variations similar to the above. I have ran a loops to make sure I was gathering the buddy userid which was successful. The problem seems to be when comparing with a poster's userid.

I hope my post makes sense, it's very late night for me and at this point I feel like my mind is going bonkers. Than you kindly for any help.

Last edited by Infinity101; 12 Aug 2012 at 07:46.
Reply With Quote
  #2  
Old 12 Aug 2012, 14:53
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
You don't need array() in the conditional, it should be:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


But that will only work if you register $postbuddies to the template. A way around that would be to add it to an array that is already registered, like:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


then

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


I should also mention that rendered posts are cached, so that may also give you trouble. With the post caching, you can't really have the background change based on something that is specific to the user viewing the post.
Reply With Quote
  #3  
Old 12 Aug 2012, 17:55
Infinity101 Infinity101 is offline
 
Join Date: Feb 2006
Hi kh99, thank you for your response. This is not the first time you have helped me and I'm very thankful.

If I do not include the array() in the conditional, I receive a malformed conditional error when compiling.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If I do this (below) I receive the same error even when including array().

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

In the PHP I have:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Thank you again for taking the time in teaching me.

Last edited by Infinity101; 12 Aug 2012 at 18:00.
Reply With Quote
  #4  
Old 12 Aug 2012, 18:06
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Sorry, one thing I didn't notice - you should be using in_array(), not is_array().

Which hook is your plugin using, and which template is your conditional in?
Reply With Quote
  #5  
Old 13 Aug 2012, 03:46
Infinity101 Infinity101 is offline
 
Join Date: Feb 2006
Hi, I'm using misc_buddylist_start for the hook. I'm using a module from vbadvanced cmps, more or less similar to the "News" module if you're familiar with it.

Thanks!
Reply With Quote
  #6  
Old 27 Aug 2012, 06:13
Infinity101 Infinity101 is offline
 
Join Date: Feb 2006
I continue to have difficulty with this. Any input? Thanks!
Reply With Quote
  #7  
Old 27 Aug 2012, 12:29
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
One very important thing I missed the first time around - you can't directly use the return value of query_read_slave(), it won't be an array. If you're only expecting one row from your query, you should call query_read_first(), which will return an array representing the first row returned from the query.
Reply With Quote
  #8  
Old 27 Aug 2012, 17:12
Infinity101 Infinity101 is offline
 
Join Date: Feb 2006
Excellent, thank you kh99. I'm going to try this out.

--------------- Added 27 Aug 2012 at 20:26 ---------------

Thank you kh99, I have had more success. I wanted to verify whether or not I was pulling the information correctly through the php hook. I used print_r to see the array. When using query_first(); unfortunately their was no return. When using query_ready() was able to return the array however.


Array ( [0] => 111 ) Array ( [0] => 2379 ) Array ( [0] => 103 ) Array ( [0] => 28 ) Array ( [0] => 6 ) Array ( [0] => 49 ) Array ( [0] => 192 ) Array ( [0] => 2399 )


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.



When comparing in the template however, I receive this error:



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Do you think this is a problem with the template reading the variable? Or should I use a different method in comparing the values?

Thanks for your continued support.
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
vBFOAF - Friend of a Friend exporter for vBulletin 3 Cloud-Warrior vBulletin 3.0 Full Releases 9 29 Nov 2007 15:13
vBFOAF - Friend of a Friend RDF metadata exporter for vBulletin 3.5 Cloud-Warrior vBulletin 3.5 Add-ons 7 29 Nov 2007 15:12



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 23:19.

Layout Options | Width: Wide Color: