php - Use wordpress admin for existing website admin panel

685

Hi guys I was asked to add a wordpress blog to a website, I was wondering if there was a way to let the existing website admin area use the same login as wordpress admin!

P.S: I know that I can make a wordpress plugin to control the existing website from inside wp-admin, but I don't want to do this. So is there a way to include some wordpress page or function in the header of the existing admin panel?

[edit] as the website prevented me from answering the question: Your answers gave me some brain storming and Voila! I read this article: http://www.linickx.com/1016/root-cookie-tutorial-1-accessing-wordpress-cookies-from-custom-scripts and then used the plugin: http://wordpress.org/extend/plugins/root-cookie/ Through it I could move the cookies place, and added the following piece of code to the existing CMS header:

<?php
define('WP_USE_THEMES', false);
require('../portal/wp-load.php');

require_once('../portal/wp-config.php');
if (!is_user_logged_in()){auth_redirect();}?>

I wish my solution will be useful!

579

Answer

Solution:

Not being a user of wordpress I don't know the exact variables, but I would guess WP sets a session variable so that it knows you are logged in. I can't see why you couldn't just set that variable in your own script.

Of course it is not always that simple, but that's where I would start looking.

[EDIT] seeing your comment response, it is essentially the same thing, but backwards. Find the session that is set in your old CMS and eidt wordpress so that it gets set as well when you log in.

826

Answer

Solution:

Store your wordpress session in a database or a cookie. Then write a script in your old CMS that checks that storage.

440

Answer

Solution:

Your answers gave me some brain storming and Voila! I read this article: http://www.linickx.com/1016/root-cookie-tutorial-1-accessing-wordpress-cookies-from-custom-scripts and then used the plugin: http://wordpress.org/extend/plugins/root-cookie/ Through it I could move the cookies place, and added the following piece of code to the existing CMS header:

<?php
define('WP_USE_THEMES', false);
require('../portal/wp-load.php');

require_once('../portal/wp-config.php');
if (!is_user_logged_in()){auth_redirect();}?>

I wish my solution will be useful!

People are also looking for solutions to the problem: php - textarea not rendering properly on an ajax load

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.