Hide div if current user is not page owner
Permalink
Hi,
Is there a way to only show a div to the page owner?
I want the general page to be viewable by everyone (therefore permissions seem to be out of the question) and only show a certain div when the page owner visits that page.
Some along the lines of:
If
logged in user is not page owner then hide #div
else
show #div
Can this be done?
thanks in advance
Is there a way to only show a div to the page owner?
I want the general page to be viewable by everyone (therefore permissions seem to be out of the question) and only show a certain div when the page owner visits that page.
Some along the lines of:
If
logged in user is not page owner then hide #div
else
show #div
Can this be done?
thanks in advance
This is untested, but should work in general:
Thank you! Just a couple of minor changes and this works:
You sir are a scholar and a gentleman!
<?php $c = Page::getCurrentPage(); $u = new User(); ?> <?php if($u->getUserId() == $c->getCollectionUserID()) { echo ('<div><p>This will only be shown to the page creator (or page owner if it has been changed in page properties)</p></div>'); } ?>
You sir are a scholar and a gentleman!
Great if worked out for you!
My typing error has been corrected above (quick typing when having a quicker mind) and I'm glad you found out how to correct it yourself.
My typing error has been corrected above (quick typing when having a quicker mind) and I'm glad you found out how to correct it yourself.