Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.

Fable Portal (Simple portal plugin)

This discussion is related to the Fable Portal addon.
KryptixKryptix Ypres
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)

Comments

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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.

  • KryptixKryptix Ypres

    @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.

    R_J
  • KryptixKryptix Ypres
    edited October 2017

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

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

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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 Unlosk · Français / French ✭✭✭

    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 ^^

  • KryptixKryptix Ypres

    @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 Unlosk · Français / French ✭✭✭

    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:)

  • KryptixKryptix Ypres

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

  • KryptixKryptix Ypres
    edited October 2017

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

    R_JK17
  • K17K17 Unlosk · Français / French ✭✭✭

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

  • KryptixKryptix Ypres

    @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:

    R_J
  • K17K17 Unlosk · Français / French ✭✭✭

    @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

    vrin_123
  • KryptixKryptix Ypres

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

    K17
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

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

    KryptixK17
  • KryptixKryptix Ypres

    @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 Unlosk · Français / French ✭✭✭

    @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?

  • KryptixKryptix Ypres

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

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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)

    Kryptix
  • KryptixKryptix Ypres

    @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

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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');
    }
    
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    There is a security flaw in your module. Never echo any content without sanitizing or your forum is open for XSS attacks. Use Gdn_Format::text() for username and Gdn_Format::to($Post->Body, $Post->Format) for the body. You certainly need to include the discussions Format column in your SQL then.

  • KryptixKryptix Ypres

    @R_J said:
    There is a security flaw in your module. Never echo any content without sanitizing or your forum is open for XSS attacks. Use Gdn_Format::text() for username and Gdn_Format::to($Post->Body, $Post->Format) for the body. You certainly need to include the discussions Format column in your SQL then.

    Thanks for pointing that out. These are my first week doong php development, another thing to learn xD

Sign In or Register to comment.