What template and how to add link

  • OK, this is a fairly simple request (or should be). I know in XenForo, adding a link to various areas are very easy if you know the template.

    What I'm trying to do is add a link to my webmail in this area

    Preferably in the "Community" area. What is the template that will be used for that. I'm thinking it's the userPanel template (from looking at it) but would like to confirm that.
    And to take it a step further, I'm wanting to restrict visibility of that link to only allow it to be seen by members of a specific group. I know that in XF you can do this in the template using conditional statements. Is the same ability present in WBB? If so, any examples of how to use them (like a FAQ page for them)?
    In addition, I need to know how to add (and use) a specific phrase into the language file for the link to show/use in the menu option. I have yet to find the ability to add phrase from the ACP. Is that feature non-existent? If so, how do you add just one specific phrase?
    I really hate to tag people on stuff like this, but since there is more concentration on the German side than the English, it's time to tag @TimWolla for assistive input! :P

    I could probably use the normal menu feature - but it lacks the ability to restrict those menu options to certain user groups. I don't want everyone (guests, users, etc) having access easily to the webmail page.

    3 Mal editiert, zuletzt von Tracy Perry (6. Januar 2016 um 20:13)

  • Wrong area most likely.. reporting original post to have it moved.

    Well I was going to report it... but it meets none of the required parameters to be reported - so if someone in power could move it to the "how do I do X" section, where it probably would fit better I'd appreciate it.

    • Offizieller Beitrag

    Hi

    I really hate to tag people on stuff like this, but since there is more concentration on the German side than the English, it's time to tag @TimWolla for assistive input!

    Sure :)

    I'm thinking it's the userPanel template (from looking at it) but would like to confirm that.

    Technically correct, but: That menu is dynamically generated from the database. You'll need a plugin for that.

    Is that feature non-existent? If so, how do you add just one specific phrase?

    You cannot add phrases manually. But as you need a plugin anyway you can add it via that plugin.

    it to be seen by members of a specific group

    As you'll need a plugin anyway: I suggest adding a permission for that.

    The necessary userMenu.xml will look as follows. If you want to use a link target that is not a part of Burning Board you'll need a few more files (ask, if necessary).


    If you need more general help in creating a plugin simply ask follow ups.

  • If you need more general help in creating a plugin simply ask follow ups.

    Ouch.. was hoping that I was getting away from the "need a plugin" aspect of doing stuff when I moved from IPS. I stopped doing any kind of coding a LONG time ago.
    All it needs to do is simply have a link to //mywebsite.com/tuxmail (where website.com is my actual domain) and the link is to a roundcube installation on a subdirectory off the main domain (using the location / parameter in the nginx vhost) and be controlled by access only to a usergroup called Webmail.
    I can follow most of the code sample provided, but where does it pick up (or you assign) the permissions. Is the .webmail the actual group name that would be set for access to it. If you can link me to a FAQ page on creating plug-ins, I can probably muddle through it. I can generally figure most stuff out with examples.. but as I've gotten older my mind is not as flexible as it once was.
    Thanks!

    EDIT:
    I found this mod but it's from 2013 and looks like it's for the 4.0 line, so doubt it would work on 4.1.

    Einmal editiert, zuletzt von Tracy Perry (6. Januar 2016 um 21:05)

    • Offizieller Beitrag

    Hi

    there you go. Attached is a plugin that contains everything you need, but it's not batteries included: You'll have to adapt a few parts yourself. Let's take a look at the files inside the plugin:

    package.xml

    • Defines meta information about the plugin
    • com.example.webmail: Internal identifier, must be unique. The first two parts should be a domain of yours in reverse order.
    • <packagename>: Human readable name
    • <packagedescription>: Human readable description
    • Example Author: The name of the author. Change this to your name.
    • <requiredpackages>: This one's correct for this plugin. Add more packages here if you depend on other plugins.
    • <excludedpackages>: Incompatible packages.
    • <instructions>: These define how to install or update the plugin. This one's correct already.

    userMenu.xml

    • You know this one from above. I added one more line, though: There is a class defined that will modify the link target, we'll take a look at that file shortly.
    • <permissions> must match your userGroupOptions.xml
    • <parent> defines the “category” of this menu item.
    • You don't need to modify this file.

    userGroupOption.xml

    • Defines the permission.
    • It's a boolean option with a default of false, you'll need to set this manually for every user group
    • You don't need to modify this file.

    language/*

    • Defines the phrases
    • Content should be fairly obvious
    • You don't need to modify this file.

    files/lib/system/menu/user/WebmailMenuItemProvider.class.php

    • This is the PHP class you defined in userMenu.xml
    • It allows you to modify the behaviour of the menu item
    • We use this to set the link target.
    • You'll need to modify the link target and the comment at the top of the file.
      • @author: Your name goes here
      • @copyright: You name or company goes here
      • @license: Choose one you like. I opted for CC0 (a.k.a. Public Domain) for this one.
      • @package: This one should match the identifier in package.xml
      • @subpackage: This one should match the namespace at the top of the file (modulo the first part)

    Adapt the files as necessary and create a new .tar file from it. Make sure you match the proper folder structure.

  • there you go. Attached is a plugin that contains everything you need, but it's not batteries included: You'll have to adapt a few parts yourself. Let's take a look at the files inside the plugin:

    Thanks!
    If I have a guideline (which is what I'll use this for) I can start learning. I'm more of the "hands one gotta see" type person. Once I have a fairly simple example (which is what this sounds like it probably is) I can usually work off of it and deduct what goes where (I've had good luck looking at PHP code and doing that).

  • it is. The plugin does everything that's necessary, but no more.

    OK.. moved all the files over to my Linux server, and made the modifications.
    Then I go and archive the /lib back up. I've used tar cf and tar czf for both it and the base package.. but either way I'm getting a uploaded archive is invalid message. Are those actually archived using tar, or are they using one of the zip products?

    • Offizieller Beitrag

    Hi

    Are those actually archived using tar, or are they using one of the zip products?

    Standard tar. But it might be that your folder structure was wrong (package.xml not being in the root). See this transcript for correct packing. If it still does not work there might be a syntax error in your package.xml. If in doubt: Attach your packed plugin and I'll take a look.

  • Standard tar. But it might be that your folder structure was wrong (package.xml not being in the root)

    Pretty sure that the structure is identical... so it has to be the syntax error... I'll check it.

    And looking.. I think it's going to be the tar parameters I was passing. Also, I had the /lib directly under the add-on root, and not in a files sub-directory.
    After making that modification to the structure, looks like it works!
    Again, thanks!!!!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!