MyBB Community Forums

Full Version: Part of a message only visible for registered members
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hello,
Here I would like to create tutorials on my forum, and some part is only visible to registered members.
I tried to go through with myCodes as replacement
<if !in_array($mybb->usergroup['gid'], array('1')) then>$1</if>
but unfortunately the first dollar blocks the rest of the code ..

Is there any other solution?
Thank you for your active support Exclamation
you can try using SCD Hide From Groups plugin
No this is not what I want ..
In fact I wrote my tutorial and such a bonus game is only visible to registered members and visitors have a message like "This part of the discussion is restricted to registered members" ..
(2013-09-02, 05:42 PM)Traxmix Wrote: [ -> ]Hello,
Here I would like to create tutorials on my forum, and some part is only visible to registered members.
I tried to go through with myCodes as replacement
<if !in_array($mybb->usergroup['gid'], array('1')) then>$1</if>
but unfortunately the first dollar blocks the rest of the code ..

Is there any other solution?
Thank you for your active support Exclamation

are <if>....</if> statements allowed in mycode ? if so have you defined $1 ?
(2013-09-02, 05:59 PM)JimR Wrote: [ -> ]are <if>....</if> statements allowed in mycode ? if so have you defined $1 ?

Let me explain:
In "Regular Expression" I put:
\[private\](.*?)\[/private\]

In "Replacement" I put:
<if !in_array($mybb->usergroup['gid'], array('1')) then>$1</if> 

Then when I type in my message MyCode it makes me:
Quote:usergroup['gid'], array('1')) then> 123

(2013-09-02, 05:51 PM).m. Wrote: [ -> ]you can try using SCD Hide From Groups plugin

No it is not his .. :/
^ with that plugin, the content with private tag can be visible to regular members only (example settings)
and there is another useful plugin YourCode - it replaces MyCode and more powerful & versatile
(2013-09-02, 06:06 PM)Traxmix Wrote: [ -> ]
(2013-09-02, 05:59 PM)JimR Wrote: [ -> ]are <if>....</if> statements allowed in mycode ? if so have you defined $1 ?

Let me explain:
In "Regular Expression" I put:
\[private\](.*?)\[/private\]

In "Replacement" I put:
<if !in_array($mybb->usergroup['gid'], array('1')) then>$1</if> 

Then when I type in my message MyCode it makes me:
Quote:usergroup['gid'], array('1')) then> 123

(2013-09-02, 05:51 PM).m. Wrote: [ -> ]you can try using SCD Hide From Groups plugin

No it is not his .. :/

I still am not sure if mycode can handle <if> statements my guess is not so you will need a plugin to parse the message or, just a thought allow html in messages ..... which may allow the parser to allow the php code to run
I did not really understand, the only thing I do is seen as a text (between two tags, for example) is only visible to registered members.
After I plugins "In Php Templates" & "Template Conditionals."

Go through a plugin or code whatever ..
(2013-09-02, 06:36 PM)Traxmix Wrote: [ -> ]I did not really understand, the only thing I do is seen as a text (between two tags, for example) is only visible to registered members.
After I plugins "In Php Templates" & "Template Conditionals."

Go through a plugin or code whatever ..

ok I see but $1 appears to be the wrong definiton
Pages: 1 2 3