php - Only allow logged in WordPress Admin to access page (outside of WordPress core) -


background on trying accomplish... have created mini cms on top of codeigniter edit database stuff web app. right not password protected, since still being developed. want integrate wordpress installation client not have log cms and wordpress.

where far is:

  1. i have created custom wp admin_menu (via add_menu_page)
  2. i have cms visible/working in iframe of admin menu tab.

what need allow access these cms pages if user authenticated wordpress admin.

in case wondering directory structure:

/ (codeigniter installed on root) /blog/ (wordpress install) /blog/cms/ (cms talking codeigniter) 

thank in advance!

update: since hasn't been answered in answers yet, need know how execute wordpress functions outside of wordpress system.

you want use wordpress's current_user_can() function confirm user has @ least 1 capability associated admin user, or member of administrator role.

according codex page, should work test administrator based on role, although i'm not in position confirm sorry. i've used method in past verify user has given capability.  

<?php current_user_can( 'administrator' ); ?> 

 edit: authenticate users different site wp, using wp credentials, this answer on over wordpress.stackexchange describes how use wp's built in xmlrpc service. answer written in context of authenticating servlet, consumption of wp xmlrpc service implemented in eg javascript @ client (rather between sites' 2 separate backends) might more useful in scenario.

the answer includes pre-written plugin handle specific auth request remote client @ wp server... note comments below question regarding use of token instead of passing creds on wire (research "nonce" if you're not familiar these... wp can created these you).


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -