{"id":3389,"date":"2019-11-24T23:34:42","date_gmt":"2019-11-24T22:34:42","guid":{"rendered":"https:\/\/www.knowboard.de\/?p=3389"},"modified":"2019-12-02T21:47:51","modified_gmt":"2019-12-02T20:47:51","slug":"create-modal-login-with-toolset-and-total-theme","status":"publish","type":"post","link":"https:\/\/www.knowboard.de\/create-modal-login-with-toolset-and-total-theme\/","title":{"rendered":"Create a Modal Login Window with Toolset and Total Theme"},"content":{"rendered":"
I really like modal login windows and for most of my rather complex sites I am using the Toolset framework. Also, I am a big fan on the Total Theme Framework which I know very well. I am capable to create any kind of website just with that one single framework. And I use it as such. I don’t really use it as a theme. I just t\u00b4love the abilities and functionalities it provides.<\/p>\n\n\n\n
Toolset though is a perfect plugin collection if you want to have total control over the content, creation and editing forms and any kind of views. No matter if you are creating a membership site or a shop or whatever. Toolset is capable of creating anything.<\/p>\n\n\n\n
My solution requires several plugins that I use in most of my projects. If you don’t use one of them you still might be able to work it out. It is not too complex. Just replace the HTML and the shortcodes used.<\/p>\n\n\n\n
At first, you need to create a login form with Toolset. This is easy as there is a simple shortcode to do so. Just add the following code somewhere in your design. Best would be to place it just where you want to put the button. For instance in the top bar HTML section. The login form is rendered by using a simple Toolset shortcode Sometimes the logged in shortcode is present already in the child themes but most of the time the logged out one is not available. Also, usually they not coded in a way that you can nest other shortcodes inside. You also need to globally activate the lightbox script in your theme. You can do this in the Total Framework simply by adding this one lone of code to the functions.php file of your child theme. See the last line in the code block below. If you use the modal just on a single page you can load the scripts by using this total theme shortcode<\/a>: There are two ways to use the logout function. First option is to just place a hardcoded link simply linking to I really like modal login windows and for most of my rather complex sites I am using the Toolset framework. Also, I am a big fan on the Total Theme Framework which I know very well. I am capable to create any kind of website just with that one single framework. And I use it…<\/p>\n","protected":false},"author":1,"featured_media":3391,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[68,61],"tags":[],"class_list":["post-3389","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-toolset","category-total-theme","entry","has-media"],"_links":{"self":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/3389"}],"collection":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/comments?post=3389"}],"version-history":[{"count":5,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/3389\/revisions"}],"predecessor-version":[{"id":3406,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/3389\/revisions\/3406"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/media\/3391"}],"wp:attachment":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/media?parent=3389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/categories?post=3389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/tags?post=3389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}[wpv-login-form ]<\/code>. Nothing too fancy but you at least have some control over the available options<\/a> such as „remember me“ and the redirection url.<\/p>\n\n\n\n
<span class=\"wpex-inline\">\n\n\n\n\nJetzt einloggen oder kostenlos registrieren! \n<a href=\"#loginbox\" class=\"wpex-lightbox menu-button\" data-type=\"inline\" data-options=\"width:550,height:700\"><span class=\"fa fa-user\"><\/span>\u00a0Login<\/a>\n\n\n<\/span>\n\n<!-- HIDDEN LOGIN BOX-->\n\n<div id=\"loginbox\" class=\"modal-login\">\n\n<div class=\"entry\">\n[vc_row remove_bottom_col_margin=\"true\"]\n[vc_column]\n\n
Jetzt Einloggen<\/span><\/h2>\n[vc_column_text]\n[wpv-login-form allow_remember=\"true\" remember_default=\"true\"]\n[\/vc_column_text]\n<div style=\"font-size:13px;\" class=\"vcex-module vcex-bullets custom-icon\">\n<ul>\n<li><span class=\"vcex-icon-wrap\"><span class=\"vcex-icon fa fa-angle-right\"><\/span><\/span><div class=\"vcex-content\"><a href=\"\/passwort-vergessen\/\" target=\"_parent\">Passwort oder Login vergessen?<\/a><\/div><\/li>\n<li><span class=\"vcex-icon-wrap\"><span class=\"vcex-icon fa fa-angle-right\"><\/span><\/span><div class=\"vcex-content\"><a href=\"\/registrieren\" target=\"_parent\">Noch kein Mitglied? Jetzt registrieren!<\/a><\/div><\/li>\n<\/ul>\n<\/div>\n[\/vc_column]\n[\/vc_row]\n<\/div>\n\n<\/div><\/pre>\n\n\n\n
Add some CSS to your child themes style.css<\/h2>\n\n\n\n
.modal-login {\n\tbackground-color:#fff;\ndisplay:none;\n\tpadding:15px;\n\tmargin: 0 auto;\n\twidth: 280px;\n\tbox-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);\n}\n.modal-login #user_pass,\n.modal-login #user_login {\n\t width: 100%;\n}<\/pre>\n\n\n\n
Add some shortcodes and a filter to the functions.php<\/h2>\n\n\n\n
<\/code><\/p>\n\n\n\n
\/\/--------\n\/\/logged in shortcode\nfunction check_user ($params, $content = null){\n if ( is_user_logged_in() ){\n return do_shortcode($content);\n }\n else {\n return;\n }\n}\nadd_shortcode('loggedin', 'check_user' );\n\n\/\/--------\n\/\/logged in shortcode\nfunction check_user_out ($params, $content = null){\n if ( !is_user_logged_in() ){\n return do_shortcode($content);\n }\n else {\n return;\n }\n}\nadd_shortcode('loggedout', 'check_user_out' );\n\n\/\/--------\n\/\/globally load total theme lightbox script\nadd_filter( 'wpex_load_ilightbox_globally', '__return_true' );<\/pre>\n\n\n\n
Optional: Use non Toolset Logout function<\/h2>\n\n\n\n
\/wp-login.php?action=logout<\/code> and the second one would be to use the native Toolset logout function as I did in the example above. If you use the first one you need to also add the following „logout without confirmation“ function to your functions.php otherwise you will be asked if you want to proceed after clicking the logout link. Using the Toolset option you also have easy control over where to redirect after successful logging out<\/a>.<\/p>\n\n\n\n
\/\/NO LOGOUT CONFIRMATION\nadd_action('check_admin_referer', 'logout_without_confirm', 10, 2);\nfunction logout_without_confirm($action, $result) {\n\n if ($action == \"log-out\" && !isset($_GET['_wpnonce'])) {\n $redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : home_url();\n $location = str_replace('&', '&', wp_logout_url($redirect_to));\n header(\"Location: $location\");\n die;\n }\n}<\/pre>\n<\/div>","protected":false},"excerpt":{"rendered":"