Fork me on GitHub

Allow unregistered users to change theme?  Bottom

  • Hi,

    I would like to give unregistered users the option to change themes without being logged in. So it doesn't need to be stored in a cookie or anything, next time they visit my site, they see the default theme again. Registered users can set their theme under My Account as usual, but they can of course also change a theme for just that session. I would like this to be done through a side block, that lists the themes.

    I have seen a block that let's registered users change their theme through a sideblock, but I want to make this available for unregistered users as well.

    I have been looking around for this, but maybe anyone of you can guide me in the right direction how to do this. Or is there a block available?

    THIA
    Gurt
  • Hi,

    Linking them to index.php?theme=<themename> would be a possibility, so they can preview a theme without having to register or login or whatever. You could easily set that up in a HTML sideblock or something.

    I believe there is also a block for this ... try searching blocks.postnuke.com. I don't know if it's on there, but I've definately seen someone write and release such a block somewhere.</themename>
  • I'll have a look at that! Thanks for the reply.

    Cheers,
    Gurt
  • Quote

    I believe there is also a block for this ... try searching blocks.postnuke.com. I don't know if it's on there, but I've definately seen someone write and release such a block somewhere.


    Don't there there is, but you can use the "Generic Menu" block and use index.php?theme=<themename> as the menu selections. I am setting it up on my site now.</themename>
  • I would like to do this as well, basically giving low bandwidth users the option for a text only site. However the way you have suggested will only hold for the page they are on? So if they visit other pages the site reverts to the default theme?

    Cheers
  • Yes it will revert back to the default theme afterwards. The block I have is on the right side, but you can place it on the left side so people can see how things look with different modules and the like.
  • I dont believe it would be possible to change themes for unregistered users (permenantly) without a substantal code hack. There is no block or module that I know of that does this.

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • Quote

    Quote:
    I believe there is also a block for this ... try searching blocks.postnuke.com. I don't know if it's on there, but I've definately seen someone write and release such a block somewhere.


    Don't there there is, but you can use the "Generic Menu" block and use index.php?theme=<themename> as the menu selections. I am setting it up on my site now. </themename>


    could someone post on how to do this? cause that would really help
  • Quote

    could someone post on how to do this? cause that would really help


    If you want to have it where it is a change for each user - they will have to be a member. The way to do this is to go to Administration -> Settings -> Check YES with 'Allow users to override theme?'

    If you are talking about setting up a Menu Block to allow people to temporary change the theme to see how a theme looks without making it fixed. Here is how it is done:

    Administration -> Blocks -> New Block -> Core/Generic Menu
    Also select which side block to use: Left or Right
    Click 'Commit Changes'

    Then in Title place the name of the theme
    In URL place 'index.php?theme=xpZone-camo' (change theme= to what the name of the theme is)
    In Description, you don't have to put anything.
    Click Commit Changes. Then move the block up or down as needed.
    Repeat till you have all the themes you want listed
  • is there anyone for the selected theme to stay through out all the pages

    like i select "blueish theme" out from the block, but it will only appear for the front page
  • Achieving this is technically feasble but I don't currently have time to write the necessary code but maybe I if post a rough howto then somebody could pick it up. This also needs a modifcation to a core API function.

    The key here is that even unregistered users have a session in the DB. What we can do is make a theme 'stick' for an unregistered user for the duration of thier session (note if you use high security then is only for the duration the browser is open).

    Steps to implement would be

    1. Modify the theme selection block (as posted earlier) to set a session variable when the theme is changed (e.g. pnSessionSetVar('mytheme', $themename))

    2. Modify the pnUserGetTheme API (in includes/pnUser.php) and added code the check for the existence of the previous set session variable and return the approapriate value.

    -Mark

This list is based on users active over the last 60 minutes.