How Can I Hide Info Center From MEMBERS?

Started by robbinsnike, November 23, 2009, 06:51:16 PM

Previous topic - Next topic

robbinsnike

I tried the Hide Info Center package but it only hid the info center for guests. How can I hide the info center completely from guests AND registered members?

I don't want anyone (besides me) to be able to access or see the info center.

How can I do this?

Thanks!

Arantor

What version of SMF and what theme?

It's different depending on what you're using.
Holder of controversial views, all of which my own.


robbinsnike

Thanks for the reply, sorry about that.

The version I am using is 1.1.10 and the theme is SMF Default Theme Core. I haven't tried any other themes yet.

Thanks.

Arantor

Who would it be visible to? Guests? Admins? Anyone?
Holder of controversial views, all of which my own.


Chair

It normally is visible by everyone, but my guess is robbinsnike wants it viewed by Admins only.

Arantor

Probably, but I need him to clarify since it changes how I write the code.
Holder of controversial views, all of which my own.


Matthew K.

If you want it to be visible to only Admins, wrap the following context around the info center.

if ($context['user']['is_logged'] && ['user']['group_id'] == 1){ INFO CENTER }
That should be the proper context, not had to use something like that for quite a while now.

Labradoodle-360

Arantor

if($context['user']['is_admin']) would be better.
Holder of controversial views, all of which my own.


Matthew K.

Arantor - haha, very true. Got used to adding if global mod, etc. forgot about the context is_admin.

That's the better way to go definitely.

Arantor

Don't forget that checking group_id is only good for their primary group.
Holder of controversial views, all of which my own.



robbinsnike

Yes, I would want it to be visible only to me/admin, no other users or guests.

Thanks everyone, this seems like a great community!

robbinsnike

Sorry, I am really new at this...

What file do I put this in and where exactly in the file do I put it? "if($context['user']['is_admin'])"

And is that all I need to put?

Thanks!

Arantor

No, I was being slightly flippant, expanding upon what Labradoodle had put.

Themes/default/BoardIndex.template.php
Code (find) Select
// Here's where the "Info Center" starts...

Code (before that, add) Select
if($context['user']['is_admin']) {

Just need to make sure that { is ended though, so also...

Code (find) Select
echo '
</table>
</div>
</div>';
}


Code (replace) Select
echo '
</table>
</div>
</div>';
}
}
Holder of controversial views, all of which my own.


robbinsnike


Arantor

Good to know! Please consider using the Mark Topic Solved link to flag this topic is all done :)
Holder of controversial views, all of which my own.


JasonDD

Hi, I've tried to change the code as described above, BUT in the default theme and there it doesn't work. What should I change to make this work on the default theme as well ?

Thanks !!

Matthew K.


Matthew K.



Advertisement: