In the admin page, Database Options => set “Can See Submission when using shortcodes” to “editor” or whatever you like.
But this applied to ALL of your short codes.
That setting is only affect to cfdb plugin shortcode only, and not applied to my custom shortcode as described on your tutorial http://cfdbplugin.com/?page_id=444.
Should we add some check inside “Template code” there?
OK, in custom short code:
Try this at the beginning of your code:
if (!$this->plugin->isUserRoleEqualOrBetterThan('Editor')) return;
Choices are:
- ‘Administrator’:
- ‘Editor’
- ‘Author’
- ‘Contributor’
- ‘Subscriber’
- ‘Anyone’
That applies to that custom short code only
If you want to tie it to the general option do:
if (!$this->plugin->canUserDoRoleOption('CanSeeSubmitDataViaShortcode')) return;
Found error when applying with “canUserDoRoleOption”.
What function to constuct “plugin” object?
Fatal error: Call to a member function canUserDoRoleOption() on a non-object in /home/content/22/9186622/html/wp-content/plugins/shortcode-exec-php/shortcode-exec-php-class.php(967) : eval()’d code on line 4
.
Try:
require_once(ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CF7DBPlugin.php');
$plugin = new CF7DBPlugin;
if (!$plugin->canUserDoRoleOption('CanSeeSubmitDataViaShortcode')) return;
It works! Thanks Michael!
BTW, I also use your Data Editor and it really great plugin!
And it would be better to put this tips on [Create Your Own Short Code] page also 🙂