Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Goto page: 1 - 2 [+1]

Bottom
Diff themes per group?
  • Posted: 20.11.2004, 21:58
     
    Not_Public
    rank:
    Helper Helper
    registered:
     December 1969
    Status:
    offline
    last visit:
    28.02.06
    Posts:
    159
    is it possible with .750?

    how?
  • Posted: 21.11.2004, 14:16
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    28.11.08
    Posts:
    13417
    It isnt possible without a code change....

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 21.11.2004, 18:02
     
    Vizionsofyourdemise
    rank:
    Freshman Freshman
    registered:
     October 2002
    Status:
    offline
    last visit:
    07.10.05
    Posts:
    45
    thats a interesting idea :)
  • Posted: 21.11.2004, 18:30
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    28.11.08
    Posts:
    13417
    you could create a 'dummy' theme that changed the theme parameter based on the users group....

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 01.12.2004, 20:30
     
    Not_Public
    rank:
    Helper Helper
    registered:
     December 1969
    Status:
    offline
    last visit:
    28.02.06
    Posts:
    159
    would this ability to chage the theme parameter be a "classic" theme function or a xanthia?
  • Posted: 01.12.2004, 23:49
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    28.11.08
    Posts:
    13417
    It doesnt matter - I would use a switch conditional, and for each case set $theme to a different value. It could be an Xanthia or AutoTheme or Classic theme

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 02.12.2004, 00:09
     
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    ..could just write an API function and add it to the header.. just a thought ;)

    --
    http://www.invalidresponse.com
  • Posted: 02.12.2004, 06:41
     
    Not_Public
    rank:
    Helper Helper
    registered:
     December 1969
    Status:
    offline
    last visit:
    28.02.06
    Posts:
    159
    for some of us.. tweaking a theme doesn't sound as daunting as "just writing up an API function" .

    although, if you want to point me towards some reading materials on the topic.. I'd be glad to give that a stab too.. :)
  • Posted: 03.12.2004, 03:31
     
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    ..crap. I had a big post written, hit submit and my session timed out and I lost it :(

    basically, if you're willing to do it yourself, you might want to check http://php.net and http://www.w3schools.com .. or pitch a couple of bucks in the direction of a coder and have it done for you..

    good luck! ..sounds like a cool feature.

    -IR

    --
    http://www.invalidresponse.com
  • Posted: 03.12.2004, 10:58
     
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    ..special sale on core hacks today:

    add this to pnAPI.php

    Code

    function pnChangeThemeByGroup($uid)
    {

        $dbconn =& pnDBGetConn(true);
        $pntable =& pnDBGetTables();
       
        if(pnConfigGetVar('theme_change') == 1){
        return; //if they're not allowed to change themes..stop.
        }

        $memtable = $pntable['group_membership'];
        $memcolumn = &$pntable['group_membership_column'];
        $grptable = $pntable['groups'];
        $grpcolumn = &$pntable['groups_column'];

        $query = "SELECT $grpcolumn[name] FROM $grptable, $memtable
                  WHERE $grpcolumn[gid]=$memcolumn[gid]
                  AND $memcolumn[uid]='"
    .pnVarPrepForStore($uid)."'";
                 
        $result =& $dbconn->Execute($query);
       if (($dbconn->ErrorNo() != 0) OR $result->EOF) {
            return;
        }  
        list($groupname) = $result->fields;

        $result->Close();
           
        if($groupname == 'Admins'){
        $newtheme = 'AdminTheme'; // must be active available themes
        } else if($groupname = 'Users'){
           $newtheme = 'UsersTheme';
           }
       
        if(pnUserGetTheme() != $newtheme){
        $usrtable = $pntable['users'];
        $usrcolumn = &$pntable['users_column'];
        $sql = "UPDATE $usrtable SET $usrcolumn[theme]='".pnVarPrepForStore($newtheme)."'";
        $result =& $dbconn->Execute($sql);
        }

    return;
    }


    now in your header.php find & add:

    Code

    function head() {
    pnChangeThemeByGroup(pnUserGetVar('uid')); // there's no output..
    .
    .
    .
    .
    .


    ..change the theme names before adding this function to ones that exist in your theme directory.. you have to enable users to be able to change themes in Admin->Settings ..doesn't matter though, they'll never be able to change it if this function is in place ;)

    PS: don't blame me if something goes wrong.. ;)

    --
    http://www.invalidresponse.com
  • Posted: 03.12.2004, 18:00
     
    Not_Public
    rank:
    Helper Helper
    registered:
     December 1969
    Status:
    offline
    last visit:
    28.02.06
    Posts:
    159
    AWESOME!
    you rock!
    on
    and
    on
    and
    on
    ....

    quick modification clarification:
    am I correct in thinking I can change this

    Code

    if($groupname == 'Admins'){
       $newtheme = 'AdminTheme'; // must be active available themes
       } else if($groupname = 'Users'){
           $newtheme = 'UsersTheme';
           }

    to
    this

    Code

    if($groupname == 'Admins'){
       $newtheme = 'AdminTheme'; // must be active available themes
       } else if($groupname = 'Users'){
           $newtheme = 'UsersTheme';
       }else if($groupname = 'group1'){
           $newtheme = 'extralight';
       }else if($groupname = 'group2'){
           $newtheme = 'extraheavy';
       }

    and
    on
    and
    on
    and
    on
    and
    on???
  • Posted: 03.12.2004, 18:04
     
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    yeah. add as many groups and themes as you like, just as you did it.. ;)

    enjoy!
    devin

    --
    http://www.invalidresponse.com
  • Posted: 03.12.2004, 18:38
     
    Not_Public
    rank:
    Helper Helper
    registered:
     December 1969
    Status:
    offline
    last visit:
    28.02.06
    Posts:
    159
    please ignore this post

    Quote


    ok, so I jinxed it..
    while nothing broke (no, I wouldn' have blamed you )
    nothing happened either..

    I'll keep playing with it.. thanks for the great launching point!
  • Posted: 03.12.2004, 18:52
     
    InvalidResponse
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    21.10.07
    Posts:
    2423
    it takes a refresh after the first page load.. if you needed to debug it, echo that function in the header.php and change the return; in the actual function to return info like: return 'problem is here'; ..etc. I tested it quite a bit, but it was late and it's not quite as pretty as it could have been ;)

    make sure you have that admin setting enabled where users can change their themes too.. post your solution when you find it for any onlookers too.. thanks :D

    --
    http://www.invalidresponse.com
  • Posted: 03.12.2004, 19:02
     
    Not_Public
    rank:
    Helper Helper
    registered:
     December 1969
    Status:
    offline
    last visit:
    28.02.06
    Posts:
    159
    (I've left this post for others to laugh at my struggles, but the current situation is posted below)

    Quote



    damn! I jinxed the jinx
    ok so somethng did happen!!
    I've just got to back track and figure out what's going on..

    ok I've got

    Code

    if($groupname == 'Admins'){
       $newtheme = 'Aqua3'; // must be active available themes
       } else if($groupname = 'Users'){
           $newtheme = 'K_web_os';
       }else if($groupname = 'test'){
           $newtheme = 'ExtraLight';
       }


    the quirks:

    • [*:08b06d19a0]a user belonging to multiple groups.. that was a bugger.. but easily fixed by reassigning who bleongs to what
    • [*:08b06d19a0]I temporarily had a dummy user who had individual admin permissions to everything, but belonged to the "test" group-it used the "User"group theme on login, when viewing the news page, butwhen I clicked on admininstration, it shifted to "Admins" group theme. never once using the "test" group theme. and clicking back on "home" (news) it went back to the user theme
    • [*:08b06d19a0] now my test user for group "test" looks like its using the "ExtraLight" theme while it displays the "hang on- logging you in!" test.. but then goes directly to the Aqua3 theme (admins group theme) but of course, it shows nothing but the header. typing in site/user.php dreictly accesses that page in the user group theme so I can log out.. but if i use user.php to set the theme to the K-web_os which is assigned to group User for my user in group User.. again, I just get the header.


    confusion..

    I was supposed to enter

    Code

    pnChangeThemeByGroup(pnUserGetVar('uid'));

    below the existing

    Code

    $header = 1;

    function head() {

    right?
    or was that supposed be a whole new function?


    and looking at it... should they all be the double equals.. like this?

    Code

    if($groupname == 'Admins'){
       $newtheme = 'Aqua3'; // must be active available themes
       } else if($groupname == 'Users'){
           $newtheme = 'K_web_os';
       } else if($groupname == 'test'){
           $newtheme = 'ExtraLight';
       }


    with the tweak above, for some reason, only the Admin functions. that user/group only loads its theme once you click away from the news page.. but the initial news theme is k_web_os.
    turns out the majority of my issues were permissions related. pleas ehitme in the head with a hammer

Goto page: 1 - 2 [+1]

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula