I'm building a membership site with a membership plugin right now. The different types of memberships are associated with IDs and I have to constantly do things like "show this if the ID is 4122 (i.e. user is a member of group X), but hide otherwise".
For this, I'm constantly looking up the IDs of the various levels and it just dawned on me that this is terribly inefficient.
To get around this, I tried declaring variables at the top of my
$gold_member = 4122;.
I'm a bit of a beginner in php and tried then passing those variables into my functions via
global $gold_member;. But that didn't work and I also read somewhere that it is considered bad form to use globals.
Is there any standard way of solving this problem? Basically what I'm after is something very similar to how variables are used in SASS or LESS. I want to define them once and then use them in
functions.php and in the templates.