• Ohai!

    I’ve been looking all over for a plugin that does this. But with no luck.

    When a post is published and being edited, I’d like to tell my visitors that “the post is being edited”. I found the wp_check_post_lock function, which is included in content-single.php. See my github:

    https://github.com/dunderrrrrr/wp_check_post_lock/blob/master/wp_check_post_lock.php

    This works fine. However, is it possible that it’s a security problem? Exploits? XSS maybe? I only know the basics of WordPress, and to me it looks all fine.

    What do you experts say? 🙂

    Have a nice day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter qworx

    (@qworx)

    Anyone?

    Moderator bcworkz

    (@bcworkz)

    Sorry I ignored your prior post, I tend to skip over posts from people looking for plugins since I know little of them. I custom code almost everything and last week was very hectic for me, so at the time I didn’t read past the first line.

    Your code is OK, no security risks. Where did you place your code though? The code itself could be at risk from being lost in an update unless it’s in the right place. You should either contain any custom code in a child theme or your own plugin.

    Thread Starter qworx

    (@qworx)

    Thanks lot for your answer bcworkz!

    Since I only want to display the “post is being edited”-warning on the post itself (in my case content-single.php, inside the themes folder) I placed the function in content-single.php.

    The function is also being called in content-single.php. The theme is custom made, so the code itself won’t be in danger of any theme-updates.

    Anyhow, you answered my question! Thanks alot budd 🙂

    • This reply was modified 9 years, 4 months ago by qworx.
    Thread Starter qworx

    (@qworx)

    Found an error.

    My apache errorlog says this:

    PHP Warning: Missing argument 1 for wp_check_post_lock()

    To get rid of it, replace:

    if (wp_check_post_lock()) {
            echo "Post is currently being edited by wp user.";
    }

    with

    if (wp_check_post_lock($post_id)) {
            echo "Post is currently being edited by wp user.";
    }
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘wp_check_post_lock in content-single.php’ is closed to new replies.