1
acegamer
News 1.44 - views webmaster group only
  • 2012/6/20 12:18

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Hi,

It's been a long time that i have bumbed on a issue in one of the xoops modules.
If you know the News 1.44 module, you know that visitors can view the hits on the frontpage. With a easy remove in the code they don't see it anymore.

But in the administration panel, admins that have the right to access it and post items it's still visible. Is it somehow possible to make this field only visible for some user groups only? So that a regular admin can post in the admin panel like normal, but just can't see the views/hits of the blogposts.

Only a user in a group can see it?

Is there someone that could help out with this. I would not hesitate to pay for this.

Kind regards,
Ace

2
irmtfan
Re: News 1.44 - views webmaster group only
  • 2012/6/23 5:54

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


I dont know a developer or a content module that have the ability to set group permissions for admin side for Content (here: news) module.
I just think you can remove it from admin side manually:

news/admin/index.php line 166:

<td align='center'>" . $eachstory -> counter() . "</td>

lines 435 and 436:
'%reads%',
and
$onestory->counter(),

line 572:
$content .= sprintf("\t<counter>%u</counter>\n",$onestory->counter());

maybe there are other lines.
warning: i dont test the above removes so please keep a backup from the index.php file.

3
acegamer
Re: News 1.44 - views webmaster group only
  • 2012/6/23 22:05

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Hi irmtfan,

Thanks for your feedback.
Yeah i also find that, but then i can't see it by my self how many views there are.
I only want that a certain group has the ability to view the views.

Would be great. Anyone here that maybe can help me with this?
Like i said, i want to pay for this.

4
irmtfan
Re: News 1.44 - views webmaster group only
  • 2012/6/24 6:54

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


your welcome.
I think you should do some customization by your own because this kinds of permissions would be very detail.
in general if a user is a module admin he/she can access to all details of that module (here: news)

I test some modification in my local site and i think you can do this by your own.
firstly i assume You want to allow all users have access to system module (like webmaster group) to see counters.
because if a user have access to system module he/she can do anything and see everything.
So you can add the below code wherever in news/admin/index.php to find if the current user is webmaster or not.
global $xoopsUser;
$groups is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
$gperm_handler =& xoops_gethandler('groupperm');

$isWebmaster $gperm_handler->checkRight('system_admin'XOOPS_SYSTEM_USER$groups);

Then you can use above variable for each counter like this:
for line 166:
$counters= $isWebmaster ? $eachstory -> counter() : 'No perm';

then use this:

<td align='center'>" . $counters . "</td>

im not a coder so maybe one developer can edit my codes or show you easier way but im sure the principles are correct.


5
acegamer
Re: News 1.44 - views webmaster group only
  • 2012/6/25 18:32

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Yeah i'm not a coder either so, thats why i want to pay for the work.

I want to give my Admins group rights to submit at once, without me checking the content first. But i don't want they see the views of their post only me and other members of thewebmaster group can see that.

6
irmtfan
Re: News 1.44 - views webmaster group only
  • 2012/6/26 8:39

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


I understood you and my codes should do what you needs.

You just needed to copy and paste the above mentioned codes in news/admin/index.php

i did it for you and you can download the edited index.php file in zip format here:
http://jadoogaran.org/test255_new/modules/news/admin/index.php.zip

just replace this index.php file with your current one.

ps: it is from news 1.54 but i think it should work for 1.44 too.

7
acegamer
Re: News 1.44 - views webmaster group only
  • 2012/7/9 22:03

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Hi i'm sorry for me delay! I'm on vaction at the moment don't have many access to the internet :/ lack wifi overhere.

I'm gonna test your code pretty soon, will let you know if it works! Many thanks already!

8
acegamer
Re: News 1.44 - views webmaster group only
  • 2012/7/29 18:05

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Hi irmtfan, i'm back from vacation and tried to figure out your code.
But were do i need to paste you code in the module/news/admin/index.php file?

Just at the beginning? Because on line 166 it's code for 'Shows last x published stories'


9
irmtfan
Re: News 1.44 - views webmaster group only
  • 2012/7/30 7:01

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Hi
long time no see from you!
I deleted that test website.
please download from here:
http://jadoogaran.org/test255/modules/news/admin/index.php.zip
just download and replace with your old news/admin/index.php



10
acegamer
Re: News 1.44 - views webmaster group only
  • 2012/8/2 13:14

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Hi irmtfan yeah i'm sorry about that.
I download the file, will try it when i'm home. (i'm at my work atm)

Login

Who's Online

159 user(s) are online (116 user(s) are browsing Support Forums)


Members: 0


Guests: 159


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits