1
Xterm03
Limit access to archived news
  • 2004/1/2 4:57

  • Xterm03

  • Just popping in

  • Posts: 3

  • Since: 2003/12/31


Is there a way to limit access of archived news to registered users only? I want to allow anonymous users access to the news article by clicking on the News link on the Main Menu. However, the Submit News and Archive links should only be accessible to registered users.

2
JackJ
Re: Limit access to archived news
  • 2004/1/2 5:48

  • JackJ

  • Community Support Member

  • Posts: 747

  • Since: 2003/8/31


Yes in xoops_version.php in the news folder look for this code
// Menu
$modversion['hasMain'] = 1;
$modversion['sub'][1]['name'] = _MI_NEWS_SMNAME1;
$modversion['sub'][1]['url'] = "submit.php";
$modversion['sub'][2]['name'] = _MI_NEWS_SMNAME2;
$modversion['sub'][2]['url'] = "archive.php";

And change it to something like this

// Menu
$modversion['hasMain'] = 1;
global $xoopsUser;
if(!empty($xoopsUser)) {
$group = $xoopsUser->getGroups();
if (in_array(2, $group)) {
$modversion['sub'][1]['name'] = _MI_NEWS_SMNAME1;
$modversion['sub'][1]['url'] = "submit.php";
$modversion['sub'][2]['name'] = _MI_NEWS_SMNAME2;
$modversion['sub'][2]['url'] = "archive.php";
}
}

I got some of this from other posts, cant rememember where

the line :

if (in_array(2, $group)) {

refers to group "2" which is registered users

3
Mithrandir
Re: Limit access to archived news

In the future version of the News module (can't say when it'll come out, gotta wait for the core changes to go through first in order to avoid double-work) you'll (hopefully) be able to specify the user groups with access to posting news and possibly also archived news (although the latter will probably be just another "Visible to anonymous/registered only" toggle) and the menu item will only show up for users with access rights.

Watch this space and until then, use this hack

Login

Who's Online

376 user(s) are online (252 user(s) are browsing Support Forums)


Members: 0


Guests: 376


more...

Donat-O-Meter

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

Latest GitHub Commits