WordPress.org

Ready to get started?Download WordPress

Forums

CMS Tree Page View
[resolved] Better WP Security conflict? (9 posts)

  1. StudioGulo
    Member
    Posted 10 months ago #

    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/

  2. Pär Thernström
    Member
    Plugin Author

    Posted 10 months ago #

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

  3. StudioGulo
    Member
    Posted 10 months ago #

    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": {

    ____

  4. chris@vendiadvertising.com
    Member
    Posted 10 months ago #

    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);
    		}
    	}
    }
  5. StudioGulo
    Member
    Posted 10 months ago #

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

  6. danlong
    Member
    Posted 9 months ago #

    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

  7. Pär Thernström
    Member
    Plugin Author

    Posted 9 months ago #

    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.

  8. Pär Thernström
    Member
    Plugin Author

    Posted 9 months ago #

    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 :)

  9. chris@vendiadvertising.com
    Member
    Posted 9 months ago #

    Thanks @Pär, glad it worked!

Reply

You must log in to post.

About this Plugin

About this Topic