Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Pockets Panel Position Index
Hi i used pockets and really works excellent, i have a doubt,
With this configuration it works perfectly:
Page; discussions / Location: Panel /Repeat; After
With this configuration it does not work:
Page; discussions / Location: Panel /Repeat; Index: 4.
I would like the pockets to appear above the online now, attached image.
0
Comments
You need to use this plugin to sort the modules
https://open.vanillaforums.com/addon/modulesort-plugin
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
I have already installed it, but it does not have any documentation how it works, I add the module OnlineNow in Conversations and I put it of last and it does not change anything in the panel,
Regards,
I have read the documentation to order the changes but Pockets is a plugin, and OnlineNow is a module, I still do not understand how to add Pockets in the order.
It works by reordering the modules to what you want. Maybe try the plugin Widgets, it creates modules that can be sorted and you can put anything in them.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Thks @vrijvlinder excelent your pluging widgets, create twitter feed and disable css to avoid breaking the css of the boostrap theme,
Modules Orders:
config.php
$Configuration['Modules']['Vanilla']['Panel'] = array('MeModule', 'UserBoxModule', 'GuestModule', 'NewDiscussionModule', 'DiscussionFilterModule', 'SignedInModule', 'Ads', 'CategoriesModule', 'ArticlesModule', 'TagModule', 'TwitterModule', 'OnlineNowModule');
Regards
Resolved.
@vrijvlinder What would be the best practice to add permission to view by role the modules created with the plugin widgets,
regards,
You would need to enact permissions to each module.
here is an example,check for valid session only moderators can see, if it is not the moderator, it will not be loaded.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@vrijvlinder it would be great to be able to add, for example, the view permission for each of the roles, edit it in the panel and be able to display the widgets for each role (Admin, Moderator, Member, Guest),
Regards,
I think you could do that, it's just a matter of creating all the modules for each role and giving them permissions to check for each role. It can be a bit complicated but I am sure it can be done.
I can't help you do it at the moment I am too busy, but I am sure @R_J could , he is a wizard ...
You could check:
if admin
if member
if moderator
if x role
Based on who it is the modules would show or not show.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@vrijvlinder I have created the function to see for the widgets addon, in a simple way, so that they are seen by roles, of course it would be interesting to do it by module:
Code:
Modify default.php --> addon widget
Modify class.twittermodule ---> Widget Twetter Feed.
Any suggestions, I have tried and it works well,
Regards,
Yes the simplest way is to obfuscate the plugin entirely based on roles, but I think it would be better to do it by module.
Since you can create an unlimited amount of modules, it would be better by module.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
That should help: https://open.vanillaforums.com/discussion/comment/225254/#Comment_225254
Create a plugin called "moduleVisibility" or whatever, add some permissions to the info array like that
Plugins.ModuleVisibility.Twitter.View
Then assign this permission to the appropriate roles. In the code do the following checks
Is that module part of the assets array
If yes, check if the user has the permission to see it
If not, unset it
@vrijvlinder @r_j
It is extremely simple, with the widgets module, and this we can have all the modules in an orderly way and with the permissions as if it were a plugin
Config Widget Plugin: default.php:
// Check Permissions: class.twittermodule.php
Thank you very much indeed, I hope you can modify your plugin so that more people can see it and learn more about Vanilla Forum, that's what makes free software really powerful when they are well thought out.
Awesome work ! Widgets is free to modify as you did to work for you. I made it just to make easier for people to add modules and sort them. You have extended it and that is great !!
Send me the modified plugin and I will update it to include permission models.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Going that route you have to alter every plugin/module that you like to take influence on. That is not very flexible, a lot of extra work, it couldn't be packed into a plugin that you could publish and that are only some of the minor concerns.
Vanilla is very powerful and when you try to change some behaviour, you will see that in most cases there are general solutions which helps plugin authors a lot.
Instead of changing the module, add the following to a plugin:
Now basically the following will happen: all modules are added normally to the Panel, but before the Panel is rendered, you check for the view permissions and remove it from the array of modules which will be rendered afterwards.
Far more elegant than repeating the if-block would be to loop through an array. You would have to build an array like that:
With such an array you could replace single if blocks with a loop:
Now strip those talkative comments:
That would make your code short, maintainable and flexible. All needed actions are done in your own plugin, so that you do not have to alter other files.
P.S.: the code is untested and I haven't followed this discussion completely, so there might some things to fix with my code, but basically that's the approach I would take if I would like to create "per module permissions"
@vrijvlinder @r_j Thanks a lot is a simple but powerful code since everything is done in the plugin for any module to implement in vanilla forum,
Regards,
Yes,It makes more sense to create a separate plugin that it's only purpose is to allow or disallow views of modules based on roles and permissions.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
// Define the plugin: default.php
@vrijvlinder Checking several plugins and with the recommendation of @r_j I have arrived until this code works perfect, in the modules only the widgets would be placed, while the plugin gives access to all of them
It is possible that instead of writing the name controllers where I want the module to appear, I can define an array with the name controllers for each module and add the module in public function base_render_before ($sender) ?
Thanks to the collaboration of @r_j testing two solutions, which I will share to add another feature to the plugin widgets of @vrijvlinder.
Solution 1: default.php
}
Solution 2: default.php
These two solutions work correctly, which would be the best to implement,
@vrijvlinder @R_J
Regards,