WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Hook for Settings->Discussions page (4 posts)

  1. jephperro
    Member
    Posted 5 years ago #

    Hi, I need a little help finding the right hook.

    I'm writing a simple plugin for my WPMU site to disable (with javascript) one checkbox on the Settings->Discussion page.

    (I don't want my users ever configuring their blog without the "administrator must always approve the comment" checked)

    Anyhoo, I can't find a good hook to attach to when this page is loaded. The best that I can find is admin_print_scripts, or admin_footer so I can print some javascript to find the id (id='comment_moderation'), to check the box and disable it

    Is there a hook I can use when the Settings->Discussion page is finished loading? Is there something better I could use?

    Thanks,

    Jeff

  2. Mark / t31os
    Moderator
    Posted 5 years ago #

    Attach a stylesheet and a small piece of jQuery to hide it?...

    Just as quick dirty fix?

    jquery hide it, then use the stylesheet to display:none as a backup incase the user has JS disabled...

  3. jephperro
    Member
    Posted 5 years ago #

    Well, yes, that would kind of work. But I really have to do 2 things:

    1. Make sure that the checkbox is checked.
    2. Disable the checkbox so the user cannot change it.

    So I'd rather not hide the div. So my solution so far is to use javascript to check and disable "comment_moderation". The hook I use now is admin_footer,

    I was hoping for a better way, but maybe the only way to do it is quick and dirty.

  4. Mark / t31os
    Moderator
    Posted 5 years ago #

    <input disabled="disabled" checked="checked ...etc..

    Sets the checkbox to checked and disabled...

Topic Closed

This topic has been closed to new replies.

About this Topic