• Resolved smarta-brett

    (@smarta-brett)


    Hi guys

    great plugin!

    I was wondering if I can use it to solve a problem – a client has woocommerce (in Catalog only mode)

    he would like for his staff to use the site as a tool whist talking to customers on the phone.

    He’d like to have a addition tab called “Staff Notes” where he can put info only the staff need to see.

    He would like the info in that tab to only be seen if the user is logged in (as say Editor)

    As it is catalog only he does not want to require everyone hwo views the site to sign in – so all viewers apart form his logged in staff wil not be “users”

    any suggestions?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter smarta-brett

    (@smarta-brett)

    I just saw this – would it work that way?

    hide fields

    and if so what would the code be for a custom tab?

    • This reply was modified 8 years, 4 months ago by smarta-brett.
    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hello @smarta-brett,

    I think this can be accomplished as described in the link you attached, but it will not have capability-awareness for the editor role; it would be for all logged in users.

    The CSS is dependent on the name of your tab. Let’s say the name is “Staff Notes.”

    CSS to hide the tab for all users that are not logged in:
    .staff-notes_tab{ display: none !important; }

    CSS to show the tab for all users who are logged in:
    body.logged-in .staff-notes_tab{ display: inline-block !important; }

    Unfortunately I could not get these styles to take effect without using the !important keyword. However, having those two lines of code in your CSS file should do the trick.

    Let me know if this works (and thanks for finding that link :-)),
    Kevin.

    Thread Starter smarta-brett

    (@smarta-brett)

    Hi Thanks Kevin

    i tried that and could not get it to work

    I have now also added a custom text field using WC Fields plug in to see if it would work witrhg that but it still shows up when not logged in

    I am using

    .staff_notes { display: none !important; }
    body.logged-in .staff_notes { display: inline-block !important; }

    any suggestions?

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hello @smarta-brett,

    I think the issue may be with the CSS you’re using. If you want to target a tab named “Staff Notes” the class for the tab will be staff-notes_tab, and the selector will be .staff-notes_tab. Another example, if the tab were named “Additional Product Information” the class would be additional-product-information_tab and the selector would be .additional-product-information_tab.

    In the CSS you posted, you’re using .staff_notes and body.logged-in .staff_notes. Try changing this to .staff-notes_tab and body.logged-in .staff-notes_tab.

    If it’s possible, could you post a URL to your site so I can try adding the CSS in the browser and see what happens?

    Cheers,
    Kevin.

    • This reply was modified 8 years, 4 months ago by yikesitskevin.
    Thread Starter smarta-brett

    (@smarta-brett)

    hi

    I had that CSS and it did not work – I tried creating a custom field (not using YIKES) and the CSS code I sent was for that – sorry for the confusion!

    the url is

    https://greenlifestructures.com/
    access password to view the site is ” greenhouse ”

    the product
    https://greenlifestructures.com/product/6mm-quad/
    has both a tab and custom field

    the CSS is
    .staff-notes_tab{ display: none !important; }
    body.logged-in .staff-notes_tab{ display: inline-block !important; }

    to hide the tab

    and

    .staff-notes{ display: none !important; }
    body.logged-in .staff-notes{ display: inline-block !important; }

    to hide the field

    but they both display weather logged in or not

    I am happy to send you admin login if there is a secure way I can do it

    thanks for your help!

    Thread Starter smarta-brett

    (@smarta-brett)

    it’s OK – i got it to work – stupid me thought the field was called “staff-notes_tab” – it was actually “staff-only_tab”…. slaps forehead!

    I’ve adjusted it and it now works

    however this begs another question – it is possible to great a “global” tab that will appear on all products (instead of having to do one for each product)

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi there @smarta-brett,

    I’m glad it works!

    I am currently working on new features for this plugin as part of releasing a new version. One of the features we’d like to add is the ability to save a tab and apply that tab on other products. This wouldn’t exactly fulfill your request, because it would need to be applied to each individual product.

    I’m not quite sure how a global tab would work – unless the content is the same for every product (if not, you’d have to change the content for each individual product anyway). Is having the same content what you had in mind?

    Kevin.

    P.S. You should remove the password you added to the previous reply.

    • This reply was modified 8 years, 4 months ago by yikesitskevin.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hide tab unless logged in’ is closed to new replies.