• Resolved akanksha90

    (@akanksha90)


    Hi,

    I have installed the plugin on a wordpress network.
    When a network admin creates the polls, everything works fine.
    But, when admins of individual sites create the poll, things look fine on the admin panel, but on the frontend, there is no input element displayed, i.e. there are question text, answers but no checkbox or radio button and also no submit button.

    How can I fix this?

    https://www.ads-software.com/plugins/awesome-surveys/

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter akanksha90

    (@akanksha90)

    Hi,

    I have noticed that the value of hidden field “content” changes when I click on “Publish” or “Update” button. In the changed value, only labels are present and all the elements(checkbox, radio button, etc) are removed.

    So something is happening at the time of saving the post in the db.
    Don’t know where to look. Please help.

    Plugin Author Will Brubaker

    (@willthewebmechanic)

    Automattic Happiness Engineer

    Howdy akanksha90,

    can you copy/paste the value of the hidden “existing_elements” field here?

    Thread Starter akanksha90

    (@akanksha90)

    Hi Will,

    Thanks for your reply.

    I was debugging the code yesterday and found out that nothing is wrong in the plugin. WordPress doesn’t allow any user other than Super Admin to add certain HTML elements in the post content. It has something to do with ‘unfiltered_html’ capability.

    This is the reason why when super admin creates the survey, it works all fine but when admins of individual sites create it, WordPress removes the ‘input’ elements from the content. ‘textarea’ works fine.

    I am now trying to find a way to allow site admins to be able to add content with input elements. Do you happen to know a workaround for this?

    Plugin Author Will Brubaker

    (@willthewebmechanic)

    Automattic Happiness Engineer

    Wow, that is super interesting – thanks for the information. Anyhow, I do not know of any type of workaround at this time. I came across this: https://www.ads-software.com/plugins/unfiltered-mu/ but – it is unmaintained so I don’t know if it will even work and I don’t think it’s a very good idea to use it.

    I’ve opened an issue on the github repo here https://github.com/WillBrubaker/awesome-surveys/issues/36 – I don’t know that I’ll be able to find any time to work on it but I do have a couple of ideas how it could be handled.

    Thread Starter akanksha90

    (@akanksha90)

    Hi Will,

    I found this post while looking for a solution: https://endorkins.com/2013/08/27/disable-wordpress-kses-to-prevent-html-filtering/

    Do you think this can be implemented in the plugin but only for admins?
    I am still looking for something that I can add in my theme. But if this can be implemented at plugin level, it will be better, because I do not need the admins to add html in any other custom post type or plugin.

    Thread Starter akanksha90

    (@akanksha90)

    Hi Will,

    I was thinking, what if you don’t use post_content to store the form and use a post meta field instead? Do you think it will work?

    Plugin Author Will Brubaker

    (@willthewebmechanic)

    Automattic Happiness Engineer

    akanksha90,

    That would work, but it’s a lot of overhead to accomplish this.

    I haven’t found any time to dig in to this, but it seems to me that it would be easier to conditionally allow input elements via some sort of wp_kses filter. The other approach would be to render the form “on the fly” – the elements are all stored as a json encoded in a format that can be rendered – this is how the survey plugin worked prior to 2.0.

    Thread Starter akanksha90

    (@akanksha90)

    Hi Will,

    I don’t know how to do that. Also, I couldn’t find an older version of the plugin to check how its done there.
    Do you have any example code to start with?

    diegooli

    (@diegooli)

    same here, nothing yet?

    Plugin Author Will Brubaker

    (@willthewebmechanic)

    Automattic Happiness Engineer

    @akanksha90 @diegooli – I just pushed a change to the github repo that generates the form on the fly if:

    1. is_multisite() returns true AND
    2. the post author does not have the unfiltered_html capability

    https://github.com/WillBrubaker/awesome-surveys/commit/dfa9531110963fefe444aafaa7042e9fd798afc6

    This will be included in version 2.1 of Awesome Surveys. I can not provide an ETA on when that might be completed.

    Thread Starter akanksha90

    (@akanksha90)

    Hi Will,

    Thanks for the change. It works ??

    Hi Will,

    I just tested your plugin version 2.1 and on the front end I don’t see any checkboxes or radio buttons.

    Actually all fields were not showing until I disabled the CSS you include, which fixed some of the field types but not the radio and checkbox options.

    You can see my test here – https://moscowexpatlife.ru/survey-test/

    I am the only admin user so my account should have the unfiltered_html

    Any help would be gratefully received

    Sean

    Plugin Author Will Brubaker

    (@willthewebmechanic)

    Automattic Happiness Engineer

    Howdy Sean,

    That looks to me like a theme issue. What happens if you temporarily switch to a default WordPress theme such as Twenty Sixteen? Do the checkboxes/radios appear then?

    Hi Will,

    Sadly it is a theme issue.

    Your plugin looks beautiful on twenty15.

    But that doesn’t help me with this client who wants it on the theme he’s been using for 5 years ??

    Any idea how I get it to work?

    Thanks

    Hi

    I had the same issue and fixed it. On network install when someone with Editor privileges added ALL the questions, no radio buttons/checkboxes were displayed. I fixed it by adding one question myself as Admin. All the buttons for all the questions then appeared. I even deleted the question I added as it was not required and the buttons were still displayed for the original questions.

    Hope that helps.

    Chris

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Survey doesn't show input elements in the front’ is closed to new replies.