Fork me on GitHub

switch blocks if user is loged in/out -- help  Bottom

  • I have custom block for the login box and it's with fixed size
    when the user is loged in the block appears like big blank blue space
    Is there any way to check if the user is logged in and if so, to display another custom block in the same place.
    so if I have login in area 1 and rss in area 3 - I want after the login to display area 3 in the same place
    please help
    If the question is not clear enough I'll try to explain again :?
  • you can do this with permission.
  • hmm can you elaborate a bit on this ?
  • Did you custom write the block or is it an HTML block?

    --
    Home Page | Find on Facebook | Follow on Twitter
  • not sure what you're asking here
    I just added custom block in Xanthia and placed the tag it generated in the master.htm template
    and in the admin panes I set the core ligin to appear in this block
    the same for the second one
  • Permissions are the way to go if you want to prohibit someone from doing something or limit what they can do. Sometimes, this is not the issue. In those cases, setting up permissions and making sure you don't break any pre-existing schemes is a lot more work than you need. In this case, it seems more of a design issue and I think ShadyCat has the right idea.

    I'd create a Xanthia plugin to check if the user is logged in and show the appropriate block. I dunno if this is exactly right, and I can't look it up right now, but you'll write something like

    Code

    if (!pnUserLoggedIn())
        $output = pnBlockShow($moduleA, $blocknameA,$parametersA);
    else
        $output = pnBlockShow($moduleB, $blocknameB,$parametersB);
    return $output;


    Where $module is the module's name or "core" or blank. $blockname is the block's name (dah!). $parameters is/are the parameter(s) that must be passed to the block.

    I think you have to deactivate the blocks, not delete them, or they will show up twice.

    Good luck.

    Slugger
  • 10x Slugger :) are you sure this will work?
    I'm nubbie to xanthia and to tostnuke too so I'll ask some stupid questions here
    looks like I have to read some docs, but could you give me basic guidelines
    As I understand I have to create a xanthia plugin, but have no idea how to do it, where to place it and is there need to activate it somewhere in the control panel?
    is this all the code /I see it's a sample code here/ that I have to use or write some more to make a complete plugin?
  • I need to know more about your blocks. Rather than go back and forth, why don't you give me all the info and we'll see what we can do.

    Look in your blocks admin panel. What does it say in the columns next to the two blocks you want to swap? What are the block id numbers for each? (To get, click edit and look at the URL in your browser. The value for bid is your block id number) Which do you want to show before/after someone logs in?

    Slugger
  • well
    the first block is the core login, bid=13
    it's placed in position Area 1
    the block position tag generated in xanthia theme engine is
    and of cource this block doesn't show up when the user is logged in

    I want to place in the blank space the second block

    the second block is rss news, bid=33
    it's rss display module and will be placed in area 4
    still didn't make the configuration for this area, it could be anything
    for now this block is in the center area

    is that the info you need?
  • any thoughts on this?
  • 0 users

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