I'm building site based on wordpress for my client that requires album/gallery authentication. I've made custom plugin that stores galleries and images in custom tables in the database. Now i want to create a simple page for clients so they can sign in with gallery name and password to it and browse their galleries. I was thinking about making a page in wp admin and custom template for it and then handle authentication in there.
How would you do such authentication?
The basic approach is:
Read roles and capabilities in the Codex for details.
add_action('admin_menu', 'pluginprefix_admin_menu'); // 1
function pluginprefix_admin_menu() {
//2
$plugurl = plugin_dir_url( __FILE__ );
/*
add_menu_page( $page_title, $menu_title, $capability, $menu_slug,
$function, $icon_url, $position );
add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
$menu_slug, $function );
for example: */
add_menu_page( 'Statistikk', 'Statistikk', 'edit_plugins',
'pluginprefix_main', 'pluginprefix_page_main',
"$plugurl/img/stats-menu.png", 25);
add_submenu_page( 'pluginprefix_main', 'Statistikk - Instillinger',
'Instillinger', 'edit_plugins', 'pluginprefix_fields',
'pluginprefix_page_fields' );
function pluginprefix_page_main() {
// 3
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ));
}
include( MY_TEMPLATES . 'settings_page.tpl.php' );
}
I see. In that case;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.