How to make portal visible only to certain group members?  Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
2 posters

    How to make portal visible only to certain group members?

    yayayes
    yayayes
    Forumember


    Female Posts : 49
    Reputation : 1
    Language : Thai
    Location : Bangkok, London & Hong Kong

    Solved How to make portal visible only to certain group members?

    Post by yayayes November 27th 2014, 1:15 pm

    Hi guys, I would like to know if it's possible to make the portal visible only to a certain group?

    My Forum: http://thelosteden.com/forum
    My Portal Page: http://thelosteden.com
    Forum Version: Invision

    Also, I have been wondering about my forum URL. After I added a portal to my forum, the domain name directs me straight to the portal instead of the forum itself. I know that at some point it wasn't like this. The portal page used to have something like '/portal' after the domain name and that the domain name would link to actual the forum. Can I change it back to this perhaps?

    Thank you, appreciate it!
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13246
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to make portal visible only to certain group members?

    Post by Ange Tuteur November 27th 2014, 2:58 pm

    Hello yayayes,

    You can choose where the forum redirects here :
    Administration Panel > Display > Generalities > Your forum redirects to

    The only thing I could come up with for allowing only certain people to view the portal would be this :
    Go to Administration Panel > Modules > JavaScript codes management > Create a new script

    Title : Your choice
    Placement : In the portal
    Paste the code below :
    Code:
    $(function() {
      var allowed = [1,2,3], redirect = '/forum';
      document.body.style.display = 'none';
      for (i=0; i<allowed.length; i++) {
        if (_userdata.user_id == allowed[i]) document.body.style.display = '';
        else if (i == allowed.length - 1) checkState();
      }
      function checkState() { if (/none/.test(document.body.style.display)) window.location.pathname = redirect };
    });

    There's two things you can edit :

    allowed : this is the list of users allowed to view the portal. You should use their user id which is visible by their profile URL. Each user id should be separated by a comma. example :
    Code:
    allowed = [1,2,3, 6, 13, 100, 6001, 2003, 452]

    redirect : this is the pathname that members who are not allowed are redirected to. Currently it is set to /forum

    Now, members can get past this by disabling JavaScript. So, if you want to combat that you can create a new widget with the following content, and place it on your portal.

    Title : Your choice
    Use a table type : No
    Code:
    <noscript><meta http-equiv="refresh" content="0;/forum"/></noscript>
    yayayes
    yayayes
    Forumember


    Female Posts : 49
    Reputation : 1
    Language : Thai
    Location : Bangkok, London & Hong Kong

    Solved Re: How to make portal visible only to certain group members?

    Post by yayayes November 28th 2014, 11:54 pm

    Thank you for your kind advice, Ange Tuteur!  rendeer
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13246
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to make portal visible only to certain group members?

    Post by Ange Tuteur November 29th 2014, 2:28 am

    You're welcome ^^

    Topic archived