1 john_vyhnanek Feb 09, 2006 21:30
3 edb Feb 10, 2006 20:46
What version are you running? I don't do any hackage with 1.6, but if it's .9.1 it's an easy hack to give non-admins the general tab but no others.
4 john_vyhnanek Feb 11, 2006 00:01
Thanks for your replys. I know about the edit tab and what that does and doesn't limit.
EdB, I'd really like to know more about an easy hack! My version is 0.9.0.12, can it be done with this version?
Rgs,
JJV
5 edb Feb 11, 2006 03:48
Take a look at admin/b2blogs.php and see if you have something like this around line 329:
<div class="panelblocktabs">
<ul class="tabs">
<?php
if( $tab == 'general' )
echo '<li class="current">';
else
echo '<li>';
echo '<a href="b2blogs.php?blog='.$blog.'&action=edit">'. T_('General'). '</a></li>';
if( $tab == 'perm' )
echo '<li class="current">';
else
echo '<li>';
echo '<a href="b2blogs.php?blog='.$blog.'&action=edit&tab=perm">'. T_('Permissions'). '</a></li>';
if( $tab == 'advanced' )
echo '<li class="current">';
else
echo '<li>';
echo '<a href="b2blogs.php?blog='.$blog.'&action=edit&tab=advanced">'. T_('Advanced'). '</a></li>';
?>
</ul>
</div>
That's the bit that makes each subtab, so you want to hide the other subtabs from visitors who aren't you. Try something like this with the 'permissions' and 'advanced' tabs:
if( $current_User->get( 'ID' ) == 1 ) {
if( $tab == 'perm' )
echo '<li class="current">';
else
echo '<li>';
echo '<a href="b2blogs.php?blog='.$blog.'&action=edit&tab=perm">'. T_('Permissions'). '</a></li>';
if( $tab == 'advanced' )
echo '<li class="current">';
else
echo '<li>';
echo '<a href="b2blogs.php?blog='.$blog.'&action=edit&tab=advanced">'. T_('Advanced'). '</a></li>';
}
Note the addition of two lines - an "if the current blogger is ID #1" line and a closing curly bracket line. If all goes well that will mean only the official admin will see those two tabs.
BTW this (a) is untested and (b) probably won't stop a malicious blogger from typing the appropriate stuff into their address bar and changing some params they're not supposed to change.
6 john_vyhnanek Feb 11, 2006 14:59
EdB,
You are a genius! The line number was around 650 in my file. I did what you said and voila, it's exactly what I wanted to do! I'd like to send you a Good Cooking T-shirt for your help so email me directly w/ your mailing info!
Many thanks,
JJV
7 ferrix Apr 09, 2007 15:45
I just wanted to point out more clearly (as EdB alluded) that hiding the tab isn't going to help you from a security perspective.
Myself, I want to prevent anyone from changing the media root of a blog, but generally am OK with the other settings in the Blog Settings tab. My solution was to modify ./inc/MODEL/collections/_blog.class.php
Just a one line change to make it ignore the value posted from the form, and instead always set itself to the string "default".
My small change doesn't address the needs of someone like OP.. the best solution for that would be a finer grained permissions model for this important section!
Edit Blog needs to be checked. That will give them access to all of the Blogs subtabs, including permissions and advanced. I don't know an easy way around that. It would probably involve a little bit of hacking to core files, which is never recommended. But it is possible.