1
votes

My plugin has a login page that is used to log in the authorized users, in this stage the left side menu of wordpress is visible. Once user is authorized I use the following code to redirect him to the secure page, but once user is redirected to the securepage.php the left side menu of WordPress gets disappeared.

How can I keep the left side menu visible in all pages of my plugin?

Once user is logged in I use the following code to redirect to a secure page

 ...
 //if user is authorized redirects them to a securepage.
 if(authorized())
 {
            $content = content_url();
            $dir = $content. "/plugins/Galleries/securepage.php";
     echo '<script type="text/javascript">window.location.href="'.$dir.'";</script>';
 }
 ....

By left side menu I mean the following one

enter image description here

1
The question is incomprehensible. - Denis de Bernardy
@Denis question is updated .thanks - user2071377
So,in other words you'd like to create a WP admin page? - Denis de Bernardy
not sure what you mean by WP admin page, but as you see my plugin name is on the left side menu (Galleries) but when user is authenticated and it redirects user to securepage.php this left side menu will be disappeared. - user2071377
In other words, securepage.php is not showed within WP, right? - Denis de Bernardy

1 Answers

2
votes

It looks like the problem is just that you are redirectring to a page that is not connected to the wp-admin functions.

i think that the best thing you can do is output to the same page different content when the user logs in.

you can do that in many ways. the one i like the most is just using AJAX to run the query and change the content of the page.

the second thing i can suggest you can see here: WordPress Files

these are the wordpress system files (i have linked you to the admin files div).

by importing "wp-admin/menu.php' you should get the menu bar, but it would still not look as the actual admin area, so you would also need to import files like "wp-admin/admin-header.php" and more that you would like for getting all the functions of the admin area.

hope this helped you :)