vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   if statment for avatars? (https://vborg.vbsupport.ru/showthread.php?t=76437)

indie 02-16-2005 02:45 PM

if statment for avatars?
 
Can I use an "if" statement, if the membergroup is not allowed to have avatars or profile pics, but they already uploaded them before the change, so they are showing in the postbit and view profile page, to let them show "if" in a usergroup that allows them.... or have them not show "if" in a usergroup without the permission.... if so, would someone be so kind as to tell me how to do that?
Thanks!

Deaths 02-16-2005 02:54 PM

Go to ACP-> Styles & Templates -> Edit Templates ->postbit ot postbit_legacy.

Now, find the code for the avatars.
In the postbit template it's this:

PHP Code:

<if condition="$show['avatar']"><td class="alt1"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurlalt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td></if> 

Now, replace that with:
PHP Code:

<if condition="$bbuserinfo[usergroupid]=X">
&
nbsp;
<else />
<if 
condition="$show['avatar']"><td class="alt1"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurlalt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td></if></if> 

Make sure you replace the X with the usergroup you wish to not allow.

indie 02-16-2005 03:01 PM

Great thanks!!
Can you post what the replacement is for postbit_legacy, it looks different than that...
And also, if you could if possible, post the replacement I could use on the profile page for the avatr and profile pic?

Thanks!

Deaths 02-16-2005 03:07 PM

In the postbit_legacy template it's this:

PHP Code:

<if condition="$show['avatar']">
                <
div class="smallfont">
                    &
nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurlalt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
                </
div>
            </if> 

Replace with:

PHP Code:

<if condition="in_array($post[usergroupid], array(X,X,X))">
&
nbsp
<else /> 
<if 
condition="$show['avatar']">
                <
div class="smallfont">
                    &
nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$avatarurlalt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
                </
div>
            </if></if> 

I'll look into the profile now, expect a reply in ~5 minutes.

Ok, mistake fixed.

Ok, edit template MEMBERINFO.

Find:
PHP Code:

<if condition="$show['profilepic']">
            <
td valign="top" align="$stylevar[right]rowspan="2">
                <
img src="image.php?u=$userinfo[userid]&amp;type=profile&amp;dateline=$userinfo[profilepicdateline]alt="<phrase 1="$userinfo[username]">$vbphrase[xs_picture]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]/>
            </
td>
            </if> 

Replace with:

PHP Code:

<if condition="in_array($userinfo[usergroupid], array(X,X,X))">
&
nbsp
<else />
<if 
condition="$show['profilepic']">
            <
td valign="top" align="$stylevar[right]rowspan="2">
                <
img src="image.php?u=$userinfo[userid]&amp;type=profile&amp;dateline=$userinfo[profilepicdateline]alt="<phrase 1="$userinfo[username]">$vbphrase[xs_picture]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]/>
            </
td>
            </if></if> 

Now, find
PHP Code:

<if condition="$show['avatar']">
                <
td><img src="$userinfo[avatarurl]alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none" /></td>
            <else />
                <
td>&nbsp;</td>
            </if> 

Replace with:

PHP Code:

<if condition="in_array($userinfo[usergroupid], array(X,X,X))">
&
nbsp
<else />
<if 
condition="$show['avatar']">
                <
td><img src="$userinfo[avatarurl]alt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none" /></td>
            <else />
                <
td>&nbsp;</td>
            </if> 

I haven't tried this, but it should work.

Please let me know if it did work, or didn't :)

indie 02-16-2005 03:22 PM

Wow, you are awesome...

I'm going to try this now... THANKS!

Deaths 02-16-2005 03:22 PM

No problemo :).

If it doesn't work, please tell me, and I will take a closer look at it.

indie 02-16-2005 03:23 PM

PS, can usergroup(s) be separated by comma? (I will add banned members too, if so)

Deaths 02-16-2005 03:31 PM

I have updated my post, now you can!
Just replace the X's with the usergroups you want, and if you wish you can add/remove more numbers!

Examples:
PHP Code:

<if condition="in_array($userinfo[usergroupid], array(4,5,6))"

PHP Code:

<if condition="in_array($userinfo[usergroupid], array(1,2))"

PHP Code:

<if condition="in_array($userinfo[usergroupid], array(1))"

PHP Code:

<if condition="in_array($userinfo[usergroupid], array(1,2,3,4))"


indie 02-16-2005 03:41 PM

I tried what you gave me (original legacy postbit), and everyone's disappeared.

Deaths 02-16-2005 04:02 PM

Are you sure you added only the banned usergroup?

And the very first code is wrong, it will only display it to banned members.
Very wrong, heh.

Use the code from this post (ie my other post)


All times are GMT. The time now is 03:03 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.01767 seconds
  • Memory Usage 1,794KB
  • 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
  • (12)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete