• Resolved blueblast

    (@blueblast)


    hey
    when i add the following shoirtcodes to my page, it shows both the content (for customer and vendor) to both customers and vendors.

    the customer user role is generated by woocommerce and vendor role by wc-vendors plugin.

    [eyesonly logged="out"]
    You need to be <a href="/my-account" target="_blank">logged in</a> to see this content.
    [/eyesonly]
    
    [eyesonly level="customer" logged="in"]
    [contact-form-7 id="17940" title="Vendor Application"]
    [/eyesonly]
    
    [eyesonly level="vendor" logged="in"]
    You already have vendor privileges!
    [/eyesonly]

    I tried this too:

    [eyesonly level="customer, vendor"]
    [eyesonlier level="customer"]
    [contact-form-7 id="17940" title="Vendor Application"]
    [eyesonliest level="vendor"]
    You are a vendor already!
    [/eyesonliest]
    [/eyesonlier]
    [/eyesonly]

    but for vendor it shows nothing!

    https://www.ads-software.com/plugins/eyes-only-user-access-shortcode/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author thomstark

    (@thomstark)

    [eyesonly level="customer" logged="in"]
    [contact-form-7 id="17940" title="Vendor Application"]
    [/eyesonly]
    
    [eyesonly level="vendor" logged="in"]
    You already have vendor privileges!
    [/eyesonly]

    The above two shortcodes will show to everyone who is logged in, because you have logged="in" in the shortcode.

    If you just specify the level, then it won’t show to anyone else (including logged out people obviously).

    [eyesonly level="customer, vendor"]
    [eyesonlier level="customer"]
    [contact-form-7 id="17940" title="Vendor Application"]
    [eyesonliest level="vendor"]
    You are a vendor already!
    [/eyesonliest]
    [/eyesonlier]
    [/eyesonly]

    The vendor can’t see anything in this scenario because you wrapped the vendor shortcode inside a customer shortcode. All of that is totally unnecessary anyway. Just do this:

    [eyesonly logged="out"]You need to be <a href="/my-account" target="_blank">logged in</a> to see this content.[/eyesonly][eyesonly level="customer"][contact-form-7 id="17940" title="Vendor Application"][/eyesonly][eyesonly level="vendor"]You already have vendor privileges![/eyesonly]

    Remove the line breaks from in between the different shortcodes, because WordPress will still show the line breaks that occur between the different shortcodes, and thus people who can’t see the content will see big gaps in the page. (Line breaks inside a shortcode are fine, obviously.)

    Thread Starter blueblast

    (@blueblast)

    [eyesonly logged="out"]
    You need to be <a href="/my-account" target="_blank">logged in</a> to see this content.
    [/eyesonly]
    
    [eyesonly level="customer"]
    [contact-form-7 id="17940" title="Vendor Application"]
    [/eyesonly]
    
    [eyesonly level="vendor"]
    You have a vendor account already!
    [/eyesonly]

    I was able to use this
    STRICT ROLE MATCHING was turned off so I turned it on. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘role overlap – two shortcodes’ is closed to new replies.