Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
426 views
in Q2A Core by
I am seeing myself using

$userid = qa_get_logged_in_userid();

over and over again.

It would be easier to have this data "globally" accessible as $userid.

Is that possible?
Q2A version: 1.7.4

1 Answer

0 votes
by
Global variables are generaly regarded as bad coding. I'm actually looking to remove globals where possible.

And I don't think using globals will help anyway, because you would still need to do `global $userid` any time before you use it.

The good thing about using the function is that if the method of getting the user changed, you won't need to change your code.
...