xoops forums

nmshah

Just can't stay away
Posted on: 2008/2/25 16:50
nmshah
nmshah (Show more)
Just can't stay away
Posts: 556
Since: 2007/7/2 4
#1

Different homepage for different groups

I think there was a module which upon login redirected different groups to different pages. I m not sure of the module name.

tried myhome module but the redirection are either not working or i m making some mistake.

using XOOPS 2.0.18.1
php 5.2.3

on searching the forum i found this thread
http://www.xoops.org/modules/newbb/vi ... id=259113#forumpost259113

myhome module i have tried and the other module i can not find as the dev site is still not working.

What shall i be doing? please help.

christian

Just can't stay away
Posted on: 2008/2/25 18:46
christian
christian (Show more)
Just can't stay away
Posts: 401
Since: 2002/2/24
#2

Re: Different homepage for different groups

Hi,

Look in our modules repository. The two versions for the startup modules are added today. (version 0.2 for XOOPS 2.2.x and version 0.3 for XOOPS 2.0.x)

Mazarin

Just can't stay away
Posted on: 2009/9/11 17:04
Mazarin
Mazarin (Show more)
Just can't stay away
Posts: 533
Since: 2008/12/10
#3

Re: Different homepage for different groups

Since Startup 0.2 and 0.3 are not working for the current version of Xoops, do we have any other module that can do this?

ghia

Community Support Member
Posted on: 2009/9/12 3:29
ghia
ghia (Show more)
Community Support Member
Posts: 4946
Since: 2008/7/3 1
#4

Re: Different homepage for different groups

You can play with different custom blocks that show or hide for the different user groups and maybe with defacer change the looks.
You can also check with smarty which user group is active and do theme changements with it, with this hack:
Modify /class/template.php and add:
global $xoopsUser;
    if ( 
is_object($xoopsUser) ) {
        
$this->assign'xoops_usergroups'$xoopsUser->getGroups() );
    }

after:
$this->Smarty();

In your templates do something like:
<{if 1|in_array:$xoops_usergroups}>Show for group 1<{/if}>
<{if 
2|in_array:$xoops_usergroups}>Show for group 2<{/if}>


Could maybe a good addition to the core if interest by other people.

Mazarin

Just can't stay away
Posted on: 2009/9/12 6:37
Mazarin
Mazarin (Show more)
Just can't stay away
Posts: 533
Since: 2008/12/10
#5

Re: Different homepage for different groups


The Startup module seemed to do exactly what I was after. Maybe it's fairly easy to update to 2.3.x compatibility. Which do you think is best suited for upgrading, Startup for 2.0.x or Startup for 2.2.x?

ghia

Community Support Member
Posted on: 2009/9/12 10:36
ghia
ghia (Show more)
Community Support Member
Posts: 4946
Since: 2008/7/3 1
#6

Re: Different homepage for different groups

In principle 2.0.x
Where did you download it?

tzvook

Just can't stay away
Posted on: 2009/9/12 11:27
tzvook
tzvook (Show more)
Just can't stay away
Posts: 854
Since: 2003/2/1 1
#7

Re: Different homepage for different groups

I'm interested too, if one have the module files I'd love to take a look ....

Mazarin

Just can't stay away
Posted on: 2009/9/12 11:52
Mazarin
Mazarin (Show more)
Just can't stay away
Posts: 533
Since: 2008/12/10
#8

Re: Different homepage for different groups

Actually, I realized I can get by with a redirect after login for now (just a simple modification to include/checklogin.php), so I'm happy to hand this task over to tzvook

I downloaded both modules from the repository here.

ptomter

Just popping in
Posted on: 2010/7/8 8:55
ptomter
ptomter (Show more)
Just popping in
Posts: 49
Since: 2009/3/31
#9

Re: Different homepage for different groups

I have this code and I want a two customs link for a special group.



<div id="tools"><img src="<{$xoops_url}>/images/tlf_NBF.gif" alt="" width="227" height="31" />
<ul>
<li class="none"><{$smarty.const._TOG}></li>
<{php}> if (is_object($GLOBALS['xoopsUser'])) { <{/php}>
<li><a href="<{xoAppUrl /}>modules/profile/user.php"><{$smarty.const._MP}></a></li>
<li><a href="<{xoAppUrl /}>modules/profile/user.php?op=logout"><{$smarty.const._LU}></a></li>
<{php}> } else { <{/php}>
<li><a href="<{xoAppUrl /}>modules/profile/user.php"><{$smarty.const._B2}></a></li>
<{php}> } <{/php}>
<li>
</ul>

Where should I place the following line? Could I just paste it in in front of <{php}> tag or does this line need tags like that also?

<{if 10|in_array:$xoops_usergroups}>Show for group 1<{/if}>

Burning

Theme Designer
Posted on: 2010/7/8 10:33
Burning
Burning (Show more)
Theme Designer
Posts: 1163
Since: 2006/8/22
#10

Re: Different homepage for different groups

hi'

Another solution if it can help you :

• 1 : open www/include/checklogin.php

• 2 : put this piece of code around the line 63
after :
setcookie($xoopsConfig['usercookie'], 0, -1'/'XOOPS_COOKIE_DOMAIN0);
        }
    }

add :
Quote:

// Redirection hack after login
if ( in_array(1, $_SESSION['xoopsUserGroups'] ) ) {
$_POST['xoops_redirect'] = "/modules/ilovesushi";
} elseif ( in_array(2, $_SESSION['xoopsUserGroups'] ) ) {
$_POST['xoops_redirect'] = "/modules/ipreferpizza";
}
// Redirection hack after login


• 3 : adapt the hack
green : id of the Group
red : module name
Still learning CSS and... english