SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2010
    Location
    ONS
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to Code something only for admin, and show in public area of site ?

    Hi,

    I want to display a message in a plugin in public area of site, if admin is logged in,
    and another message, if anyone else (other than admin) is logged in.

    Can someone please give me idea or show me an example, how to code that ?
    Thanks.
    I love to help and also to get helped.

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2010
    Location
    ONS
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think i have not provided enough info in question.
    I love to help and also to get helped.

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    You can do something like:
    Code:
    <?php if(current_user_can('edit_users')) : ?>
    Admin Message
    <?php else : ?>
    Normal Message
    <?php endif; ?>

  4. #4
    SitePoint Zealot
    Join Date
    Nov 2010
    Location
    ONS
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, Thanks for your valuable information.
    I love to help and also to get helped.

  5. #5
    SitePoint Zealot
    Join Date
    Nov 2010
    Location
    ONS
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sir, Can you please help me in one more thing, I need to get the value of a variable on top of the page, which is declared and defined in bottom of that page.
    I love to help and also to get helped.

  6. #6
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Declare it at the top? =p

    You can't use it until it's declared, so you'll have to move it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •