Need Help in wordpress!!!

Discussion in 'PHP' started by rohansyco, Jul 13, 2009.

  1. #1
    Hi,

    Actully i have created a CMS using wodpress script...

    But here i want to add some my own created fuctionality which can be used by the administrator only....

    and even some pages which can be used by the administrator....

    so how can i add external pages with such type of security..???

    Thanks,
     
    rohansyco, Jul 13, 2009 IP
  2. agilius

    agilius Well-Known Member

    Messages:
    1,021
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    100
    #2
    there are some functions that can check to see if the admin is online or not. For example :

    
    
     <?php if(is_user_logged_in()): ?> 
     ......... code that will be shown only if a user is logged in.....
     <?php endif;?>
    
    
    Code (markup):
    This will show the content between the : and endif; only is a user is logged it. Then, you could have something like this:

    
    
     <?php if(is_user_logged_in() && current_user_can('edit_plugins')): ?> 
     ......... code that will be shown only if a user is logged in and this user can edit plugins.....
     <?php endif;?>
    
    
    Code (markup):
    Will display content only if the user can edit plugins... Only admins can edit plugins. I think you can see where I am going.

    I hope you found my post useful. Say thanks and I'll give you a cookie :D
     
    agilius, Jul 27, 2009 IP