Multisite setup using folders

Do a dump on $username = $site->user(); and you will see what’s wrong :wink:

i tried that, they both matched.

That is interesting, as that can’t possibly be the case. $site->user() returns a user object, not a username.

User Object
(
    [username] => jimbobrjames
    [email] => james@example.com
    [role] => admin
    [language] => en
    [avatar] => 
    [gravatar] => https://gravatar.com/avatar/6852d2af95e22a5ccf82325eeceb51f2?d=mm&s=256
    [isCurrent] => 1
)

Well i did this, and they both have the same value.

<?php if(!$site->user()) go('/') ?>
<?php

$username = $site->user();
$clientname = $page->author();

if($username == $clientname): ?>

    <p>You have access</p>

<?php else: ?>
    <?= $username ?>
    <?= $clientname ?>
    <p>You do not have access</p>

<?php endif ?>

If i do a var_dump on the variable i get the whole object.

Yes, and you compare a user object with these methods to a field object, which will return false.

Solution:

if($username->username() == $clientname): ?>

Duh! im always forgetting about objects. Thanks, works now.