MyBB Community Forums

Full Version: Disable Signatures for Guests (IF statement inside templates)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hello,

I'm trying to remove the guests access to signatures in MyBB 1.6 but this piece of code didn't worked Huh

<hr size="1" width="25%"  align="left" />
<if $GLOBALS['mybb']->user['usergroup'] == 1 then>
You should register in order to see signatures
<else>
{$post['signature']}
</if>

That code is replacing the postbit_signature in the postbit templates, have tried also in the postbit_classic (wich is the one that I'm using) without sucess.
Is that ok?

Thanks.
Template conditionals aren't default, you'll need the PHP in Templates plugin.
Pretty nice one Smile

Thanks.
sorry for necroposting
but i did this
and iget this error


Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /global.php(359) : eval()'d code on line 2
What code you've entered there Glas ?
(2011-09-02, 03:40 PM)Glas Wrote: [ -> ]sorry for necroposting
but i did this
and iget this error


Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /global.php(359) : eval()'d code on line 2

you have to download the plugin.
Try this:
<if $mybb->usergroup['gid'] == 1 then>
guest see this content
<else>
{$post['signature']}
</if>

Using Template Conditionals, I suppose it will work using PHP In Templates, which is more advanced.
It should be like this Sama;
<if $mybb->user['usergroup'] == "1" then>
// Guests can see this thingy
<else>
{$post['signature']}
</if>

Note the $mybb->user['usergroup']
(2011-09-02, 03:47 PM)Everett777 Wrote: [ -> ]
(2011-09-02, 03:40 PM)Glas Wrote: [ -> ]sorry for necroposting
but i did this
and iget this error


Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /global.php(359) : eval()'d code on line 2

you have to download the plugin.

i did and even installed


anyway
i've answered myself

this is the fix:

<if $mybb->user['usergroup'] == 1 then>
blah
</if>

(2011-09-02, 03:58 PM)Yaldaram Wrote: [ -> ]It should be like this Sama;
<if $mybb->user['usergroup'] == "1" then>
// Guests can see this thingy
<else>
{$post['signature']}
</if>

Note the $mybb->user['usergroup']

yaldaram, the error is not anymore

but after login the form is still there

website: http://www.beatdj.net/foros/index.php

<if $mybb->user['usergroup'] == "1" then>
<form action='member.php' method='post'>
<font color="FFFFFF">Usuario: </font><input type='text' name='username' size='9' maxlength='30' />
<text="FFFFFF">ContraseƱa: </text> <input type='password' name='password' size='9' />
<input type='hidden' name='action' value='do_login'>
<input type='hidden' name='url' value='index.php' />
<input type='submit' class='submit' name='submit' value='Conectar' /></form>
<else>
lol prueba // test
</if>

Logged: http://img402.imageshack.us/img402/2121/loggd.png
unlogged: http://img853.imageshack.us/img853/584/unloggd.png
Pages: 1 2 3