Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 31 Aug 2010, 23:37
DamasGate DamasGate is offline
 
Join Date: Aug 2003
Need help with, if condition

Hello,

In the postbit template.

I need to show code at the end of every user post but only once per page of thread.

Its like "show an user's signature only once per page hack"



How to do that ?

Thank you

Last edited by DamasGate; 16 Mar 2021 at 15:26.
Reply With Quote
  #2  
Old 01 Sep 2010, 22:49
Guest190829
Guest
 
This is going to take a little more than a simple if conditional; you'll need to create some cache array that stores whether or not a specific user has displayed a signature already.
Reply With Quote
  #3  
Old 01 Sep 2010, 23:27
DamasGate DamasGate is offline
 
Join Date: Aug 2003
Oh, i do not know how to do that.

Any one can help with this ?

Thank you
Reply With Quote
  #4  
Old 02 Sep 2010, 03:23
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
Originally Posted by Danny.VBT View Post
This is going to take a little more than a simple if conditional; you'll need to create some cache array that stores whether or not a specific user has displayed a signature already.
You know thought this too but how does this mod do it?
http://www.vbulletin.org/forum/showthread.php?t=139689

It's just template conditionals and manages to show the sig only once per page???

I read the code but can't figure it out- it doesn't even look like it should work.
__________________
-Joe
Former vb.org Moderator. Retired.

@BirdOPrey5 | All Things BOP5 | Joe's Ultimate Off Topic
Note - I no longer making new VB mods, sorry.
Reply With Quote
  #5  
Old 02 Sep 2010, 14:34
DamasGate DamasGate is offline
 
Join Date: Aug 2003
Explanation:

I install a hack, "show user last 5 threads above his signature".

If user has more than post on the same thread, Show only one time his last 5 threads above his signature.

Like this:
<if condition=" THIS IS THE FIRST USER REPLY ON THE THREAD

show user last 5 threads above his signature

<if condition=" THIS IS THE The second, third, or fourth REPLY ON THE THREAD

DO NOT
show user last 5 threads above his signature



I hope that is Clare
Reply With Quote
  #6  
Old 02 Sep 2010, 14:49
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Good find by BirdOfPrey, I wouldn't have thought to do that but it works because an assignment has a value and can be put in a conditional, so you can create an array like Danny mentioned without needing a plugin.

Modifying the mod that BirdOfPrey found, I think something like this should work:


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


Last edited by kh99; 03 Sep 2010 at 00:44. Reason: added the "condition=" to the code
Reply With Quote
  #7  
Old 02 Sep 2010, 16:07
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
kh99 - could you walk be through the logic of this- I just don't get it

$post[userid] is just a number, right? so it's like

!$vboptions['shownlinks'][999] AND $vboptions['shownlinks'][999] = true

Maybe I'm not getting how $vboptions['shownlinks'] works?
__________________
-Joe
Former vb.org Moderator. Retired.

@BirdOPrey5 | All Things BOP5 | Joe's Ultimate Off Topic
Note - I no longer making new VB mods, sorry.
Reply With Quote
  #8  
Old 02 Sep 2010, 16:28
DamasGate DamasGate is offline
 
Join Date: Aug 2003
Originally Posted by kh99 View Post
Good find by BirdOfPrey, I wouldn't have thought to do that but it works because an assignment has a value and can be put in a conditional, so you can create an array like Danny mentioned without needing a plugin.

Modifying the mod that BirdOfPrey found, I think something like this should work:


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

WOW, Thats work greatttttttttttttttt

But only one thing now

If the user did not have any threads its show empty links box.

Is there any way to hide the box when user did not have any threads ?

Like this:
<if condition="USER DID NOT HAVE ANY THREADS"
DO NOT SHOW ANYTHING
</if>


I really very appreciate your patience and cooperation.
Many many many Thanks

Last edited by DamasGate; 02 Sep 2010 at 16:45.
Reply With Quote
  #9  
Old 03 Sep 2010, 00:18
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by DamasGate View Post
Is there any way to hide the box when user did not have any threads ?

Like this:
<if condition="USER DID NOT HAVE ANY THREADS"
DO NOT SHOW ANYTHING
</if>
What code are you using to show the links?
Reply With Quote
  #10  
Old 03 Sep 2010, 00:35
DamasGate DamasGate is offline
 
Join Date: Aug 2003
Helo,

I use this code


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

Thanks for help
Reply With Quote
  #11  
Old 03 Sep 2010, 00:37
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by BirdOPrey5 View Post
$post[userid] is just a number, right? so it's like

!$vboptions['shownlinks'][999] AND $vboptions['shownlinks'][999] = true

Maybe I'm not getting how $vboptions['shownlinks'] works?
'shownlinks' is just an arbitrary string, it could be anything as long as other code isn't trying to use the same variable. In fact you probably don't even need to use $vboptions. In any case, $vboptions['shownlinks'] is an array used to store whether or not a user's links have been shown. When the code starts generating the page, $vboptions['shownlinks'] doesn't exist so it works just like an array where every value is false, so the first time the code checks user 999 it will be false and !$vboptions['shownlinks'][999] will be true. The part after the AND assigns "true" to a user's slot in the array, and since an assignment has a value (the value being assigned), it will always be "true". So it doesn't affect the logic if the if statement, it just gets the assignment done.

Does that make any sense? I'm not so good with the explaining.

ETA: Oh, well...I just noticed that the above code was missing "condition=" because I messed up when editing. Maybe that's what was confusing.

--------------- Added 03 Sep 2010 at 00:42 ---------------

Originally Posted by DamasGate View Post
Helo,

I use this code
So you know where "$favo" comes from? I don't know what that is.

You could try surrounding the above with:


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


Last edited by kh99; 03 Sep 2010 at 01:41. Reason: Auto-Merged DoublePost
Reply With Quote
  #12  
Old 03 Sep 2010, 01:07
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
Originally Posted by kh99 View Post
'
Does that make any sense? I'm not so good with the explaining.

ETA: Oh, well...I just noticed that the above code was missing "condition=" because I messed up when editing. Maybe that's what was confusing.
I think I got it now, thanks!

You could try surrounding the above with:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
I think the last line is :"</if>" not "</endif>"
__________________
-Joe
Former vb.org Moderator. Retired.

@BirdOPrey5 | All Things BOP5 | Joe's Ultimate Off Topic
Note - I no longer making new VB mods, sorry.
Reply With Quote
  #13  
Old 03 Sep 2010, 01:41
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by BirdOPrey5 View Post
I think the last line is :"</if>" not "</endif>"
Heh...yeah, thanks.
Reply With Quote
  #14  
Old 03 Sep 2010, 12:17
DamasGate DamasGate is offline
 
Join Date: Aug 2003
Originally Posted by kh99 View Post

So you know where "$favo" comes from? I don't know what that is.

You could try surrounding the above with:


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

Its work very good.

You are great kh99, Thanks Million
Reply With Quote
Reply



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 18:11.

Layout Options | Width: Wide Color: