Support » Plugin: Download Monitor » Cannot acces private property DLM_Download::$id

  • Resolved BenM

    (@alysko)


    Hi,

    I use this function to limit access to some files:

    function dlm_all_downloads_members_only( $can_download, $download ) {
    	// No need for checking if access is already denied
    	if ( false == $can_download ) {
    		return $can_download;
    	}
    
     	if ( ! has_term( 'autres', 'dlm_download_category', $download->id ) ) {
    		// Check if user is logged in
    		if ( ! is_user_logged_in() ) {
    		$can_download = false;
    		} // Check if it's a multisite and if user is member of blog
    		else if ( is_multisite() && ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) ) {
    		$can_download = false;
    		}
    	}
    	else {
    		$can_download = true;
    	}
    
    	return $can_download;
    }
    
    add_filter( 'dlm_can_download', 'dlm_all_downloads_members_only', 10, 2 );

    Now, I have this error

    PHP Fatal error: Uncaught Error: Cannot access private property DLM_Download::$id

    for the line with $download->id.

    What can I do?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot acces private property DLM_Download::$id’ is closed to new replies.