Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter kasper79

    (@kasper79)

    Wow @bcworkz thats fantastic, so I’ll try to find a way to create a parent page each time a user registers and then for every page they create, they create child pages of their unique parent page. Makes sense. Thanks for the thorough explanation.

    Thread Starter kasper79

    (@kasper79)

    Hi bcworkz,
    thank you for explaining it to me.
    Is it not possible to create a folder for the user, when he/she registers, and then add all pages to this folder, or are pages not registered with folders?

    Do you have any other suggestions?

    Best Kasper

    Thread Starter kasper79

    (@kasper79)

    @bcworkz Thanks a lot for answering. I tried to follow your idea, but without any luck.

    add_filter( 'posts_where', 'hide_attachments_wpquery_where' );
    function hide_attachments_wpquery_where( $where ){
    	global $current_user;
    	if( !current_user_can( 'manage_options' ) ) {
    		if( is_user_logged_in() ){
    			if( isset( $_POST['action'] ) ){
    				// library query
    				$admin_IDs = get_users(array('role' => 'Administrator' ,'fields' => 'ID'));
    				$admins = implode(",", $admin_IDs);
    				if( $_POST['action'] == 'query-attachments' ){
    					$where .= ' AND post_author='.$current_user->data->ID . ' AND post_author IN ' . $admins;
    				}
    			}
    		}
    	}
    	
    	return $where;
    }
    

    Then I tried just writing the ID of my admin account, but this doesn’t work either. Any thoughts on this?

    
    add_filter( 'posts_where', 'hide_attachments_wpquery_where' );
    function hide_attachments_wpquery_where( $where ){
    	global $current_user;
    	if( !current_user_can( 'manage_options' ) ) {
    		if( is_user_logged_in() ){
    			if( isset( $_POST['action'] ) ){
    				// library query
    				
    				if( $_POST['action'] == 'query-attachments' ){
    					$where .= ' AND post_author='.$current_user->data->ID . ' AND post_author IN (1)';
    				}
    			}
    		}
    	}
    	
    	return $where;
    }
    
    

    Thanks a lot
    Kasper

Viewing 3 replies - 1 through 3 (of 3 total)