Support » Plugin: Bug Library » [Plugin: Bug Library] UnHook MetaBox Save

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Yannick Lefebvre

    (@jackdewey)

    Hi Shaun,

    Sorry for the lack of response. I got very busy over the past few months in my personal life so I did not get a chance to see the messages posted here.

    I looked a bit at the code and what might be happening is that the other plugin that you are using might be running its post save routine after mine and my code might be conflicting. I did look through the code and the only thing I can think of doing would be to decrease the priority of my plugin save routine to see if it helps.

    Try changing the number 10 on line 93 to a higher number (50 or 100) and see if that helps the two plugins co-exist.

    Let me know if this helps and I can make it a permanent change.

    Yannick

    Thanks Yannick.

    I had tried that but no go.

    Note: I may be running a slightly different version (1.01) than you as it appears on line 91 for me.

    I tried 50, 100, even 1000:
    add_action(‘save_post’, array($this, ‘add_bug_field’), 1000, 2);

    Thanks for idea though.

    Both plugins have an add_action(‘save_post’ …. So, shouldn’t the designated save routine be called for both? If that’s true it should work because both plugins seem to be protecting the logic around specific post types.

    Shaun

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    That’s what has me a bit puzzled. My understanding of the actions such as this is that every registered action would get called. And yes, I am protecting the code by checking the post type.

    I will do a bit more research and get back to you on that.

    Yannick

    Hi Yannick,

    I think I found the problem. In your code you have:

    function add_bug_field($ID = false, $post = false) {
    		if ($post->post_type = 'bug-library-bugs')
    		{

    I’m not sure $post is getting set properly, so the logic in this method is not blocking as it should. I believe the logic is executed for other post-types causing their own save logic to fail.

    If I add a line to get_post, it seems to fix everything:

    function add_bug_field($ID = false, $post = false) {
    		$post = get_post($ID);
    		if ($post->post_type = 'bug-library-bugs')
    		{

    Let me know what you think about incorporating it in.

    Thanks,

    Shaun

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    I just incorporated your change in the latest release.

    Working well.

    Thanks Yannick!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Bug Library] UnHook MetaBox Save’ is closed to new replies.