Usergroup switch

MODien asennus ja omat muokkaukset.
Avatar
Raipe
MODaaja
MODaaja
Viestit:61
Liittynyt:14 Marras 2005, 18:09
Viesti:
Usergroup switch

Viesti Kirjoittaja Raipe » 14 Tammi 2008, 20:53

Osaiskohan joku täällä auttaa, kun en tahdo mistään saada vastausta ongelmaani.

Eli käytössäni on modi millä saan tiettyjä juttuja näkymään vain tietylle käyttäjäryhmälle.
Nyt olis tarvis saada toinen vastaava, että pystyisin kahta eri käyttäjäryhmää käyttämään samallasivulla.
^Ompas vaikeesti selitetty^ :D

Mitä tosta pitäis muuttaa että sais esmes <!-- BEGIN switch_user_display_html2 --> tehtyä?

Koodi: Valitse kaikki

##############################################################
## MOD Title: Usergroup Switches
## MOD Author: Lumpy Burgertushie < lumpy@phpbb-installer.com > (Robert Adams) http://phpbb-installer.com
## MOD Author: dicky <rfoote@telink.net > (Richard Foote) http://dicky.askmaggymae.com
## MOD Description: This MOD creates switches like the login logout switches,
## only for certain usergroups. It will allow you to show buttons, links, tables,
## etc , to only those in certain usergroups.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit:
##       includes/page_header.php     
## Included Files: N/A
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## you will need to find what the usergroup ID is before you do this. 
##you can look in the database for the group_id  in the phpbb_user_group table
##############################################################
## MOD History:
##
##   2006-01-05 - Version 1.0.0
##      - first release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#------[OPEN ]-----------
#
includes/page_header.php
#
#--------[ FIND ]------------
#
   $template->assign_block_vars('switch_user_logged_in', array());
#
#--------[ AFTER, ADD ]-----------------------
#
//Begin usergroup switches MOD
// Change these numbers to the ID's of the groups you want to allow access to
$display_html_group = array(1,2,3,4);
$display_html_allowed = false;

$sql = "SELECT group_id FROM " . USER_GROUP_TABLE . "
   WHERE user_id = " . $userdata['user_id'];
if(!($result = $db->sql_query($sql)))
   message_die(GENERAL_ERROR,'Could not select from usergroup table','',__LINE__,__FILE__,$sql);

while ($row = $db->sql_fetchrow($result))
{
   $dhag = $row['group_id'];
}

if (in_array($dhag, $display_html_group))
{
   $display_html_allowed = true;
}

if ( $display_html_allowed )
{
   $template->assign_block_vars('switch_user_display_html',array() );
}
//End usergroup switches MOD
#
#----------[ DIY INSTRUCTIONS ]---------------
#
Then in your overall_header.tpl and other tpl files, You can then surround whatever you want to display to only certain usergroups
with the switches;
<!-- BEGIN switch_user_display_html -->
... stuff that only shows up when the user is in usergroup(s)...
<!-- END switch_user_display_html -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

mrl586
Aktiivinen jäsen
Aktiivinen jäsen
Viestit:2879
Liittynyt:31 Maalis 2006, 17:59
Paikkakunta:Tampere
Viesti:

Re: Usergroup switch

Viesti Kirjoittaja mrl586 » 14 Tammi 2008, 21:57

Sanoisin, että muutettava kohta löytyy tästä

Koodi: Valitse kaikki

//Begin usergroup switches MOD
// Change these numbers to the ID's of the groups you want to allow access to
$display_html_group = array(1,2,3,4); 

Avatar
Raipe
MODaaja
MODaaja
Viestit:61
Liittynyt:14 Marras 2005, 18:09
Viesti:

Re: Usergroup switch

Viesti Kirjoittaja Raipe » 14 Tammi 2008, 22:11

Ei, vaan haluan siis kokonaan kaksi eri 'switchiä'

Siten että eka on esmes ryhmälle 1 ja toka ryhmälle 6.
Sit voisin tehdä yhden sivun missä molemmat ryhmät näkee eri jutut.

Avatar
Raipe
MODaaja
MODaaja
Viestit:61
Liittynyt:14 Marras 2005, 18:09
Viesti:

Re: Usergroup switch

Viesti Kirjoittaja Raipe » 22 Tammi 2008, 23:03

Eiks kellään oo mitää ideaa tähän, tarttis oikeesti saada toi toimimaan, ja oon kaikkia jo koittanu mitä oon keksiny... :(

Viestiketju Lukittu

Paikallaolijat

Käyttäjiä lukemassa tätä aluetta: Ei rekisteröityneitä käyttäjiä ja 53 vierailijaa