Hey there,
I got a big problem on a website.
We created lots of custom so-widgets and assigned a custom role with limited capabilities to a content-manager.
Unfortunately the content of the custom widgets does not get saved. Standard Siteorigin-Widgets get saved.
Are there any restrictions with pagebuilder that I missed? In the documentation I found nothing about custom roles.
Any help appreciated.
Kind regards,
Florian
Hi Florian,
To clarify, are you stating that you created your widgets using the SiteOrigin Widgets Bundle framework or via the standard WordPress widgets functionality? Would it be possible for you to link me to your GitHub or provide us with a copy of your code so we can take a look over it? Or are you stating this issue relates to the standard SiteOrigin widgets?
Regardless of the above, there aren’t any restrictions set in place, the only real requirement is that the user needs to be able to edit the post in general. How are you adding this custom user role?
Hi Alex,
to create the widgets we use the SiteOrigin Widgets Bundle framework. The code is not on GitHub, but here is a Gist:
Gist of widget code
Widgets shipped with the PageBuilder work as expected, they get saved as normal. Strange thing is, you see the Content in the “Edit Post”-Screen, but in the frontend the default values of the widget appears. If you switch back from to the WordPress-Editor (revert to editor) you see the SO-Shortcodes but without content.
We are adding the custom role via the plugin “Members”.
Hi,
Is there a template file I can take a look at?
Hi Alex,
I updated the Gist with the template file.
Hi Fsm_office,
Just to confirm, did you mean to omit
<?php
on the first line of the template file?Regardless, this appears to be happening due to the following PHP in application-text.php:
Please either remove that method, or return
$instance
rather than an empty array.Hi Alex,
Yes, the PHP-Tag was a typo. Sorry for that.
I changed the method to return the instance, but also this does not solve the problem.
Hi Fsm_office,
That’s odd – that helped me. Can you please update the provided gist with the changes you’ve made?
Hey Alex,
sorry for the delay, I updated the gist.
Hi again,
I also noticed the Shortcode-Content is empty if you switch back to the text-editor
Hi Fsm_office,
Thanks. The provided version works without issue for me. Can you please provide me with a full copy of your plugin? I suspect the reason why it’s not working could becoming elsewhere. Also, please double check to ensure you’re using the latest version of SiteOrigin Page Builder and the SiteOrigin Widgets Bundle.
For reference, here’s what the shortcode looks like for me.
Hi Alex,
thanks for your help. The Code resides in a Custom Theme.
I think its a Problem with Roles and Capabilities, either the Plugin “Role Manager” or the WordPress-Capabilities not mapped right.
I try to check the capabilities again and maybe hardcode them all without a plugin.
However, you do a great job at SiteOrigin, it is my favourite composer and also your support is very nice!
Thank you again :)
Hi Fsm_office,
Thank you for the kind words! :)
Let me know how you go mate.