Announcement

Collapse
No announcement yet.

how do I let users know they've been kicked off

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how do I let users know they've been kicked off

    Hi, I'm trying to insert some javascript into the "error_nopermission_loggedin" template that would display the message "YOU HAVE BEEN KICKED OFF" if the user has been kicked off and is trying to log in. I don't know a thing about javascript.

    Would you debug this script for me?

    <script language="JavaScript">
    <!--
    function kicked() {
    var kickedoff = $usergroupid;
    if (kickedoff == 15) {
    document.write("YOU HAVE BEEN KICKED OFF");}
    }
    //-->
    </script>

  • #2
    you have an extra parenthesis after the document.write
    Scott MacVicar

    My Blog | Twitter

    Comment


    • #3
      huh?

      I'm sorry, I don't understand what you mean.

      Comment


      • #4
        He means this:
        <script language="JavaScript">
        <!--
        function kicked() {
        var kickedoff = $usergroupid;
        if (kickedoff == 15) {
        document.write("YOU HAVE BEEN KICKED OFF");}
        }
        //-->
        </script>
        iComix :: web comics

        Report Post | IP: Logged

        Comment


        • #5
          <script language="JavaScript">
          <!--
          function kicked() {
          var kickedoff = $usergroupid;
          if (kickedoff == 15) {
          document.write("YOU HAVE BEEN KICKED OFF");}
          }
          //-->
          </script>
          Two openings... two closings... I think that part's right (or is it?). Either way, I tried removing it, and it still doesn't even show up.

          Thanks,
          Galen

          Comment


          • #6
            Code:
            script language="JavaScript"> 
            <!-- 
            function kicked() { 
              var kickedoff = $bbuserinfo[usergroupid]; 
              if (kickedoff == 15) { 
                document.write("YOU HAVE BEEN KICKED OFF");
              } 
            } 
            //--> 
            </script>
            Try that and how or where are you trying to call the function?
            Scott MacVicar

            My Blog | Twitter

            Comment


            • #7
              Originally posted by PPN
              Try that and how or where are you trying to call the function?
              I'm putting it into the error_nopermission_loggedin template.... and calling it? I want to call it right there - where/how do I need to call it?

              thank you for your help, I really appreciate it.

              -galen

              Comment


              • #8
                you need to call the function, you have it defined just not loading or trying to be executed.

                you should be able to make it

                Code:
                <script language="JavaScript"> 
                <!-- 
                function kicked() { 
                  var kickedoff = $bbuserinfo[usergroupid]; 
                  if (kickedoff == 15) { 
                    document.write("YOU HAVE BEEN KICKED OFF");
                  } 
                } 
                kicked();
                //--> 
                </script>
                though consider changing document.write to alert so they get a prompt.
                Scott MacVicar

                My Blog | Twitter

                Comment


                • #9
                  thanks!

                  you guys rock. it worked perfectly (I even added an else! oh boy!)



                  -galen

                  Comment


                  • #10
                    final code:

                    Code:
                    <script language="JavaScript"> 
                    <!-- 
                    function kicked() { 
                      var kickedoff = $bbuserinfo[usergroupid]; 
                      if (kickedoff == 15) { 
                        document.write("<center><font color=red><b>We're sorry, but YOU HAVE BEEN KICKED OFF</b></font></center>");
                       }
                      else {
                        document.write("<p>You do not have permission to access this page. This could be due to one of several reasons:<p><ol><li>You do not have permission to access the page that you were trying to. Are you trying to edit someone else's post or trying to access administrative features? Check that you are allowed to perform this action in the Forum Rules.</li><li>If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.</li></ol>");
                      }
                    } 
                    kicked();
                    //--> 
                    </script>

                    Comment

                    Loading...
                    Working...
                    X