Login with wp_dropdown_pages
-
Hello
I need to build website where different clients have access only to their personal pages. My idea is to use wp_dropdown_pages() as login. Basically each client (USER in WP) is named same as personal PAGE. I managed to make things work till the moment when I need to combine dropdown data with login form.
Does anyone know how to send data (page name) from dropdown to wp_login_form() as LOGIN and just type password in the box?
This is my code:// Add login form to menu
add_filter(‘wp_nav_menu_items’, ‘add_login_logout_link’, 10, 2);function add_login_logout_link($items, $args) {
// start buffering
ob_start();
// this is the actual form function
$login_args = array(
‘redirect’ => admin_url(),
‘form_id’ => ‘loginform-custom’,
‘label_username’ => __( ‘Username custom text’ ),
‘label_password’ => __( ‘Password custom text’ ),
‘label_remember’ => __( ‘Remember Me custom text’ ),
‘label_log_in’ => __( ‘Log In custom text’ ),
‘remember’ => false
);$dropdown_pages_args = array(
‘depth’ => 0,
‘child_of’ => 6,
‘selected’ => 0,
‘echo’ => 1,
‘name’ => ‘page_id’,
‘id’ => null, // string
‘class’ => null, // string
‘show_option_none’ => null, // string
‘show_option_no_change’ => null, // string
‘option_none_value’ => null, // string
);//Dropdown Pages
wp_dropdown_pages( $dropdown_pages_args );wp_login_form($login_args);
// get buffering
$loginoutform = ob_get_contents();
// clean buffering
ob_end_clean();
$items .= $loginoutform ; // concatenate buffering with items …
return $items;
}
- The topic ‘Login with wp_dropdown_pages’ is closed to new replies.