WordPress.org

Support

Support » Plugins and Hacks » CMS Tree Page View » [Resolved] Better WP Security conflict?

[Resolved] Better WP Security conflict?

  • First, thanks for this great and useful plugin!

    After installing the Better WP Security plugin I was recommended to remove the User with ID one and did so. Then the Tree View plugin crasched. – but only when WP_Debug was true.

    Apparently WP throws and error in the author-template.php file, and my best guess is that it’s trying to get info from the first user who now doesn’t exist anymore.
    (Trying to get property of non-object)

    So, disabling debug solves it.
    Adding a check in author-template.php if the user is returned also solves the problem but I’d rather not edit code in the WP-core.

    Is it possible that this plugin can take care of this issue?

    http://wordpress.org/plugins/cms-tree-page-view/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Pär Thernström

    @eskapism

    Where is the error thrown? What line/functions? Do you get an error message when you view the tree in wp admin?

    Notice: Trying to get property of non-object in $templatepath$/wp-includes/author-template.php on line 74

    The treeview is stuck on loading… and the error is thrown in the middle of two posts:

    $templatepath$ is just a placeholder in my answer
    ____

    “modified_author”: “Sanna Nellmer”,
    “columns”: “”,
    “user_can_edit_page”: “1”,
    “user_can_add_page_inside”: “1”,
    “user_can_add_page_after”: “1”,
    “post_title”: “Sannas Test”
    }
    }
    ,
    Notice: Trying to get property of non-object in $templatepath$/wp-includes/author-template.php on line 74
    {
    “data”: {
    “title”: “Hans testsida 88”,
    “attr”: {

    ____

    cjhaas

    @chrisvendiadvertisingcom

    I’ve got the same problem and have traced it a little further. I think it has to do with deleted users in general and not just the first user. The problem appears to be in core.

    /wp-includes/author-template.php – line 73:

    $last_user = get_userdata($last_id);

    In my case $last_id is 4 which is a user that was deleted. The next line never checks if get_userdata() returns false and blindly uses a property on it. I’ve patched my local install by adding this to the CMS TPV functions file and changing line 1246 to use it instead.

    function cms_tpv_get_the_modified_author() {
    	if ( $last_id = get_post_meta( get_post()->ID, '_edit_last', true) ) {
    		$last_user = get_userdata($last_id);
    		if( $last_user !== false ){
    			return apply_filters('the_modified_author', $last_user->display_name);
    		}
    	}
    }

    Yup. Sounds about right.
    Is it possible to get this fixed for the next update of CMS TPV?

    I’ve just updated to the latest version (1.2.13) and still getting this conflict error – CMS TPV is hanging and just shows the loading symbol.

    It’s kicking out this error on the dashboard – Uncaught SyntaxError: Unexpected token <

    When inspecting that further it’s showing this error – <b>Notice</b>: Trying to get property of non-object in <b>/var/www/vhosts/DOMAIN.COM/httpdocs/wp-includes/author-template.php</b> on line <b>74</b>

    Is there anything else you can do to fix? CMS TPV is a great plugin and definitely a life-saver when it comes to managing the website, so would really like to have this fixed!

    Thanks

    Plugin Author Pär Thernström

    @eskapism

    Thanks for all the debugging folks! I should be able to fix this now. However you have to wait a while because the computer where the code is on is broken and I’m waiting for it to be fixed.

    Plugin Author Pär Thernström

    @eskapism

    OK, my computer is back on track and I’m to release a new version of this plugin today. @chris: I used your function cms_tpv_get_the_modified_author() to fix the author issue, hope you’re fine with that 🙂

    cjhaas

    @chrisvendiadvertisingcom

    Thanks @pär, glad it worked!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Better WP Security conflict?’ is closed to new replies.
Skip to toolbar