While building new plugins I'd like to be able to only make them available to specific users for testing. This would allow me to mess around with code on the live blog but not have everyone see it until it's ready.
If this is documented somewhere please point me to it. Otherwise, how might I do this?
Thanks,
Clint
Displaying plugins only for specific users?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Displaying plugins only for specific users?
Hi!
With "see it" do you mean on the frontend, or in the backend configuration? Both should be possible, but with different means. One involves something like the event_sidebarhider plugin for frontend, and for backend, you can configure "forbidden plugins" for each serendipity user group.
HTH,
Garvin
With "see it" do you mean on the frontend, or in the backend configuration? Both should be possible, but with different means. One involves something like the event_sidebarhider plugin for frontend, and for backend, you can configure "forbidden plugins" for each serendipity user group.
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Displaying plugins only for specific users?
Sorry, I wasn't clear. I'm referring to sidebar plugins. I hacked serendipity_plugin_templatedropdown.php template chooser plugin to check if the user is admin so that I can try out different templates:
I wonder if there is a more eloquent solution?
Thanks,
Clint
Code: Select all
function generate_content(&$title) {
global $serendipity;
#####################
#only show the form to admin
if($serendipity['user'] == 'admin') {
$title = $this->get_config('title', $this->title);
$url = serendipity_currentURL(true);
echo '<form id="theme_chooser" action="' . $url . '" method="post">';
echo '<select name="user_template" onchange="document.getElementById(\'theme_chooser\').submit();">';
foreach (serendipity_fetchTemplates() as $template) {
$templateInfo = serendipity_fetchTemplateInfo($template);
echo '<option value="' . $template . '" ' . (serendipity_get_config_var('template', 'default') == $template ? 'selected="selected"' : '') . '>' . substr($templateInfo['name'], 0, 25) . '</option
}
echo '</select>';
if ($this->get_config('show_submit', 'false') == 'true') {
echo '<input type="submit" name="submit" value="' . GO . '" size="4" />';
}
echo '</form>';
}
}
Thanks,
Clint
-
Don Chambers
- Regular
- Posts: 3657
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: Displaying plugins only for specific users?
Go here: http://spartacus.s9y.org/index.php?mode ... s_event_en or use spartacus to fetch the event plugin labeled "Toggle Sidebar state (collapsed/uncollapsed)" which is serendipity_event_sidebarhider. I think it has a configuration option to only allow specified user levels to see whatever plugins you wish.
=Don=