Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    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.

    Thread Starter Bayu Widyasanyata

    (@bwidyasanyata)

    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?

    Plugin Author Michael Simpson

    (@msimpson)

    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;

    Thread Starter Bayu Widyasanyata

    (@bwidyasanyata)

    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
    .

    Plugin Author Michael Simpson

    (@msimpson)

    Try:

    require_once(ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CF7DBPlugin.php');
    $plugin = new CF7DBPlugin;
    if (!$plugin->canUserDoRoleOption('CanSeeSubmitDataViaShortcode')) return;
    Thread Starter Bayu Widyasanyata

    (@bwidyasanyata)

    It works! Thanks Michael!

    BTW, I also use your Data Editor and it really great plugin!

    Thread Starter Bayu Widyasanyata

    (@bwidyasanyata)

    And it would be better to put this tips on [Create Your Own Short Code] page also 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Contact Form 7 to Database Extension] Restrict data only for logged users’ is closed to new replies.