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!
What version of SMF and what theme?
It's different depending on what you're using.
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.
Who would it be visible to? Guests? Admins? Anyone?
It normally is visible by everyone, but my guess is robbinsnike wants it viewed by Admins only.
Probably, but I need him to clarify since it changes how I write the code.
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
if($context['user']['is_admin']) would be better.
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.
Don't forget that checking group_id is only good for their primary group.
Correct ;)
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!
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!
No, I was being slightly flippant, expanding upon what Labradoodle had put.
Themes/default/BoardIndex.template.php
// Here's where the "Info Center" starts...
if($context['user']['is_admin']) {
Just need to make sure that { is ended though, so also...
echo '
</table>
</div>
</div>';
}
echo '
</table>
</div>
</div>';
}
}
Thanks very much, worked perfect!
Good to know! Please consider using the Mark Topic Solved link to flag this topic is all done :)
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 !!
Same code should work.
Are you running 1.1.11?
Running 2.0 RC2
That would be why. Hold on please
./Themes/default/Boardindex.template.php
Find:
// Here's where the "Info Center" starts...
Add Before:
if($context['user']['is_admin']) {
Find:
echo '
</div>
</div></div>
Replace with:
echo '
</div>
</div></div>';
}
echo '
That should work for you.
Labradoodle-360
Sorry, left out the bottom. Ignore the second edit and do this edit in ./Themes/default/Boardindex.template.php as well as the first:
Find:
echo '
<span class="lowerframe"><span></span></span>';
Add After:
}
Works great! Thank you so much !! ;D
I've just noticed the bottom of the board is separated from the main part after applying the code, is it possible to fix this somehow?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg215.imageshack.us%2Fimg215%2F5084%2F55283981.png&hash=4d881cc619a0e134840e7fc937771f87d2e6c315)
Can you screenshot the whole page please?
Quote from: JasonDD on December 09, 2009, 02:55:45 PM
I've just noticed the bottom of the board is separated from the main part after applying the code, is it possible to fix this somehow?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg215.imageshack.us%2Fimg215%2F5084%2F55283981.png&hash=4d881cc619a0e134840e7fc937771f87d2e6c315)
Sure
http://img26.imageshack.us/img26/4882/62867031.png
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg26.imageshack.us%2Fimg26%2F4882%2F62867031.png&hash=517d2aca80c52e777f93f72ae5709b82164e6bc5)
I just tested the edits, again with SMF 2.0 RC2 and it works.
Just make sure you follow my second post for the second edit...here are the proper edits again:
./Themes/default/BoardIndex.template.php
Find: // Here's where the "Info Center" starts...
Add Before: if ($context['user']['is_admin']){
Find: // Info center collapse object.
Add Before }
Can I make a simpler suggestion to all that?
In 2.0's BoardIndex.template.php, the info_center is a separate template entirely. Drop the call to it and add a div with appropriate styling in its place.
I would think adding one line and one character to close the one line is more simple.
I'd put the if in front of the call to template_info_center then fix the layout issues is simpler, since your method won't always do it correctly, but hey, what do I know.
I just updated the edits for 2.0, following your edits from 1.1 earlier in this thread.
And the layout is often still broken as a result because the divs that handle the edge are not covered - as indicated earlier.
/me would point out he already published a mod somewhere in Coding Discussion to deal with this in 2.0 RC1.2 and didn't realise a 2.0 RC2 version for just this reason.
to Labradoodle-360
I followed your second post as well, unfortunately with no luck though. I even copied a fresh Boardindex file and edited it but that didn't solve it either :-\
Quote from: Arantor on December 09, 2009, 05:16:50 PM
I'd put the if in front of the call to template_info_center then fix the layout issues is simpler, since your method won't always do it correctly, but hey, what do I know.
Could you please tell me Arantor how to do that ?
Simply find:function template_info_center()
{
Add Before:if ($context['user']['is_admin']){
Find:}
?>
Add Before:}
Labradoodle-360
NO. That will BREAK your index.template.php file.
template_info_center();
if ($context['user']['is_admin'])
As for fixing up the template as mentioned earlier, haven't done that in a while, not sure off hand how to do it as I don't have a copy of RC2 handy to try it on.
What is the real difference? ???
Yours stops the function being declared meaning that when it is called in template_main, PHP throws an undefined function error for non admins. Mine stops it being called - but it's still declared.
Try both - as an admin and non admin user.
Thanks guys,
I tried one more option - what Labradoodle-360 suggested in the first post - without the edit in the second post. It actually worked so that the board is not separated, although I'm not sure if it displays correctly (There seems to be more white space between those frames). Take a look :
http://img46.imageshack.us/img46/9549/92416762.png
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg46.imageshack.us%2Fimg46%2F9549%2F92416762.png&hash=6fe0d90d5365a9705a90c2aafa004d43280350c8)
It isn't, exactly what I said in my next post. I left out the bottom slice spans. Take a look at the spans right below where you add } to.
Also, I'd definitely take into consideration what Arantor said about where I added the edits. I would follow his instructions.
I did what Arantor suggested, but is it possible to somehow fix the layout issue in RC2? Or I'll have to wait for the next release?
Definitely not the best way to go about it, but it works.
Find:template_info_center();
Add Before:if ($context['user']['is_admin'])
Find: echo '
<span class="lowerframe"><span></span></span>';
Replace with:
if ($context['user']['is_admin']){
echo '
<span class="lowerframe"><span></span></span>';
}
As for the second part of the edit I only found this piece of code
echo '
</div>
</div></div>
<span class="lowerframe"><span></span></span>';
So I replaced it with:
if ($context['user']['is_admin']){
echo '
</div>
</div></div>
<span class="lowerframe"><span></span></span>';
}
The layout issue is still there though
You shouldn't see any lower section if you're a guest or even member with that code.
This mod supported me to hide info center from guest and members
http://custom.simplemachines.org/mods/index.php?mod=1335
Or try "Info Center Permissions" which is supported on v2.0.x and works well.