1
biomech
Start Page by Group?
  • 2011/1/2 2:16

  • biomech

  • Not too shy to talk

  • Posts: 161

  • Since: 2002/2/25


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 -

2
Mamba
Re: Start Page by Group?
  • 2011/1/2 4:54

  • Mamba

  • Moderator

  • Posts: 11394

  • Since: 2004/4/23


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.11 | Docs | Modules | Bugs

3
anderssk
Re: Start Page by Group?
  • 2011/1/2 11:16

  • anderssk

  • Quite a regular

  • Posts: 335

  • Since: 2006/3/21


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

4
biomech
Re: Start Page by Group?
  • 2011/1/3 2:35

  • biomech

  • Not too shy to talk

  • Posts: 161

  • Since: 2002/2/25


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-

5
Mamba
Re: Start Page by Group?
  • 2011/1/3 4:55

  • Mamba

  • Moderator

  • Posts: 11394

  • Since: 2004/4/23


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 
"

_MODULENOEXIST "

"
;
        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.11 | Docs | Modules | Bugs

6
Mazarin
Re: Start Page by Group?
  • 2011/1/3 9:33

  • Mazarin

  • Just can't stay away

  • Posts: 533

  • Since: 2008/12/10



7
Mamba
Re: Start Page by Group?
  • 2011/1/3 9:37

  • Mamba

  • Moderator

  • Posts: 11394

  • Since: 2004/4/23


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

8
biomech
Re: Start Page by Group?
  • 2011/1/3 10:29

  • biomech

  • Not too shy to talk

  • Posts: 161

  • Since: 2002/2/25


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...

9
Mazarin
Re: Start Page by Group?
  • 2011/1/3 14:14

  • Mazarin

  • Just can't stay away

  • Posts: 533

  • Since: 2008/12/10


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!

10
biomech
Re: Start Page by Group?
  • 2011/1/3 15:12

  • biomech

  • Not too shy to talk

  • Posts: 161

  • Since: 2002/2/25


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

Cheers,

-b-

Login

Who's Online

164 user(s) are online (106 user(s) are browsing Support Forums)


Members: 0


Guests: 164


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