xoops forums

biomech

Not too shy to talk
Posted on: 2011/1/2 2:16
biomech
biomech (Show more)
Not too shy to talk
Posts: 161
Since: 2002/2/25
#1

Start Page by Group?

Hi all,

I've decided to make my forums accessible only to registered users, so I'd like to set a different start page for Anonymous users so that when they log in, instead of just getting the message "You don't have permission to access this area" (my general start page is set to forums, so Anonymous users will see this warning if I take away their access to the forums module) - instead of that, they see the FAQ, News, or Articles, for example.

Does anyone know how to do this?

Thanks in advance,

- b -

Mamba

Moderator
Posted on: 2011/1/2 4:54
Mamba
Mamba (Show more)
Moderator
Posts: 10988
Since: 2004/4/23
#2

Re: Start Page by Group?

You could probably make this code in index.php conditional:

$_SERVER['REQUEST_URI'] = substr(XOOPS_URLstrlen($url)) . '/modules/' $xoopsConfig['startpage'] . '/index.php';
    include 
$GLOBALS['xoops']->path('modules/' $xoopsConfig['startpage'] . '/index.php');


that would be valid only for Registered users, and if not, then go to another predefined module.

Just a wild guess....
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

anderssk

Quite a regular
Posted on: 2011/1/2 11:16
anderssk
anderssk (Show more)
Quite a regular
Posts: 335
Since: 2006/3/21
#3

Re: Start Page by Group?

Quote:

Anonymous users so that when they log in

What do You mean by that? They don't login.

Just use the permissions and don't allow the Anonymous to use the forum. Make shure, that the no forum-blocks, is vissible for Anonymous users

biomech

Not too shy to talk
Posted on: 2011/1/3 2:35
biomech
biomech (Show more)
Not too shy to talk
Posts: 161
Since: 2002/2/25
#4

Re: Start Page by Group?

Sorry, for Anonymous users, I didn't mean log on, I meant when they view the site.

What I've done is gone into User Groups and unchecked access to Forums. Then I checked in the Forums module permissions to be sure that Anonymous doesn't have access.

Now when I log out and access the site as an Anonymous user, I'm taken straight to the login page and am shown the message "Sorry, you don't have permission to access this area." This is I think because the Forums module is set to be the first module the site displays - I guess I just have to change that... but then it would be nice to have the Forums page automatically load when a registered user logs in...

- b-

Mamba

Moderator
Posted on: 2011/1/3 4:55
Mamba
Mamba (Show more)
Moderator
Posts: 10988
Since: 2004/4/23
#5

Re: Start Page by Group?

I did quick & dirty check to redirect Anonymous to a different module. In index.php I've added after line 33 $mymodule variable which directs to use "extgallery" module for Anonymous. Replace it with whatever you want and see if it works for you.

global $xoopsModuleConfig;
    
$module_handler =& xoops_gethandler('module');
//-------------------------

    
if (!isset($user_id)) {
        global 
$xoopsUser;
        if (empty(
$xoopsUser)) {
            
$xoopsModule =& $module_handler->getByDirname("extgallery");
            
$mymodule "extgallery";
        } else {
            
$xoopsModule =& $module_handler->getByDirname($xoopsConfig['startpage']);
            
$mymodule $xoopsConfig['startpage'];
        }
    }

    if (!
$xoopsModule || !$xoopsModule->getVar('isactive')) {
        include_once 
$GLOBALS['xoops']->path('header.php');
        echo 
"<h4>" _MODULENOEXIST "</h4>";
        include_once 
$GLOBALS['xoops']->path('footer.php');
        exit();
    }
    
$moduleperm_handler =& xoops_gethandler('groupperm');
    if (
$xoopsUser) {
        if (!
$moduleperm_handler->checkRight('module_read'$xoopsModule->getVar('mid'), $xoopsUser->getGroups())) {
            
redirect_header(XOOPS_URL1_NOPERMfalse);
            exit();

        }
        
$xoopsUserIsAdmin $xoopsUser->isAdmin($xoopsModule->getVar('mid'));
    } else {
        if (!
$moduleperm_handler->checkRight('module_read'$xoopsModule->getVar('mid'), XOOPS_GROUP_ANONYMOUS)) {
            
redirect_header(XOOPS_URL "/user.php"1_NOPERM);
            exit();
        }
    }
    if (
$xoopsModule->getVar('hasconfig') == || $xoopsModule->getVar('hascomments') == || $xoopsModule->getVar('hasnotification') == 1) {
        
$xoopsModuleConfig $config_handler->getConfigsByCat(0$xoopsModule->getVar('mid'));
    }

    
chdir('modules/' $mymodule '/');
//---------------------
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

Mazarin

Just can't stay away
Posted on: 2011/1/3 9:33
Mazarin
Mazarin (Show more)
Just can't stay away
Posts: 533
Since: 2008/12/10
#6

Re: Start Page by Group?

Just use the Startup module.

https://xoops.org/modules/repository/s ... file.php?cid=101&lid=1906

Mamba

Moderator
Posted on: 2011/1/3 9:37
Mamba
Mamba (Show more)
Moderator
Posts: 10988
Since: 2004/4/23
#7

Re: Start Page by Group?

Thanks Mazarin. Totally forgot about it
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

biomech

Not too shy to talk
Posted on: 2011/1/3 10:29
biomech
biomech (Show more)
Not too shy to talk
Posts: 161
Since: 2002/2/25
#8

Re: Start Page by Group?

Perfect Mazarin - thanks!

-EDIT-
I installed the module and set Anonymous group to start with the FAQ module and all other groups to start with Forum module. Now when I access the site, I'm shown the FAQ page (correct), but when I then log in, I'm not taken to the Forum page as I'd like...

Mazarin

Just can't stay away
Posted on: 2011/1/3 14:14
Mazarin
Mazarin (Show more)
Just can't stay away
Posts: 533
Since: 2008/12/10
#9

Re: Start Page by Group?

Did you follow the instructions in INSTALL.txt?

Install Instructions
1. Upload the startup directory to XOOPS_ROOT_URL/modules/

2. Log in to your site as administrator.

3. Install the module using the XOOPS module administration panel at 'System Admin -> Modules'.

4. In the Module administration page, hide the TS-MyStartup module (column Order, value = 0)

5. Go in the TS-MyStartup administration page and setup the startup pages for your groups.

6. Open the XOOPS_URL/include/checklogin.php and insert the following line at line #111 in XOOPS 2.4.x:
$url = XOOPS_URL.'/index.php'; // TS-MYSTARTUP HACK

=============================
Lines of code should look like this:
START
=============================
// RMV-NOTIFY
// Perform some maintenance of notification records
$notification_handler =& xoops_gethandler('notification');
$notification_handler->doLoginMaintenance($user->getVar('uid'));

$url = XOOPS_URL.'/index.php'; // TS-MYSTARTUP HACK
redirect_header($url, 1, sprintf(_US_LOGGINGU, $user->getVar('uname')));
=============================
END
=============================

7. Set TS-MyStartup to be the default module in the Xoops System->General Settings

8. You're all done!

biomech

Not too shy to talk
Posted on: 2011/1/3 15:12
biomech
biomech (Show more)
Not too shy to talk
Posts: 161
Since: 2002/2/25
#10

Re: Start Page by Group?

Thanks Mazarin - I had omitted part of one of the lines in the code hack of checklogin.php. Working now!

Cheers,

-b-