Support » Plugins » Hide source code from non admin members?

  • Hey,

    I was wondering how I could hide source code from non admin members?

    The main reason why I want to do this is because I like to add beta (but stable) code to my live site, some times, but I only want it to effect me. Normally it’s the very last bit of testing I do before I bring the code fully online. So I only do this when I am 99% sure everything will work as expected. And of course I back everything up first.

    Since I can not do this at the moment I have to comment out the code when I am not using it at the very moment. It’s very annoying. That is I add the code for testing and something does not work as expected so I want to leave the code in but then I have to comment it out because everyone can see it. It would just be nice if only I could see it (and of course be effected by it) . It would just make it a far less time consuming process.

    Well thanks for your help,


Viewing 6 replies - 1 through 6 (of 6 total)
  • What I like to do is use a development install of WP that’s separate from the production one. You’ll need another database but it might be helpful in testing code changes.

    Yeah, trying to do something that too. I am trying to do that, but I want a real copy. That is, say like every night, automaticlly roll over the current database to the develop database. So its pretty much a copy at that time. Not just the database, but files of course too.

    Atm, I am just doing it manually and its a pain. That is coping files back and fourth and using phpmyadmin or shell to import database stuff. Just gets tiring. 😉

    But this issue is not really about that. This is after I have already tested on a development, local installed and am installing on the real server. Just something goes, wrong or whatever and then I have to roll back. Would just be easier if the changes would only effect me and then I could active the changes for real when I am ready to.

    Though been reading a few stuff and it looks like only Oracle supports such a thing with its “commit” and “rollback” features.

    Do you mean “non-admin” members or do you mean people who aren’t logged on? If it’s the latter, a simple conditional check you could do anywhere is:

    <?php if ($user_level > 0) { ?>
    this is the conditional stuff
    <?php } ?>

    The variable $user_level is only set when you’re logged in.

    If it’s the former, see this:


    So I would use if user level not equal to 10. 🙂

    All right, thanks a ton,


    How i could hide a post from non admin members? Exist some keys for the custom fields? I will not use the post status private, because the categories are not visible…

    Excuse! Now I have found a plugin for my problem.

    The feature i need is implemented:
    – private posts show up in category counts

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hide source code from non admin members?’ is closed to new replies.