Administrator not authorized to publish messages?

Phoca Guestbook - creating guestbooks in Joomla! CMS
leej22
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 22 Jun 2010, 19:18

Administrator not authorized to publish messages?

Post by leej22 » 22 Jun 2010, 19:35

Hello,

I modified Phoca Guestbook (v 1.4.1) as shown here: viewtopic.php?f=2&t=4033
so that posts could be published from front end (as well as unpublished/deleted) It looks great...however, when I log in front end with an administrator account I get message "You are not authorized to unpublish the item" or "You are not authorized to delete..etc"

However when I login with super administrator info (front end) I can publish/delete the posts. Course whole point here is to allow someone with only administrator access to handle publishing of posts in the guestbook. Any idea what I need to change? Not sure why administrator can't do this, I thought the codes from above thread allowed for administrator AND super administrator?

Thanks,

Emilee
Last edited by leej22 on 26 Jun 2010, 20:41, edited 1 time in total.

leej22
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 22 Jun 2010, 19:18

Re: Administrator not authorized to publish messages?

Post by leej22 » 22 Jun 2010, 23:28

I have realized the problem with this so here is fix, in case someone else runs into this again:

In this thread:
viewtopic.php?f=2&t=3864
Someone explains that the code....

Code: Select all

if (strtolower($user->usertype) == strtolower('super administrator') || $user->usertype == strtolower('administrator')) {
is wrong because the "$user->usertype" phrase is written incorrectly for administrator. Basically it has no strtolower() around it. It should say strtolower($user->usertype) == all thru (with the parentheses and strtolower in front).

These codes seem to missing all thru the guestbook, and its actually that way in the Documentation for Phoca Guestbook, under FAQs where they tell you how to make so other users can unpublish and delete the posts in the front end. I was wondering why that didn't work for me...it didn't even work for administrator let alone new users I was trying to add.

So in following places check for the if (strtolower($user->usertype) == etc. strings and modify...
components\com_phocaguestbook\views\phocaguestbook\view.html.php (SEE function display)
components\com_phocaguestbook\controllers\phocaguestbook.php (SEE function remove AND function unpublish)

Also here:
components\com_phocaguestbook\models\phocaguestbook.php (SEE function buildQuery AND function countItem)
But note the format there is different...its...

Code: Select all

    if ($user->usertype == "Super Administrator" || $user->usertype == "Administrator")
so just add the needed part like if you want to allow publishers to handle messages, it would be

Code: Select all

    if ($user->usertype == "Super Administrator" || $user->usertype == "Administrator" || $user->usertype == "Publisher")
And if you use this guide: viewtopic.php?f=2&t=4033
to allow users to also PUBLISH the messages from frontend... You have to change all those $user->usertype parts because they are incorrect in that guide also. :)

Emilee
Last edited by leej22 on 26 Jun 2010, 20:32, edited 1 time in total.

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 44092
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Administrator not authorized to publish messages?

Post by Jan » 24 Jun 2010, 11:37

Ok
If you find Phoca extensions useful, please support the project

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 44092
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Administrator not authorized to publish messages?

Post by Jan » 26 Jun 2010, 21:40

It was fixed to:
if (strtolower($user->usertype) == strtolower('super administrator') || strtolower($user->usertype) == strtolower('administrator')) {
Should work now.
If you find Phoca extensions useful, please support the project

Post Reply