CurrentUserID in custom query

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
inside83
User
Posts: 62

CurrentUserID in custom query

Post by inside83 »

Hello,

I have custom / blank page and it needs a dropdown menu that is locked (grayed out) on CurrentUserID but unlocked if administrator is logged in (CurrentUserID = '-1').
Is there a way to do this?
How to use CurrentUserID in a query? WHERE id_field = .CurrentUserID()?


mobhar
User
Posts: 11745

Post by mobhar »

You just need to follow the PHP syntax rule, use dot (.) character to concat the string, for example:

// assume id_field field type is varchar or char
"WHERE id_field = '" . CurrentUserID() . "'";


danielc
User
Posts: 1601

Post by danielc »

inside83 wrote:
a dropdown menu that is locked (grayed out)

You can add "disabled" class to <li> tag under .navbar (for horizontal menu) by jQuery .attr (see api.jquery.com/attr/). And put your JavaScript code in Client Script->Global->Pages with header/footer->Startup Script with check, e.g.

<?php if (!IsAdmin() && ew_CurrentPage() == "yourcustompage.php") { ?>
// your code
<?php } ?>


Post Reply