HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Fable Portal (Simple portal plugin)

KryptixKryptix
edited October 2017 in General Banter

I've seen a couple of requests about portals like most other forum softwares have,
therefor I decided to start writing my own plugin to give people a simple portal.

The portal will contain multiple custom modules, ofcourse you can also use your existing modules on it.

The plugin is still being developed and will be released once it is totally set up.

Note: this plugin requires you to use the bootstrap theme released onhere (https://open.vanillaforums.com/addon/bootstrap-theme)

Demo: http://fablegames.xyz

Currently Supports:

  • LatestNewsModule: shows latest threads from a selected forum (limited to let's say 800 (html) characters shown on screen)

«1

Comments

  • You can define dependencies in plugins. If your plugin requires a theme, add this line to the PluginInfo array: 'RequiredTheme' => ['Bootstrap' => '>= 2.4'],

    Dependencies on themes are not very common. A better approach than designing a plugin so that it is usable only with one theme, would be to design it to work with the default theme. You have several options for making it run with your desired theme.
    Use the needed CSS by adding those lines with the CSSEdit plugin and add a description to the README of the plugin.
    Or you can add the css file and comment out the addCssFile line in your code (again with a documentation of how to use proceed when using the bootstrap theme)
    You could even provide two CSS files: "default.css" and "bootstrap.css". Given that your plugin is simply named "portal" you could use that line of code $sender->addCssFile(c('portal.CssFile', 'default.css'), 'plugins/portal'); in order to make the css file that your plugin loads configurable.

    My preferred solution would be a plugin which is designed in a way that it doesn't need a theme specific css. Second best approach would be to document the additional css needed to make it run with theme XY.


    One "problem" with portals from my understanding is the content: everybody understands different things when talking about portals.

    You mentioned that you have a LatestNewsModule. Do you plan to implement all information in modules? I guess that would be a very good approach. In the end you could make the view which combines all modules configurable which would allow other forums to write their own portal easily based on the example in your plugin.

  • @R_J Thanks for your input, all information will be in modules.
    I know people think their own way when it comes to portals, they could just implement or write whatever module they want to make the portal fit their needs.

  • KryptixKryptix
    edited October 2017

    I'll try to handle the modules selection like this:

    The plan is to have them listed by their AssetTarget()

  • You should add a sort possibility and most probably you can re-use the code from the Category section.
    I guess that doesn't need to be more flexible. But... :wink:

    One of my open projects right now is a user list and I wanted to make it as flexible as possible. My first approach was to make a gigantic grid of all available user information and all roles so that every role could get an individual list. It soon turned out that this wasn't maintainable.

    What I'm doing right now is using templates. I implement a settings page that fetches all *.tpl files from my plugins view folder. I populate a dropdown with that views and show all rows with such a "views dropdown" behind them.
    That way, I/the forum admin can define a specific view for every role which allows showing minimum information to guests, some more information to members and even private information to admins.

    But, coming back to flexibility, it even allows brave forum admins to write and use their own templates. I guess I would have to provide a list of available fields and two or three example templates, most probably a guest template, an admin template and a default template for all other roles.
    It already includes custom Smarty functions so that an interested admin can get an imagination of what is possible.
    With that tools at hand there should be no limit for admins, but it stays simple for all those which are confident with the given views.

  • K17K17 ✭✭✭

    Good idea ^^ It will be simpler than use Articles addon for a lot of people ^^
    But there is a really bad idea: a theme as requirements.
    When you do a plugin, it's preferable to make it works on the default theme, because most Vanilla themes keep default structure and classes, so your plugin will integrate with most themes available here, and others like premiums themes or custom ones.
    The bootstrap theme is widely used, but not as the default theme (and derivations) are ^^^

    But this still good work ^^

  • @K17 zei:
    Good idea ^^ It will be simpler than use Articles addon for a lot of people ^^
    But there is a really bad idea: a theme as requirements.
    When you do a plugin, it's preferable to make it works on the default theme, because most Vanilla themes keep default structure and classes, so your plugin will integrate with most themes available here, and others like premiums themes or custom ones.
    The bootstrap theme is widely used, but not as the default theme (and derivations) are ^^^

    But this still good work ^^

    So basicly using default css to accomplish the same thing? :smile:

  • K17K17 ✭✭✭

    Yes @Kryptix ^^ And needed addidtions with your plugin css file but using the default css too and not another one ^^ (Don't know if I'm clear :lol:)

  • @K17 I understand what you're saying, will totally do this :smile:

  • KryptixKryptix
    edited October 2017

    Now compatible with default themes :+1: (just used existing css tags to accomplish it)

  • K17K17 ✭✭✭

    @Kryptix
    This is just awesome :awesome: Will you release it here when finished ?

  • @K17 zei:
    @Kryptix
    This is just awesome :awesome: Will you release it here when finished ?

    I sure will, anything special you'd like to see as a module on it? I can include it. :+1:

  • K17K17 ✭✭✭

    @Kryptix I think that the latests discussions and/or latest activity module (who's shown on pages with the basicpages application) is a great start ^^
    Exemple

  • @K17 Those are quite simple to add since they exist :)

  • I think something like "New Users This Week" would be fine.

  • @R_J zei:
    I think something like "New Users This Week" would be fine.

    I like the idea, but wouldn't that be a bit to much :tongue:

    Let's say your community start gaining attention and you get 100+ new members/week, the list would be way to long :wink: I'd suggest making that a plugin using a full page and maybe an additional module with a shortened list which you can optionally add to the portal

  • K17K17 ✭✭✭

    @R_J a dit :
    I think something like "New Users This Week" would be fine.

    But using the recent activity, it will be already there no?

  • I've just uploaded the first version of the portal, no special thingies yet:
    https://open.vanillaforums.com/addon/fableportal-plugin

  • You have to change the PluginInfo array. It must end like that:

       'AuthorUrl' => 'http://www.fablegames.xyz',
       'License' => 'GPLv2'
    );
    

    Otherwise uploading your plugin makes a forum crash (that hasn't happened to you since the plugin info is cached and I assume you have added the license info line later on)

  • @R_J said:
    You have to change the PluginInfo array. It must end like that:

       'AuthorUrl' => 'http://www.fablegames.xyz',
       'License' => 'GPLv2'
    );
    

    Otherwise uploading your plugin makes a forum crash (that hasn't happened to you since the plugin info is cached and I assume you have added the license info line later on)

    My bad. Will fix it in the morning haha

  • You have named your plugin FablePortal but the class PortalPlugin. By convention you should have named it FablePortalPlugin.
    Normally plugins extend Gdn_Plugin instead of implementing Gdn_IPlugin. I guess you should do it as a convention, but I don't see any reason why you should have to do that. The class.plugin.php has some helper functions

    You have used the PluginController and "manually" build a Vanilla page. Instead of doing that you can directly use the VanillaController which would have saved you some lines:

    public function vanillaController_portal_create($sender) {
        $sender->render('portal', '', 'plugins/FablePortal');
    }
    
Sign In or Register to comment.