![]() |
Editing posbit_legacy. Problem with variables.
Hi,
I'm trying to edit postbit_legacy. I want to add a "Test" word above the avatar of certains groups in the postbit_legacy template. I tried to do: Code:
<vb:if condition="$post['usergroupid'] == '6'">Test</vb:if> Then, it works but only for users that belong to the group "6". Other users doesn't see the Test word: How could I fix it? Thanks in advance. |
That's surprising, because I would think that $post has the info for the poster so the "viewing" user's group shouldn't have anything to do with it. But anyway, try this:
Code:
<vb:if condition="is_member_of($post, 6)">Test</vb:if> |
Didn't work. It doesn't display the word test for everyone:
http://seduccioncientifica.com/foro/...=4933#post4933 I can see it, only. The other users can't. |
Well, what happens if (just as a test) you do this:
Code:
<vb:if condition="1">Test</vb:if> |
That is what I want to do, but the variable doesn't seem to be $post or... I don't know.
I think it works like this: Code:
<vb:if reader=member_of_group_6 and poster=member_of_group6>Test</vb:if> |
OK. Sorry, there was a mistake in my post above. What I meant was, let's try an experiment: if you put this in your template:
Code:
<vb:if condition="1">Test</vb:if> |
It shows "Test" above each avatar.
|
Oh, OK, sorry - I guess I just misunderstood your answer. So that works like you want, with everyone able to see it.
Anyway, it doesn't make any sense to me - as far as I know, $post just has the info for the poster. |
But I want to display "Test" above the avatars only for certain groups. I mean:
Code:
If usergroup = group_6 then |
What about..
Code:
<vb:if condition="is_member_of($bbuserinfo, 6)">Test</vb:if> |
Quote:
When you say you want Test "above the avatar of certains groups" you mean the group of the poster (owner of the avatar), right? |
This doesn't work unless I'm logged in. This code doesn't display not "Test1" nor "Test2" If I'm a guest or a regular user.
Code:
<vb:if condition="$post['field5']"> Test1<vb:if condition="is_member_of($post,6)">Test2</vb:if></vb:if> https://vborg.vbsupport.ru/external/2011/08/114.png --------------- Added [DATE]1312396804[/DATE] at [TIME]1312396804[/TIME] --------------- Quote:
|
I realize this doesn't help a lot, but just for the record, I put this in my postbit_legacy:
Code:
<vb:if condition="is_member_of($post, 6)"> ...and I have a thread with two posts, one by an admin and one by a regular user. "Test" appears in the postbit of the admin's post and not in the other user's post, no matter who is viewing (admin, regular user, or guest). So it should be working for you. Maybe try disabling plugins as a test to see if a plugin is affecting things. |
Quote:
Code:
<vb:if condition="$post['field5']"> I can't understand it, condition="$post['field5'] shouldn't be too problematic. Thanks a lot. |
I changed it to this:
Code:
<vb:if condition="$post['field4']"> field4 is "Occupation". I set the occupation to "1" for the admin account and blank for the regular user account. So now I see "Test" in the admin post and nothing in the user post, as expected. What do you see when you just insert {vb:raw post.field5} in the template? |
I see a id number. It is harmless.
:confused: |
But do you see the id number, logged in or not?
Oh, I have an idea - are you viewing with the same style whether or not you're logged in? If the other users are using a different style they could be using a different postbit_legacy template. (Edit - but then I guess the condition="1" test wouldn't have worked). |
It seems the same template, I think is the default one. However, perhaps they are using postbit instead of postbit_legacy.
I'm going to check it right now. --------------- Added [DATE]1312401513[/DATE] at [TIME]1312401513[/TIME] --------------- No, they are using the same template everytime. In fact, I'm using a simple text in the template and is it displayed everytime. --------------- Added [DATE]1312483712[/DATE] at [TIME]1312483712[/TIME] --------------- This is my postbit_legacy: Code:
|
Up!
|
I put that in my style, and I took out the $post['field5'] if so that line is
HTML Code:
<vb:if condition="is_member_of($post,6)">Test2</vb:if>Test3 and I see Test2Test3 under the admin avatar, and Test3 under the regular user, no matter if I'm logged in as admin, or not logged in at all. I'm not sure what else to tell you - try disabling all plugins if you haven't done that already. Or try uploading the vb files again. Edit: if you just put {vb:raw post.usergroupid} in the template, do you see what you expect (probably 6 or 2) no matter who is logged in? Should be the same for each post no matter who you're loggedin as, of course. |
Quote:
I disabled all the plugins withous success. Anyway, I asked vBulletin.com and they said they couldn't help me because "it is a modification". Maybe I should stop trying it? Thanks for all kh99, you helped me a lot. :up::up::up: |
Well, if it isn't working there's something wrong. If you can see the correct user group id, then
HTML Code:
<vb:if condition="$post['usergroupid'] == 6"> should be working for you. We determined that condition="1" works, so we're pretty much down to the point where there's nothing left except PHP not working right! (Well, OK, not quite - you could look at the compiled template and see what PHP is being evaluated). |
Sorry, but what do you mean by compiled template? Do you mean the postbit_legacy or the .php file?
|
I mean the PHP code that is eval()'d when the template is rendered. At some point it will be in $vbulletin->templatecache['postbit_legacy'] and you could display it or write it to a file.
|
Solved it, at last. The problem is that field5 was a private field. That is why I saw it but other members didn't.
|
All times are GMT. The time now is 03:29 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|