Disable Preferences Menu in Ampache 3.3.2.1

A friend of mine (you know who you are :D) asked me about how to disable preferences menu in Ampache 3.3.2.1.I thought this should be easy, there should be a config that we can turn off or turn on to set this item. Unfortunately, my thought was wrong. There is no configuration for that.

Then I download Ampache tarball and look through it. I am very eager to solve this problem, because it will also refresh my rusty PHP programming skills. At the first round, I couldn’t find where Ampache store the preferences menu. The programming style is quiet hard to understand, may be that’s because I have never done PHP programming anymore for years.:D

Next, I use “grep” to search for “preferences” words in the whole Ampache package :

grep -r “preferences.php” *

I check the results one by one. One result turn my light on :
templates/sidebar.inc.php.

I open up that file (sidebar.inc.php) and read the code. And it is the correct one.

My first plan was to disable the whole references to “preferences.php” and it was very easy to do.

But later I thought, wouldn’t it be better if I only disable “preferences” for ordinary users.

So then I create this simple patch.

To apply this patch, put the patch on the ampache/templates directory. Here is the setting in
my system (in ampache/templates directory) :


$ ll sidebar.*
-rw-r–r– 1 tedi users 1010 2007-01-15 23:14 sidebar.inc.patch
-rw-r–r– 1 tedi users 8800 2007-01-15 23:11 sidebar.inc.php
..

Then type the following command (make sure you are in the templates):

$ patch -p0 patching file sidebar.inc.php

Here are some screenshots after I apply the patch. I login as “user” and “admin”. You should see the differences. :D

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s