• Resolved elronaldo

    (@elronaldo)


    I have admin_notices working fine to all users EXCEPT vendors. I am using 2 different well-documented methods below), but neither appear for Vendors (say, on their edit products page); otherhwise the code below works fine.

    function admin_notice() {
        $screen = get_current_screen();
        // Only render this notice in the post editor.
        //if ( ! $screen || 'post' !== $screen->base ) {
        //    return;
        //}
        // Render the notice's HTML.
        // Each notice should be wrapped in a <div>
        // with a 'notice' class.
        $type = get_post_type();
        if ($type == 'product') {
        echo '<div class="notice notice-success is-dismissible"><p>';
        echo sprintf( __( 'Your WP install now has a custom plugin. <a href="/wp-admin/index.php" target="_blank">There are now 2 &apos;WoodMtn.com Custom Plugin&apos; panels on the Dashboard.</a>' ), get_preview_post_link() );
        echo '</p></div>';
        $screen = get_current_screen();
        // Only render this notice in the post editor.
        if ( ! $screen || 'post' !== $screen->base ) {
            return;
        }
        // Render the notice's HTML.
        // Each notice should be wrapped in a <div>
        // with a 'notice' class.
        echo '<div class="notice notice-success is-dismissible"><p>';
        echo sprintf( __( 'Post draft updated. <a href="%s" target="_blank">Preview post</a>' ), get_preview_post_link() );
        echo '</p></div>';
        }
    }

    Any suggestions as to what I should try?? These ‘net naive’ vendors will need some help at some crucial points and I need to print admin-notices to them. I should note that some admin-notices such as ‘product saved OK’ appear just fine and I need to match that function/use of privs for Vendors.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Mark Kevin

    (@mkesteban08)

    Hi Ronaldo,

    Our developer found out that this is reproducible and that the admin notices do not show. However, we’re still investigating the issue and doing our best to find out what could be causing this.

    We’ll get back to you as soon as we have more information about it. Have a nice day!

    Thread Starter elronaldo

    (@elronaldo)

    I figured your reply would be ‘of course…’ and one of your own hooks to hit…

    I can certainly see why some of these need to be suppressed – sure don’t want a vendor to get an admin_notice about updating a plugin… all the same, when a vendor hits ‘Save’ on a product, the admin_notice appears OK…

    Hi @elronaldo

    Jamie here, lead dev and all-round code monkey. I’ve been tinkering with this problem on and off since you posted it. I’m still unable to figure out what is going on. I’m now down to going down the capability list to figure out what is going on. I’ll update you when I work out what the issue is.

    cheers,

    Jamie.

    Thread Starter elronaldo

    (@elronaldo)

    I’m wondering if there is a way to place the typical admin_notice into the context of saving a product as the product ‘author’

    Hel @elronaldo

    I still haven’t figured out this issue, so I’ll be creating a GitHub issue to track this.

    You can follow the issue here.

    https://github.com/wcvendors/wcvendors/issues/658

    cheers,

    Jamie.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘admin_notices don’t appear for vendors’ is closed to new replies.