• Resolved crafto

    (@crafto)


    Hello everyone, requiring again all of your help for a little problem.

    I wanted to know if it was possible to make a “Select Tag” for example (or something else, a text/email tag etc…) invisible for users and visible only for admins/editors directly on CF7.

    I know there’s the “is_admin” or “current_user_can” thing but that is kinda inconvenient in my opinion because when I’m trying to add for example a <div> with this, it is just putting it at the bottom of my page.
    -> Unless it is just because I attach my function to my footer and therefore it is placed after it ? If it is because of this, is it alright to do it this way : “add_action(‘$contact_form’, ‘my_function’);” ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • ciao @crafto, you can hide the select in this way.

    .select-to-hide {display: none}
    body.logged-in .wpcf7 .select-to-hide {display: block}

    but this only show and hide the field. but you may want to take a look at https://contactform7.com/additional-settings/#subscribers-only-mode and create 2 different forms.

    to attach a function to wpcf7 search for a cf7 hook here

    take a look here for more info. https://developer.ww.wp.xz.cn/plugins/hooks/

    Thread Starter crafto

    (@crafto)

    Thanks for your answer Erik, I’ll be looking at those now

    Thread Starter crafto

    (@crafto)

    In the end, I decided to look for an other solution for my “Select Tag” problem.
    Originally, I had to make a “Select Tag” modify-able by admins that’ll showcase a counter for users (which is why I wanted to make it invisible at first so users won’t be able to modify it).

    -> But then I just decided to just completely remove that “Select Tag”, showcase the information needed to the user directly in a <span> and everything will be managed in the code.
    -> Instead of retrieving my counter number in a “Select Tag” (which was easier), I’m retrieving my <span> string instead and converting it into an int (which is a bit annoying but nothing too big).

    So, thank you again for your suggestions Erik once more! Even if i end up using something else, your message are always instructive from what i know so far 🙂

    i’m happy to help 🥳

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Make a “Select” visible only for the admin’ is closed to new replies.