Good art is a taste, good design is an opinion.


Come as guest, stay as family.
Board Index

Come as guest, stay as family.


You are not connected. Please login or register

Foto

[Solved] Prefix only for admins and mods



View previous topic View next topic Go down Message [Page 1 of 1]

1
Offline

  Jorpeto

avatar
Punbb Rookie
Punbb Rookie
  • Description:
I will use this tutorial only for admins and mods

-> http://punbb-design.forumotion.com/t6-javascript-topic-prefix

  • Information:
Forum:mimundoac . foros . bzVersion:PUNBB
Type:Errors in codeTags:Prefix,admins

Powered by PunBB
Currently 0 users have thanked Jorpeto for this post:

2
Offline

  Shadow

avatar
Administrator
Administrator
Hello @Jorpeto

1. Enable forum widgets.

2. Create new widget and put

Code:
[panda=js]<script>var prefixes = ["prefix1","prefix2","prefix3","prefix4"];
  var _pm = false;
    var chk = false;
    function toMenu(a) {
      var htmlpre = '<select style="margin-right:5px" id="prefix" size="1"><option value="">(None)</option>';
      for (i in a)
      htmlpre += '<option value="' + a[i] + '">' + a[i] + '</option>';
      htmlpre += '</select>';
      return htmlpre;
    }
    function checkpre(ar, input) {
      for (i in ar) {
          var p = new RegExp("\\" + ar[i], "g");
          var title = input.substr(0, input.indexOf(']'));
          if (p.test(title)) return ar[i];
      }
      return "";
    }
    $(function () {
      if (_pm) chk = /\privmsg/.test(location.href);
      if (/\/post/.test(location.href) || chk) {
          $(toMenu(prefixes)).insertBefore("input[name=subject][type=text]");
          var mw = $("#prefix").width() + 5;
          $("input[name=subject]").css("width", $("input[name=subject]").width() - mw);
          var t = $("[name=subject]").val();
          var cur = checkpre(prefixes, t);
          if (cur != "") {
            $("[value=" + cur + "]").attr("selected", "selected");
            $("input[name=subject]").val(t.replace('[' + cur + ']', '').trim());
          }
          $("input[name=post]").click(function () {
            var sub = $("input[name=subject]").val().trim();
            if (sub != "" && $("#prefix").val() != "")
                $("input[name=subject]").val("[" + $("#prefix").val() + "] " + sub);
          });
      }
    });</script>

3. Click on and set the Rights like on the image:




Forum Administrator, Coolyou,
Due to the volume of PMs I receive, I do not provide support via PM.
We have community forums for most support requests. If it's truly confidential, please do PM me.

Useful links:
-> Before asking question,  please use a Search option.
-> If you want to check our staff members click here.
->  Forum rules, this is a MUST READ thread.
->  FAQ (Frenquently asked questions)

Powered by PunBB
Currently 0 users have thanked Shadow for this post:

3
Offline

  Virus

avatar
★Moderator★
★Moderator★
Hello is this solved @Jorpeto?

Powered by PunBB
Currently 0 users have thanked Virus for this post:

4
Offline

  Jorpeto

avatar
Punbb Rookie
Punbb Rookie
Solved

Powered by PunBB
Currently 0 users have thanked Jorpeto for this post:

5
Offline

  Shadow

avatar
Administrator
Administrator
[sucesso="Marked as Solved"]The question(s) in this topic have been answered and the owner has been able to solve the problem. Because of this, the topic has been marked as Solved.

If you have further questions, please open a new topic.[/sucesso]



Forum Administrator, Coolyou,
Due to the volume of PMs I receive, I do not provide support via PM.
We have community forums for most support requests. If it's truly confidential, please do PM me.

Useful links:
-> Before asking question,  please use a Search option.
-> If you want to check our staff members click here.
->  Forum rules, this is a MUST READ thread.
->  FAQ (Frenquently asked questions)

Powered by PunBB
Currently 0 users have thanked Shadow for this post:

6
Offline

  Sponsored content



Powered by PunBB
Currently 0 users have thanked Sponsored content for this post:

View previous topic View next topic Back to top Message [Page 1 of 1]


Topic URL's

URL
BBcode
HTML

Permissions in this forum:
You cannot reply to topics in this forum