Hi guys,
i'm looking for a solution to an issue.
i'm using joomla 1.5.23 with phocaguestbook 1.4.2 and i need to show form only for admin and super-admin. control panel only allows to see the form for all registered user (in other words, everyone except guest/anonymous).
i really don't know where put my hands!
best regards
[SOLVED] - Show form ONLY for admin and super-admin
-
- Phoca Newbie
- Posts: 3
- Joined: 02 Oct 2011, 22:45
[SOLVED] - Show form ONLY for admin and super-admin
Last edited by zorta on 05 Oct 2011, 14:01, edited 1 time in total.
-
- Phoca Enthusiast
- Posts: 50
- Joined: 15 Feb 2011, 23:05
Re: Show form ONLY for admin and super-admin
Any particular reason to use 1.4.2 instead of 1.4.4.? You will have to change the code a bit to achieve what you want. The changes should be small, do you have any php/coding skills and the possibility to create a test/development-server to try it out? I will give you a hand if so...
-
- Phoca Newbie
- Posts: 3
- Joined: 02 Oct 2011, 22:45
Re: Show form ONLY for admin and super-admin
hi morl99,
thx for your reply.
why i'm using 1.4.2? i don't wanna update and encounter any risk of non-working module. as i ever say "when a thing is working, don't touch it!"
btw, i've a server for testing (local too), and i'm a specialized in php programming. but i dont' know where is the code of interest.
i'll appreciate your help and i'm really thank you.
tell me what to do!
thx for your reply.
why i'm using 1.4.2? i don't wanna update and encounter any risk of non-working module. as i ever say "when a thing is working, don't touch it!"
btw, i've a server for testing (local too), and i'm a specialized in php programming. but i dont' know where is the code of interest.
i'll appreciate your help and i'm really thank you.
tell me what to do!
-
- Phoca Enthusiast
- Posts: 50
- Joined: 15 Feb 2011, 23:05
Re: Show form ONLY for admin and super-admin
I am not suggesting to perform a major update of joomla, just catch up with the latest stable for your joomla release, which is the 1.4.4. A reason for not doing this, is if you already have a different hack in place... But updating will be harder after we are finished with this hack...
If you are an experienced php programmer, you will probably have an easy time changing this.
The form display is controlled here: views/phocaguestbook/tmpl/default.php at about line 217 there is a
you could check if the user is admin or sa (see here for reference)
Jan already uses a check for admin (or maybe only superadmin, I am not sure right now, I know I hacked this once...) at line 198
That var should be > 0 if the user is an admin.
Hope this was helpful, if you run into trouble, feel free to describe your problems here.
edit:
I checked it, and I was right, it is super admin and admin, in the view.html.php it is written:
If you are an experienced php programmer, you will probably have an easy time changing this.
The form display is controlled here: views/phocaguestbook/tmpl/default.php at about line 217 there is a
Code: Select all
if ($this->tmpl['show_form'] == 1) {
Jan already uses a check for admin (or maybe only superadmin, I am not sure right now, I know I hacked this once...) at line 198
Code: Select all
if ($this->tmpl['administrator'] != 0)
Hope this was helpful, if you run into trouble, feel free to describe your problems here.
edit:
I checked it, and I was right, it is super admin and admin, in the view.html.php it is written:
Code: Select all
$tmpl['administrator'] = 0;
if (strtolower($user->usertype) == strtolower('super administrator') ||
strtolower($user->usertype) == strtolower('administrator')) {
$tmpl['administrator'] = 1;
}
-
- Phoca Newbie
- Posts: 3
- Joined: 02 Oct 2011, 22:45
Re: Show form ONLY for admin and super-admin
works fine!!!!!
thank you mate, your advice has been invaluable!
this is the fix i've made:
[joomla! 1.5.23 - phoca guestbook 1.4.2]
file: components/com_phocaguestbook/views/phocaguestbook/tmpl/default.php at line 210 about:
before
display form for everyone (except guest)
after
display form ONLY for admin and super-admin (var $this->tmpl['administrator'] is 1 when admin or s-admin)
i'll change discussion's title in SOLVED!
thank you again!

thank you mate, your advice has been invaluable!
this is the fix i've made:
[joomla! 1.5.23 - phoca guestbook 1.4.2]
file: components/com_phocaguestbook/views/phocaguestbook/tmpl/default.php at line 210 about:
before
Code: Select all
if ($this->tmpl['show_form'] == 1)
after
Code: Select all
if ($this->tmpl['show_form'] == 1 && $this->tmpl['administrator'] > 0)
i'll change discussion's title in SOLVED!
thank you again!
-
- Phoca Enthusiast
- Posts: 50
- Joined: 15 Feb 2011, 23:05
Re: [SOLVED] - Show form ONLY for admin and super-admin
I am glad that this fix worked for you 
You are welcome!

You are welcome!