Forum Replies Created

Viewing 1 replies (of 1 total)
  • Lovin the work here JTWilcox and others.

    J3design I am also using sub pages and they work fine, however I have a main client page (for each client) and that has its own template. Inside that template I generate navigation for all the sub pages so the client can navigate to project 1, project 2 etc.

    The only problem that I had was client a, could potentially see client b’s pages.

    So in my client template I added, it checks to see if the username is the same as the url, if so it allows the client to view, otherwise it re-directs them back to the login page. Stops one client snooping on another.

    ?php 
    
    $username = ( $userdata->user_login ); 
    
    ?>
    
        <?php
    $url =  $_SERVER['REQUEST_URI'];
    $urlItemsArr = explode( '/', $url );
    
    /*
    print ('client-area/'.$userdata->user_nicename);
    print '<br />';
    print ($urlItemsArr[1].'/'.$urlItemsArr[2] );
    print '<br />';
    */
    
    if ( strcmp( 'client-area/'.$userdata->user_nicename, $urlItemsArr[1].'/'.$urlItemsArr[2] ) == 0) {
    	 print 'Allowed';
    } else {
    	header('Location:https://www.yourdomain.com/wp-admin/') ;
    }
    
    ?>
Viewing 1 replies (of 1 total)