Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

nugs on "Basic Concepts of WP Plugins"

$
0
0

Hi guys,

First i want to apologize for the post, it truly is my last resort. I have searched high and low and i suspect i am searching for the wrong information cause it seems to not exist. Here is my dilemma:

I have a web app fully built and functional. My task now is to build a matching WP Plugin with much of the same functionality as my app. This is my first plugin. I understand that there are hooks i have to tap into to perform certain actions, like building menus or rending pages within the admin area. I have progressed nicely, hooking into the menu actions and building out the navigation of our plugin. One particular concept of redirection to other app pages is what i am struggling with.

So my app has a typical account login section. You need to be logged in to access various features. Typically there would be account page that would redirect you to a login page if you are not logged in.

When i was building out the menu items i understand the concept of hooking into the 'admin_menu' hook and providing the function that will render the page:

add_action( 'admin_menu', 'teb_engine_main_menu' );

...

add_menu_page(
'tebBooking',
'tebBooking',
'manage_options',
'mainmenu_slug_0',
'render_teb_main_page',
$icon_url);

...

function render_teb_main_page() {
   if ( !current_user_can( 'manage_options' ) )  {
      wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
   }

   require('teb_main_page_wrapper.php');
}

But this scenario is different. From code i need to load the appropriate page for the plugin - either a login page or the account page if they are authenticated already.

Can someone please briefly explain to me that basic concept of redirecting to certain pages within a plugin that is NOT related to any menu items of the plugin. Perhaps some example code to show me how this works would be great.

At a minimum can you please tell me if i am chasing something that does not exist and my understanding of this is not correct?

TIA
Nugs


Viewing all articles
Browse latest Browse all 8245

Trending Articles