Changeset 633652
- Timestamp:
- 12/03/2012 09:25:54 PM (13 years ago)
- Location:
- s8-custom-login-and-registration
- Files:
-
- 33 added
- 2 deleted
- 6 edited
- 13 copied
-
tags/0.8.3 (added)
-
tags/0.8.3/admin (copied) (copied from s8-custom-login-and-registration/trunk/admin)
-
tags/0.8.3/admin/settings.php (modified) (2 diffs)
-
tags/0.8.3/css (copied) (copied from s8-custom-login-and-registration/trunk/css)
-
tags/0.8.3/css/jquery-ui-1.9.0.custom.min.css (added)
-
tags/0.8.3/css/s8-login-admin.css (copied) (copied from s8-custom-login-and-registration/trunk/css/s8-login-admin.css)
-
tags/0.8.3/css/s8-login-basic-styles.css (copied) (copied from s8-custom-login-and-registration/trunk/css/s8-login-basic-styles.css)
-
tags/0.8.3/images (added)
-
tags/0.8.3/images/ui-bg_flat_0_aaaaaa_40x100.png (added)
-
tags/0.8.3/images/ui-bg_flat_75_ffffff_40x100.png (added)
-
tags/0.8.3/images/ui-bg_glass_55_fbf9ee_1x400.png (added)
-
tags/0.8.3/images/ui-bg_glass_65_ffffff_1x400.png (added)
-
tags/0.8.3/images/ui-bg_glass_75_dadada_1x400.png (added)
-
tags/0.8.3/images/ui-bg_glass_75_e6e6e6_1x400.png (added)
-
tags/0.8.3/images/ui-bg_glass_95_fef1ec_1x400.png (added)
-
tags/0.8.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png (added)
-
tags/0.8.3/images/ui-icons_222222_256x240.png (added)
-
tags/0.8.3/images/ui-icons_2e83ff_256x240.png (added)
-
tags/0.8.3/images/ui-icons_454545_256x240.png (added)
-
tags/0.8.3/images/ui-icons_888888_256x240.png (added)
-
tags/0.8.3/images/ui-icons_cd0a0a_256x240.png (added)
-
tags/0.8.3/inc (copied) (copied from s8-custom-login-and-registration/trunk/inc)
-
tags/0.8.3/inc/forms.php (copied) (copied from s8-custom-login-and-registration/trunk/inc/forms.php) (4 diffs)
-
tags/0.8.3/inc/functions.php (copied) (copied from s8-custom-login-and-registration/trunk/inc/functions.php) (1 diff)
-
tags/0.8.3/inc/login.php (deleted)
-
tags/0.8.3/inc/register.php (deleted)
-
tags/0.8.3/inc/s8-login-widget.php (copied) (copied from s8-custom-login-and-registration/trunk/inc/s8-login-widget.php)
-
tags/0.8.3/js (copied) (copied from s8-custom-login-and-registration/trunk/js)
-
tags/0.8.3/js/s8-login-admin.js (added)
-
tags/0.8.3/readme.txt (copied) (copied from s8-custom-login-and-registration/trunk/readme.txt) (4 diffs)
-
tags/0.8.3/s8-login-registration.php (copied) (copied from s8-custom-login-and-registration/trunk/s8-login-registration.php) (15 diffs)
-
tags/0.8.3/screenshot-1.png (copied) (copied from s8-custom-login-and-registration/trunk/screenshot-1.png)
-
tags/0.8.3/screenshot-2.png (copied) (copied from s8-custom-login-and-registration/trunk/screenshot-2.png)
-
trunk/admin/settings.php (modified) (2 diffs)
-
trunk/css/jquery-ui-1.9.0.custom.min.css (added)
-
trunk/images (added)
-
trunk/images/ui-bg_flat_0_aaaaaa_40x100.png (added)
-
trunk/images/ui-bg_flat_75_ffffff_40x100.png (added)
-
trunk/images/ui-bg_glass_55_fbf9ee_1x400.png (added)
-
trunk/images/ui-bg_glass_65_ffffff_1x400.png (added)
-
trunk/images/ui-bg_glass_75_dadada_1x400.png (added)
-
trunk/images/ui-bg_glass_75_e6e6e6_1x400.png (added)
-
trunk/images/ui-bg_glass_95_fef1ec_1x400.png (added)
-
trunk/images/ui-bg_highlight-soft_75_cccccc_1x100.png (added)
-
trunk/images/ui-icons_222222_256x240.png (added)
-
trunk/images/ui-icons_2e83ff_256x240.png (added)
-
trunk/images/ui-icons_454545_256x240.png (added)
-
trunk/images/ui-icons_888888_256x240.png (added)
-
trunk/images/ui-icons_cd0a0a_256x240.png (added)
-
trunk/inc/forms.php (modified) (4 diffs)
-
trunk/inc/functions.php (modified) (1 diff)
-
trunk/js/s8-login-admin.js (added)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/s8-login-registration.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
s8-custom-login-and-registration/tags/0.8.3/admin/settings.php
r609859 r633652 17 17 else 18 18 delete_option('s8_custom_login_form_template'); 19 if($_POST['use_wp_register'] == 'yes') 20 update_option('s8_allow_wp_register', true); 21 else 22 update_option('s8_allow_wp_register', false); 23 if(!empty($_POST['add_url'])) { 24 $redirects = get_option('s8_login_redirects'); 25 $redirects[strip_tags(trim($_POST['add_role']))] = addslashes(strip_tags(trim($_POST['add_url']))); 26 update_option('s8_login_redirects', $redirects); 27 } 28 if($_POST['delete_login_redirect'] && is_array($_POST['delete_login_redirect'])) { 29 $redirects = get_option('s8_login_redirects'); 30 foreach($_POST['delete_login_redirect'] as $redirect) { 31 unset($redirects[$redirect]); 32 } 33 update_option('s8_login_redirects', $redirects); 34 } 19 35 } 20 36 $page_templates = array('s8-login.php', 'post.php', 'page.php', 'index.php'); 21 37 $child_theme = get_stylesheet_directory(); 22 38 $parent_theme = get_template_directory(); 39 $redirects = get_option('s8_login_redirects'); 23 40 if($child_theme == $parent_theme) { 24 41 // Same theme! … … 37 54 $form_text = get_option('s8_custom_login_form_text'); 38 55 $template = get_option('s8_custom_login_form_template'); 56 $allow_wp_register = get_option('s8_allow_wp_register'); 39 57 if(!$form_text || !is_array($form_text)) 40 58 $form_text = array(); 59 60 $checked = ' checked="checked"'; 41 61 ?><div class="wrap s8-login-settings"> 42 62 <div id="icon-options-general" class="icon32"></div><h2>Sideways8 Custom Login and Registration Settings</h2> 43 63 <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> 44 <p> 45 <label for="page-template"><? _e('Template for form pages'); ?></label> 46 <select name="page-template" id="page-template"> 47 <option value="0">-- Use default --</option> 48 <?php foreach($page_templates as $temp_file) { 49 ?><option value="<?php echo $temp_file; ?>"<?php echo($temp_file == $template)?' selected="selected"':''; ?>><?php echo $temp_file; ?></option><?php 50 } ?> 51 <?php page_template_dropdown($template); ?> 52 </select><br/> 53 </p> 54 <p> 55 You can customize the content of the login, registration, forgot password, and reset password pages by using the following boxes.<br/> 56 You can include any of the following tags to customize the content of the page:<br/> 57 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 58 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 59 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 60 %LOGIN_URL% = URL of the login page<br/> 61 %LOGIN_LINK% = Link to the login page<br/> 62 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 63 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 64 </p> 65 <h3>Login page text</h3> 66 <p> 67 Shown when a user is logging in. 68 </p> 69 <?php wp_editor(stripslashes($form_text['login']), 's8-login', array('textarea_name' => 's8_custom_login_form_text[login]')); ?> 70 <p> 71 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 72 </p> 64 <div id="tabs"> 65 <ul> 66 <li><a href="#tabs-1"><?php _e('General Options'); ?></a></li> 67 <li><a href="#tabs-2"><?php _e('Login Page Options'); ?></a></li> 68 <li><a href="#tabs-3"><?php _e('Register Page Options'); ?></a></li> 69 <li><a href="#tabs-4"><?php _e('Forgot Password Page Options'); ?></a></li> 70 <li><a href="#tabs-5"><?php _e('Reset Password Page Options'); ?></a></li> 71 <li><a href="#tabs-6"><?php _e('User Redirect Options'); ?></a></li> 72 </ul> 73 <div class="tabs-spacer"></div> 74 <div id="tabs-1"> 75 <p> 76 <label for="page-template"><? _e('Page layout template for form pages:'); ?></label><br/> 77 <select name="page-template" id="page-template"> 78 <option value="0">-- Use default --</option> 79 <?php foreach($page_templates as $temp_file) { 80 ?><option value="<?php echo $temp_file; ?>"<?php echo($temp_file == $template)?' selected="selected"':''; ?>><?php echo $temp_file; ?></option><?php 81 } ?> 82 <?php page_template_dropdown($template); ?> 83 </select><br/> 84 </p> 85 <p> 86 <input type="checkbox" name="use_wp_register" id="use_wp_register" value="yes"<?php echo ($allow_wp_register)?$checked:''; ?> /> <label for="use_wp_register">Use the WordPress registration form and link</label> 87 </p> 88 <p> 89 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 90 </p> 91 </div> 92 <div id="tabs-6"> 93 <h3><?php _e('On login redirects'); ?></h3> 94 <p> 95 These redirects will be FORCED meaning they will always take effect on each login (based on user role). 96 </p> 97 <table> 98 <thead> 99 <tr><th>Delete?</th><th>Role</th><th>URL</th></tr> 100 </thead> 101 <tbody> 102 <?php 103 if($redirects && is_array($redirects) && count($redirects) > 0) { 104 global $wp_roles; 105 foreach($redirects as $role_name=>$url) { 106 if(isset($wp_roles->roles[$role_name]['name'])) $name = $wp_roles->roles[$role_name]['name']; 107 else $name = ucwords($role_name); 108 echo '<tr><td><input type="checkbox" name="delete_login_redirect[]" value="'.$role_name.'" /></td><td>'.$name.'</td><td>'.$url.'</td></tr>'; 109 } 110 } 111 else 112 echo '<tr><td>No redirects yet!</td></tr>'; 113 ?> 114 </tbody> 115 </table> 116 <p> 117 <label for="add_role"><b>Add new redirect</b> (Note: selecting a role that already has a redirect will OVERWRITE the existing redirect)</label><br/> 118 <select name="add_role" for="add_role"> 119 <?php wp_dropdown_roles(); ?> 120 </select><br/> 121 <label for="add_url">URL:</label> <input type="text" name="add_url" id="add_url" /> 122 </p> 73 123 74 <h3>Registration page text</h3> 75 <p> 76 Shown when a user is registering for the site. 77 </p> 78 <?php wp_editor(stripslashes($form_text['register']), 's8-register', array('textarea_name' => 's8_custom_login_form_text[register]')); ?> 79 <p> 80 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 81 </p> 82 83 <h3>Forgot password page text</h3> 84 <p> 85 Shown when a user is requesting a password reset (the form sends them an email). 86 </p> 87 <?php wp_editor(stripslashes($form_text['forgot']), 's8-forgot', array('textarea_name' => 's8_custom_login_form_text[forgot]')); ?> 88 <p> 89 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 90 </p> 91 92 <h3>Reset password page text</h3> 93 <p> 94 Shown when the user is resetting their password. 95 </p> 96 <?php wp_editor(stripslashes($form_text['reset']), 's8-reset', array('textarea_name' => 's8_custom_login_form_text[reset]')); ?> 97 <p> 98 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 99 </p> 124 <?php /*<h3><?php _e('On logout redirects'); ?></h3> */ ?> 125 <p> 126 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 127 </p> 128 </div> 129 <div id="tabs-2"> 130 <h3>Login page text</h3> 131 <p> 132 Shown when a user is logging in. 133 </p> 134 <?php wp_editor(stripslashes($form_text['login']), 's8-login', array('textarea_name' => 's8_custom_login_form_text[login]')); ?> 135 <p> 136 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 137 </p> 138 <p> 139 You can include any of the following tags to customize the content of the page:<br/> 140 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 141 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 142 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 143 %LOGIN_URL% = URL of the login page<br/> 144 %LOGIN_LINK% = Link to the login page<br/> 145 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 146 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 147 </p> 148 </div> 149 <div id="tabs-3"> 150 <h3>Registration page text</h3> 151 <p> 152 Shown when a user is registering for the site. 153 </p> 154 <?php wp_editor(stripslashes($form_text['register']), 's8-register', array('textarea_name' => 's8_custom_login_form_text[register]')); ?> 155 <p> 156 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 157 </p> 158 <p> 159 You can include any of the following tags to customize the content of the page:<br/> 160 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 161 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 162 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 163 %LOGIN_URL% = URL of the login page<br/> 164 %LOGIN_LINK% = Link to the login page<br/> 165 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 166 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 167 </p> 168 </div> 169 <div id="tabs-4"> 170 <h3>Forgot password page text</h3> 171 <p> 172 Shown when a user is requesting a password reset (the form sends them an email). 173 </p> 174 <?php wp_editor(stripslashes($form_text['forgot']), 's8-forgot', array('textarea_name' => 's8_custom_login_form_text[forgot]')); ?> 175 <p> 176 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 177 </p> 178 <p> 179 You can include any of the following tags to customize the content of the page:<br/> 180 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 181 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 182 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 183 %LOGIN_URL% = URL of the login page<br/> 184 %LOGIN_LINK% = Link to the login page<br/> 185 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 186 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 187 </p> 188 </div> 189 <div id="tabs-5"> 190 <h3>Reset password page text</h3> 191 <p> 192 Shown when the user is resetting their password. 193 </p> 194 <?php wp_editor(stripslashes($form_text['reset']), 's8-reset', array('textarea_name' => 's8_custom_login_form_text[reset]')); ?> 195 <p> 196 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 197 </p> 198 <p> 199 You can include any of the following tags to customize the content of the page:<br/> 200 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 201 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 202 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 203 %LOGIN_URL% = URL of the login page<br/> 204 %LOGIN_LINK% = Link to the login page<br/> 205 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 206 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 207 </p> 208 </div> 209 </div> 100 210 </form> 101 211 </div> -
s8-custom-login-and-registration/tags/0.8.3/inc/forms.php
r609859 r633652 16 16 case 'register': // Register user 17 17 $redirect_url = ($_GET['redirect'] != '')?$_GET['redirect']:home_url(); 18 ?><form method="post" action="<?php echo s8_get_register_url($redirect_url); ?>" name="register" >18 ?><form method="post" action="<?php echo s8_get_register_url($redirect_url); ?>" name="register" class="s8_form register_form"> 19 19 <?php 20 20 if(is_wp_error($errors)) { … … 43 43 break; 44 44 case 'reset': // Password reset 45 ?><form name="pass-reset" action="<?php echo home_url('/'.s8_login_registration::ep_login.'/?action=rp&key='.$_GET['key']); ?>" method="post" >45 ?><form name="pass-reset" action="<?php echo home_url('/'.s8_login_registration::ep_login.'/?action=rp&key='.$_GET['key']); ?>" method="post" class="s8_form reset_form"> 46 46 <?php 47 47 if(is_wp_error($errors)) { … … 64 64 break; 65 65 case 'forgot': // Forgot password 66 ?><form name="forgot" action="<?php echo s8_get_forgot_password_url(); ?>" method="post" >66 ?><form name="forgot" action="<?php echo s8_get_forgot_password_url(); ?>" method="post" class="s8_form forgot_form"> 67 67 <?php 68 68 if(is_wp_error($errors)) { … … 90 90 if(isset($wp_query->query_vars[s8_login_registration::ep_login]) && s8_get_current_url() == $redirect_url) 91 91 $redirect_url = home_url(); 92 ?><form action="<?php echo s8_get_login_url($redirect_url); ?>" name="login" method="post" >92 ?><form action="<?php echo s8_get_login_url($redirect_url); ?>" name="login" method="post" class="s8_form login_form"> 93 93 <?php 94 94 if(is_wp_error($errors)) { -
s8-custom-login-and-registration/tags/0.8.3/inc/functions.php
r612857 r633652 43 43 if($redirect_url === false) $formatted_redirect_url = '&redirect='.urlencode(home_url('/')); 44 44 if($redirect_url === true) $formatted_redirect_url = ''; 45 $check = get_option('s8_allow_wp_register'); 46 if($check) return site_url('/wp-login.php?action=register'); 45 47 return home_url('/'.s8_login_registration::ep_login. 46 48 '/?action=register'.($formatted_redirect_url?$formatted_redirect_url:'')); -
s8-custom-login-and-registration/tags/0.8.3/readme.txt
r612857 r633652 3 3 Tags: custom login, login, registration, form, login widget, widget 4 4 Requires at least: 3.3 5 Tested up to: 3. 4.26 Stable tag: 0.8. 25 Tested up to: 3.5 6 Stable tag: 0.8.3 7 7 License: GPLv3 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html 9 9 10 Easily change the way the WP login is seen by your users. This allows you to "hide" the wp-login url.10 Hides the WP login page, allows you to "embed" login in a page, and allows customization on how the login page looks. 11 11 12 12 == Description == 13 13 The way your site is presented to your users is important. That is why we made the "Custom Login and Registration" plugin. It is designed so that both you and your users never see the built-in WP login, registration, and password reset forms. It is still compatible with all of WordPress' built-in functionality and logout links will still function as they should. A login form widget is included to make it easy for your non-logged in visitors to find the login form. You are even able to add content to the login, registration, forgot password and password reset pages through the settings page. 14 15 If you want to add a form to a page on your site, you can use the new shortcodes: `[s8-login-form]`, `[s8-registration-form]`, and `[s8-forgot-form]`. 14 16 15 17 = Support/Help = … … 25 27 Despite our best attempts, it is possible that a WordPress update or another plugin may cause an issue with our plugin and you will be unable to login. To get around this use the following URL: http://yourDomainName.com/wp-login.php?no-redirect=true 26 28 NOTE: Replace yourDomainName.com with your domain name. If your WordPress install is in a subdirectory (e.g. yourDomainName.com/folder/wp-login.php) then adjust the URL as needed. 29 30 = How do I use the shortcode and what is it? = 31 A shortcode is an easy and accessible way for any site owner to add custom functionality to their site. In this case it allows you to put our login, registration, and forgot password forms on ANY page of your site. 32 33 To use it simply place one of the following shortcodes where you want the form to appear: 34 Login: `[s8-login-form]` 35 Registration: `[s8-registration-form]` 36 Forgot password: `[s8-forgot-form]` 37 38 You can also add the option 'hide_links' to your shortcode to hide the links to the other forms. 39 `[s8-login-form hide_links="forgot,register"]` 40 The above will, for example, hide the links to the forgot password and registration forms. You can also use 'login' as an option. 27 41 28 42 = How can I change the CSS on the login/register/forgot/reset password pages? = … … 40 54 41 55 == Upgrade Notice == 56 = 0.8.3 = 57 Added shortcodes and the ability to redirect users when they login based on role. 42 58 = 0.8.2 = 43 59 Added widget options for when the user is logged in. … … 48 64 49 65 == Changelog == 66 = 0.8.3 = 67 * Added shortcodes for use anywhere on the site. 68 * Added new CSS classes to the forms for easy styling (form tag is the wrapper for content inserted using the shortcode) 69 * Cleaned up the admin settings page 70 * Added option to use WordPress registration form 71 * Fixed a bug when going to our registration form 72 * Added basic login redirect support to redirect users to specific URLs on login 50 73 = 0.8.2 = 51 74 * Can now specify if a logout link should show in the widget -
s8-custom-login-and-registration/tags/0.8.3/s8-login-registration.php
r612857 r633652 5 5 * Description: The way your site is presented to your users is important. That is why we made the "Custom Login and Registration" plugin. It is designed so that both you and your users never see the built-in WP login, registration, and password reset forms. It is still compatible with all of WordPress' built-in functionality and logout links will still function as they should. It also comes with a login form widget to make it easy for your non-logged in visitors to find the login form. 6 6 * Tags: custom login, login, registration, form, login widget, widget 7 * Version: 0.8. 27 * Version: 0.8.3 8 8 * Author: Sideways8 Interactive 9 9 * Author URI: http://sideways8.com/ … … 26 26 class s8_login_registration { 27 27 const ep_login = 'login'; 28 private $version = '0.8. 1',28 private $version = '0.8.3', 29 29 $title = '404 Not Found', 30 30 $content = 'Sorry, what you are looking for could not be found!'; … … 53 53 add_filter('login_url', array($this, 'login_url'), 10, 2); 54 54 add_filter('lostpassword_url', array($this, 'forgotpassword_url'), 10, 2); 55 // Add our (as of v0.8.1) internal shortcode 56 add_shortcode('login-form', array($this, 'form_shortcode')); 55 // Add our shortcodes 56 add_shortcode('s8-login-form', array($this, 'login_shortcode')); 57 add_shortcode('s8-registration-form', array($this, 'registration_shortcode')); 58 add_shortcode('s8-forgot-form', array($this, 'forgot_shortcode')); 59 add_shortcode('s8-reset-form', array($this, 'reset_shortcode')); // This is intended for internal use ONLY 57 60 //add_filter('register', array($this, 'register_url')); 58 61 // Add our admin stuff … … 94 97 } 95 98 $this->title = __('Register'); 96 $this->content = '[ login-form action="register" page="true"]';99 $this->content = '[s8-registration-form s8_internal="true"]'; 97 100 //$this->display_template('register'); 98 101 break; … … 103 106 } 104 107 $this->title = __('Reset Password'); 105 $this->content = '[ login-form action="reset" page="true"]';108 $this->content = '[s8-reset-form action="reset" s8_internal="true"]'; 106 109 //$this->display_template('login'); 107 110 break; … … 112 115 } 113 116 $this->title = __('Forgot Password'); 114 $this->content = '[ login-form action="forgot" page="true"]';117 $this->content = '[s8-forgot-form s8_internal="true"]'; 115 118 //$this->display_template('login'); 116 119 break; … … 122 125 // Do our stuff 123 126 $this->title = __('Login'); 124 $this->content = '[ login-form page="true"]';127 $this->content = '[s8-login-form s8_internal="true"]'; 125 128 //$this->display_template('login'); 126 129 } … … 273 276 wp_set_auth_cookie($user->ID, $remember); 274 277 do_action('wp_login', $username); 275 if($_POST['redirect'] != '') $url = $_POST['redirect']; 278 // Check for custom redirect 279 global $current_user; 280 $redirects = get_option('s8_login_redirects'); 281 $role = $current_user->roles; 282 if(is_array($role)) $role = $role[0]; 283 // Do our redirect! 284 if(isset($redirects[$role])) $url = $redirects[$role]; 285 elseif($_POST['redirect'] != '') $url = $_POST['redirect']; 276 286 else $url = home_url('/'); 277 287 wp_redirect($url, 302); … … 288 298 function no_wp_login() { 289 299 if(defined('S8_LOGIN_INIT') && S8_LOGIN_INIT === true) return; 300 $check = get_option('s8_allow_wp_register'); 301 if($check && $_REQUEST['action'] == 'register') return; 290 302 if($_GET['no-redirect'] == 'true') { 291 303 wp_enqueue_script('s8-login-failsafe', plugins_url('/js/s8-login-failsafe.js', S8_LOGIN_FILE), array('jquery')); … … 296 308 if($_GET['action'] == 'logout') 297 309 wp_redirect(s8_get_logout_url($url)); 310 elseif($_GET['action'] == 'register') 311 wp_redirect(s8_get_register_url($url)); 298 312 else 299 313 wp_redirect(s8_get_login_url($url)); … … 346 360 347 361 /** 348 * Logic for shortcode to show the various forms362 * Logic for shortcode to show the login form 349 363 * @since 0.8.1 350 364 * @param $atts 351 */ 352 function form_shortcode($atts) { 353 $page = $action = ''; 354 extract(shortcode_atts(array('page' => 'false', 'action' => 'login'), $atts)); 355 if($page == 'true') { 365 * @return bool|string Should only ever return a string when on a page not generated by us/widget 366 */ 367 function login_shortcode($atts) { 368 $s8_internal = $hide_links = ''; 369 extract(shortcode_atts(array('s8_internal' => 'false', 'hide_links' => ''), $atts)); 370 $action = 'login'; 371 if($s8_internal == 'true') { 372 $args = array('forgot' => false, 'register' => false, 'login' => false); 373 $form_text = get_option('s8_custom_login_form_text'); 374 if(!is_array($form_text)) $form_text = array(); 375 if($form_text[$action]) { 376 if(strpos($form_text[$action], '%FORM%') !== false) { 377 $output = explode('%FORM%', $this->prepare_content($form_text[$action]), 2); 378 echo ($output[0])?$output[0]:''; 379 s8_clr_get_form($action, $args); 380 echo ($output[1])?$output[1]:''; 381 } 382 else { 383 echo $this->prepare_content($form_text[$action]); 384 s8_clr_get_form($action, $args); 385 } 386 return ''; 387 } 388 } 389 $tmp = array(); 390 if(!empty($hide_links)) { 391 // Hide our links! 392 $hide = explode(',', $hide_links); 393 foreach($hide as $link) { 394 $link = strtolower(trim($link)); 395 if($link == 'login') $tmp['login'] = false; 396 elseif($link == 'register') $tmp['register'] = false; 397 elseif($link == 'forgot') $tmp['forgot'] = false; 398 } 399 } 400 $args = array_merge(array('forgot' => true, 'register' => true, 'login' => true), $tmp); 401 ob_start(); 402 s8_clr_get_form($action, $args); 403 return ob_get_clean(); 404 } 405 406 /** 407 * Logic for shortcode to show the register form 408 * @since 0.8.3 409 * @param $atts 410 * @return bool|string Should only ever return a string when on a page not generated by us/widget 411 */ 412 function registration_shortcode($atts) { 413 $s8_internal = $hide_links = ''; 414 extract(shortcode_atts(array('s8_internal' => 'false', 'hide_links' => ''), $atts)); 415 $action = 'register'; 416 if($s8_internal == 'true') { 356 417 $args = array('forgot' => false, 'register' => false, 'login' => false); 357 418 $form_text = get_option('s8_custom_login_form_text'); … … 368 429 s8_clr_get_form($action, $args); 369 430 } 370 return; 371 } 372 } 373 $args = array('forgot' => true, 'register' => true, 'login' => true); 431 return true; 432 } 433 } 434 $tmp = array(); 435 if(!empty($hide_links)) { 436 // Hide our links! 437 $hide = explode(',', $hide_links); 438 foreach($hide as $link) { 439 $link = strtolower(trim($link)); 440 if($link == 'login') $tmp['login'] = false; 441 elseif($link == 'register') $tmp['register'] = false; 442 elseif($link == 'forgot') $tmp['forgot'] = false; 443 } 444 } 445 $args = array_merge(array('forgot' => true, 'register' => true, 'login' => true), $tmp); 446 ob_start(); 374 447 s8_clr_get_form($action, $args); 448 return ob_get_clean(); 449 } 450 451 /** 452 * Logic for shortcode to show the forgot form 453 * @since 0.8.3 454 * @param $atts 455 * @return bool|string Should only ever return a string when on a page not generated by us/widget 456 */ 457 function forgot_shortcode($atts) { 458 $s8_internal = $hide_links = ''; 459 extract(shortcode_atts(array('s8_internal' => 'false', 'hide_links' => ''), $atts)); 460 $action = 'forgot'; 461 if($s8_internal == 'true') { 462 $args = array('forgot' => false, 'register' => false, 'login' => false); 463 $form_text = get_option('s8_custom_login_form_text'); 464 if(!is_array($form_text)) $form_text = array(); 465 if($form_text[$action]) { 466 if(strpos($form_text[$action], '%FORM%') !== false) { 467 $output = explode('%FORM%', $this->prepare_content($form_text[$action]), 2); 468 echo $output[0]; 469 s8_clr_get_form($action, $args); 470 echo $output[1]; 471 } 472 else { 473 echo $this->prepare_content($form_text[$action]); 474 s8_clr_get_form($action, $args); 475 } 476 return true; 477 } 478 } 479 $tmp = array(); 480 if(!empty($hide_links)) { 481 // Hide our links! 482 $hide = explode(',', $hide_links); 483 foreach($hide as $link) { 484 $link = strtolower(trim($link)); 485 if($link == 'login') $tmp['login'] = false; 486 elseif($link == 'register') $tmp['register'] = false; 487 elseif($link == 'forgot') $tmp['forgot'] = false; 488 } 489 } 490 $args = array_merge(array('forgot' => true, 'register' => true, 'login' => true), $tmp); 491 ob_start(); 492 s8_clr_get_form($action, $args); 493 return ob_get_clean(); 494 } 495 496 /** 497 * Logic for shortcode to show the forgot form 498 * @since 0.8.3 499 * @param $atts 500 * @return bool|string Should only ever return a string when on a page not generated by us/widget 501 */ 502 function reset_shortcode($atts) { 503 $s8_internal = $hide_links = ''; 504 extract(shortcode_atts(array('s8_internal' => 'false', 'hide_links' => ''), $atts)); 505 $action = 'reset'; 506 if($s8_internal == 'true') { 507 $args = array('forgot' => false, 'register' => false, 'login' => false); 508 $form_text = get_option('s8_custom_login_form_text'); 509 if(!is_array($form_text)) $form_text = array(); 510 if($form_text[$action]) { 511 if(strpos($form_text[$action], '%FORM%') !== false) { 512 $output = explode('%FORM%', $this->prepare_content($form_text[$action]), 2); 513 echo $output[0]; 514 s8_clr_get_form($action, $args); 515 echo $output[1]; 516 } 517 else { 518 echo $this->prepare_content($form_text[$action]); 519 s8_clr_get_form($action, $args); 520 } 521 return true; 522 } 523 } 524 return false; 375 525 } 376 526 … … 392 542 $tmp['REGISTER_LINK'] = s8_get_register_link(true); 393 543 } 394 foreach($tmp as $tag=>$value) {395 $content = str_replace('%'.$tag.'%', $value, $content);396 }397 544 $content = stripslashes($content); 398 545 $content = force_balance_tags($content); 399 546 $content = apply_filters('the_content', $content); 400 547 $content = str_replace(']]>', ']]>', $content); 548 foreach($tmp as $tag=>$value) { 549 $content = str_replace('%'.$tag.'%', $value, $content); 550 } 401 551 return $content; 402 552 } … … 426 576 function forgotpassword_url($url, $redirect) { 427 577 $url = s8_get_forgot_password_url(); 428 return $url;429 }430 431 /**432 * Filter the default register URL to our register URL433 * @since 0.8.0434 */435 function register_url($url) {436 $url = s8_get_register_url();437 578 return $url; 438 579 } … … 464 605 if(is_admin()) 465 606 wp_enqueue_style('s8-login-styles', plugins_url('/css/s8-login-admin.css', S8_LOGIN_FILE)); 607 wp_enqueue_style('s8-login-tabs.jquery', plugins_url('/css/jquery-ui-1.9.0.custom.min.css', S8_LOGIN_FILE)); 608 wp_enqueue_script('s8-login-admin', plugins_url('/js/s8-login-admin.js', S8_LOGIN_FILE), array('jquery', 'jquery-ui-tabs')); 466 609 } 467 610 -
s8-custom-login-and-registration/trunk/admin/settings.php
r609859 r633652 17 17 else 18 18 delete_option('s8_custom_login_form_template'); 19 if($_POST['use_wp_register'] == 'yes') 20 update_option('s8_allow_wp_register', true); 21 else 22 update_option('s8_allow_wp_register', false); 23 if(!empty($_POST['add_url'])) { 24 $redirects = get_option('s8_login_redirects'); 25 $redirects[strip_tags(trim($_POST['add_role']))] = addslashes(strip_tags(trim($_POST['add_url']))); 26 update_option('s8_login_redirects', $redirects); 27 } 28 if($_POST['delete_login_redirect'] && is_array($_POST['delete_login_redirect'])) { 29 $redirects = get_option('s8_login_redirects'); 30 foreach($_POST['delete_login_redirect'] as $redirect) { 31 unset($redirects[$redirect]); 32 } 33 update_option('s8_login_redirects', $redirects); 34 } 19 35 } 20 36 $page_templates = array('s8-login.php', 'post.php', 'page.php', 'index.php'); 21 37 $child_theme = get_stylesheet_directory(); 22 38 $parent_theme = get_template_directory(); 39 $redirects = get_option('s8_login_redirects'); 23 40 if($child_theme == $parent_theme) { 24 41 // Same theme! … … 37 54 $form_text = get_option('s8_custom_login_form_text'); 38 55 $template = get_option('s8_custom_login_form_template'); 56 $allow_wp_register = get_option('s8_allow_wp_register'); 39 57 if(!$form_text || !is_array($form_text)) 40 58 $form_text = array(); 59 60 $checked = ' checked="checked"'; 41 61 ?><div class="wrap s8-login-settings"> 42 62 <div id="icon-options-general" class="icon32"></div><h2>Sideways8 Custom Login and Registration Settings</h2> 43 63 <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> 44 <p> 45 <label for="page-template"><? _e('Template for form pages'); ?></label> 46 <select name="page-template" id="page-template"> 47 <option value="0">-- Use default --</option> 48 <?php foreach($page_templates as $temp_file) { 49 ?><option value="<?php echo $temp_file; ?>"<?php echo($temp_file == $template)?' selected="selected"':''; ?>><?php echo $temp_file; ?></option><?php 50 } ?> 51 <?php page_template_dropdown($template); ?> 52 </select><br/> 53 </p> 54 <p> 55 You can customize the content of the login, registration, forgot password, and reset password pages by using the following boxes.<br/> 56 You can include any of the following tags to customize the content of the page:<br/> 57 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 58 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 59 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 60 %LOGIN_URL% = URL of the login page<br/> 61 %LOGIN_LINK% = Link to the login page<br/> 62 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 63 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 64 </p> 65 <h3>Login page text</h3> 66 <p> 67 Shown when a user is logging in. 68 </p> 69 <?php wp_editor(stripslashes($form_text['login']), 's8-login', array('textarea_name' => 's8_custom_login_form_text[login]')); ?> 70 <p> 71 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 72 </p> 64 <div id="tabs"> 65 <ul> 66 <li><a href="#tabs-1"><?php _e('General Options'); ?></a></li> 67 <li><a href="#tabs-2"><?php _e('Login Page Options'); ?></a></li> 68 <li><a href="#tabs-3"><?php _e('Register Page Options'); ?></a></li> 69 <li><a href="#tabs-4"><?php _e('Forgot Password Page Options'); ?></a></li> 70 <li><a href="#tabs-5"><?php _e('Reset Password Page Options'); ?></a></li> 71 <li><a href="#tabs-6"><?php _e('User Redirect Options'); ?></a></li> 72 </ul> 73 <div class="tabs-spacer"></div> 74 <div id="tabs-1"> 75 <p> 76 <label for="page-template"><? _e('Page layout template for form pages:'); ?></label><br/> 77 <select name="page-template" id="page-template"> 78 <option value="0">-- Use default --</option> 79 <?php foreach($page_templates as $temp_file) { 80 ?><option value="<?php echo $temp_file; ?>"<?php echo($temp_file == $template)?' selected="selected"':''; ?>><?php echo $temp_file; ?></option><?php 81 } ?> 82 <?php page_template_dropdown($template); ?> 83 </select><br/> 84 </p> 85 <p> 86 <input type="checkbox" name="use_wp_register" id="use_wp_register" value="yes"<?php echo ($allow_wp_register)?$checked:''; ?> /> <label for="use_wp_register">Use the WordPress registration form and link</label> 87 </p> 88 <p> 89 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 90 </p> 91 </div> 92 <div id="tabs-6"> 93 <h3><?php _e('On login redirects'); ?></h3> 94 <p> 95 These redirects will be FORCED meaning they will always take effect on each login (based on user role). 96 </p> 97 <table> 98 <thead> 99 <tr><th>Delete?</th><th>Role</th><th>URL</th></tr> 100 </thead> 101 <tbody> 102 <?php 103 if($redirects && is_array($redirects) && count($redirects) > 0) { 104 global $wp_roles; 105 foreach($redirects as $role_name=>$url) { 106 if(isset($wp_roles->roles[$role_name]['name'])) $name = $wp_roles->roles[$role_name]['name']; 107 else $name = ucwords($role_name); 108 echo '<tr><td><input type="checkbox" name="delete_login_redirect[]" value="'.$role_name.'" /></td><td>'.$name.'</td><td>'.$url.'</td></tr>'; 109 } 110 } 111 else 112 echo '<tr><td>No redirects yet!</td></tr>'; 113 ?> 114 </tbody> 115 </table> 116 <p> 117 <label for="add_role"><b>Add new redirect</b> (Note: selecting a role that already has a redirect will OVERWRITE the existing redirect)</label><br/> 118 <select name="add_role" for="add_role"> 119 <?php wp_dropdown_roles(); ?> 120 </select><br/> 121 <label for="add_url">URL:</label> <input type="text" name="add_url" id="add_url" /> 122 </p> 73 123 74 <h3>Registration page text</h3> 75 <p> 76 Shown when a user is registering for the site. 77 </p> 78 <?php wp_editor(stripslashes($form_text['register']), 's8-register', array('textarea_name' => 's8_custom_login_form_text[register]')); ?> 79 <p> 80 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 81 </p> 82 83 <h3>Forgot password page text</h3> 84 <p> 85 Shown when a user is requesting a password reset (the form sends them an email). 86 </p> 87 <?php wp_editor(stripslashes($form_text['forgot']), 's8-forgot', array('textarea_name' => 's8_custom_login_form_text[forgot]')); ?> 88 <p> 89 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 90 </p> 91 92 <h3>Reset password page text</h3> 93 <p> 94 Shown when the user is resetting their password. 95 </p> 96 <?php wp_editor(stripslashes($form_text['reset']), 's8-reset', array('textarea_name' => 's8_custom_login_form_text[reset]')); ?> 97 <p> 98 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 99 </p> 124 <?php /*<h3><?php _e('On logout redirects'); ?></h3> */ ?> 125 <p> 126 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 127 </p> 128 </div> 129 <div id="tabs-2"> 130 <h3>Login page text</h3> 131 <p> 132 Shown when a user is logging in. 133 </p> 134 <?php wp_editor(stripslashes($form_text['login']), 's8-login', array('textarea_name' => 's8_custom_login_form_text[login]')); ?> 135 <p> 136 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 137 </p> 138 <p> 139 You can include any of the following tags to customize the content of the page:<br/> 140 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 141 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 142 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 143 %LOGIN_URL% = URL of the login page<br/> 144 %LOGIN_LINK% = Link to the login page<br/> 145 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 146 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 147 </p> 148 </div> 149 <div id="tabs-3"> 150 <h3>Registration page text</h3> 151 <p> 152 Shown when a user is registering for the site. 153 </p> 154 <?php wp_editor(stripslashes($form_text['register']), 's8-register', array('textarea_name' => 's8_custom_login_form_text[register]')); ?> 155 <p> 156 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 157 </p> 158 <p> 159 You can include any of the following tags to customize the content of the page:<br/> 160 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 161 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 162 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 163 %LOGIN_URL% = URL of the login page<br/> 164 %LOGIN_LINK% = Link to the login page<br/> 165 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 166 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 167 </p> 168 </div> 169 <div id="tabs-4"> 170 <h3>Forgot password page text</h3> 171 <p> 172 Shown when a user is requesting a password reset (the form sends them an email). 173 </p> 174 <?php wp_editor(stripslashes($form_text['forgot']), 's8-forgot', array('textarea_name' => 's8_custom_login_form_text[forgot]')); ?> 175 <p> 176 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 177 </p> 178 <p> 179 You can include any of the following tags to customize the content of the page:<br/> 180 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 181 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 182 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 183 %LOGIN_URL% = URL of the login page<br/> 184 %LOGIN_LINK% = Link to the login page<br/> 185 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 186 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 187 </p> 188 </div> 189 <div id="tabs-5"> 190 <h3>Reset password page text</h3> 191 <p> 192 Shown when the user is resetting their password. 193 </p> 194 <?php wp_editor(stripslashes($form_text['reset']), 's8-reset', array('textarea_name' => 's8_custom_login_form_text[reset]')); ?> 195 <p> 196 <input type="submit" class="button-primary" name="s8-login-settings-save" value="Save Settings" /> 197 </p> 198 <p> 199 You can include any of the following tags to customize the content of the page:<br/> 200 %FORM% = Shows the appropriate form. If not included, form appears below the content.<br/> 201 %REGISTER_URL% = URL of the register page NOTE: Users must be allowed to register for this to work!<br/> 202 %REGISTER_LINK% = Link to the register page NOTE: Users must be allowed to register for this to work!<br/> 203 %LOGIN_URL% = URL of the login page<br/> 204 %LOGIN_LINK% = Link to the login page<br/> 205 %FORGOT_PASSWORD_URL% = URL of the forgot password page<br/> 206 %FORGOT_PASSWORD_LINK% = Link to the forgot password page 207 </p> 208 </div> 209 </div> 100 210 </form> 101 211 </div> -
s8-custom-login-and-registration/trunk/inc/forms.php
r609859 r633652 16 16 case 'register': // Register user 17 17 $redirect_url = ($_GET['redirect'] != '')?$_GET['redirect']:home_url(); 18 ?><form method="post" action="<?php echo s8_get_register_url($redirect_url); ?>" name="register" >18 ?><form method="post" action="<?php echo s8_get_register_url($redirect_url); ?>" name="register" class="s8_form register_form"> 19 19 <?php 20 20 if(is_wp_error($errors)) { … … 43 43 break; 44 44 case 'reset': // Password reset 45 ?><form name="pass-reset" action="<?php echo home_url('/'.s8_login_registration::ep_login.'/?action=rp&key='.$_GET['key']); ?>" method="post" >45 ?><form name="pass-reset" action="<?php echo home_url('/'.s8_login_registration::ep_login.'/?action=rp&key='.$_GET['key']); ?>" method="post" class="s8_form reset_form"> 46 46 <?php 47 47 if(is_wp_error($errors)) { … … 64 64 break; 65 65 case 'forgot': // Forgot password 66 ?><form name="forgot" action="<?php echo s8_get_forgot_password_url(); ?>" method="post" >66 ?><form name="forgot" action="<?php echo s8_get_forgot_password_url(); ?>" method="post" class="s8_form forgot_form"> 67 67 <?php 68 68 if(is_wp_error($errors)) { … … 90 90 if(isset($wp_query->query_vars[s8_login_registration::ep_login]) && s8_get_current_url() == $redirect_url) 91 91 $redirect_url = home_url(); 92 ?><form action="<?php echo s8_get_login_url($redirect_url); ?>" name="login" method="post" >92 ?><form action="<?php echo s8_get_login_url($redirect_url); ?>" name="login" method="post" class="s8_form login_form"> 93 93 <?php 94 94 if(is_wp_error($errors)) { -
s8-custom-login-and-registration/trunk/inc/functions.php
r612857 r633652 43 43 if($redirect_url === false) $formatted_redirect_url = '&redirect='.urlencode(home_url('/')); 44 44 if($redirect_url === true) $formatted_redirect_url = ''; 45 $check = get_option('s8_allow_wp_register'); 46 if($check) return site_url('/wp-login.php?action=register'); 45 47 return home_url('/'.s8_login_registration::ep_login. 46 48 '/?action=register'.($formatted_redirect_url?$formatted_redirect_url:'')); -
s8-custom-login-and-registration/trunk/readme.txt
r612857 r633652 3 3 Tags: custom login, login, registration, form, login widget, widget 4 4 Requires at least: 3.3 5 Tested up to: 3. 4.26 Stable tag: 0.8. 25 Tested up to: 3.5 6 Stable tag: 0.8.3 7 7 License: GPLv3 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html 9 9 10 Easily change the way the WP login is seen by your users. This allows you to "hide" the wp-login url.10 Hides the WP login page, allows you to "embed" login in a page, and allows customization on how the login page looks. 11 11 12 12 == Description == 13 13 The way your site is presented to your users is important. That is why we made the "Custom Login and Registration" plugin. It is designed so that both you and your users never see the built-in WP login, registration, and password reset forms. It is still compatible with all of WordPress' built-in functionality and logout links will still function as they should. A login form widget is included to make it easy for your non-logged in visitors to find the login form. You are even able to add content to the login, registration, forgot password and password reset pages through the settings page. 14 15 If you want to add a form to a page on your site, you can use the new shortcodes: `[s8-login-form]`, `[s8-registration-form]`, and `[s8-forgot-form]`. 14 16 15 17 = Support/Help = … … 25 27 Despite our best attempts, it is possible that a WordPress update or another plugin may cause an issue with our plugin and you will be unable to login. To get around this use the following URL: http://yourDomainName.com/wp-login.php?no-redirect=true 26 28 NOTE: Replace yourDomainName.com with your domain name. If your WordPress install is in a subdirectory (e.g. yourDomainName.com/folder/wp-login.php) then adjust the URL as needed. 29 30 = How do I use the shortcode and what is it? = 31 A shortcode is an easy and accessible way for any site owner to add custom functionality to their site. In this case it allows you to put our login, registration, and forgot password forms on ANY page of your site. 32 33 To use it simply place one of the following shortcodes where you want the form to appear: 34 Login: `[s8-login-form]` 35 Registration: `[s8-registration-form]` 36 Forgot password: `[s8-forgot-form]` 37 38 You can also add the option 'hide_links' to your shortcode to hide the links to the other forms. 39 `[s8-login-form hide_links="forgot,register"]` 40 The above will, for example, hide the links to the forgot password and registration forms. You can also use 'login' as an option. 27 41 28 42 = How can I change the CSS on the login/register/forgot/reset password pages? = … … 40 54 41 55 == Upgrade Notice == 56 = 0.8.3 = 57 Added shortcodes and the ability to redirect users when they login based on role. 42 58 = 0.8.2 = 43 59 Added widget options for when the user is logged in. … … 48 64 49 65 == Changelog == 66 = 0.8.3 = 67 * Added shortcodes for use anywhere on the site. 68 * Added new CSS classes to the forms for easy styling (form tag is the wrapper for content inserted using the shortcode) 69 * Cleaned up the admin settings page 70 * Added option to use WordPress registration form 71 * Fixed a bug when going to our registration form 72 * Added basic login redirect support to redirect users to specific URLs on login 50 73 = 0.8.2 = 51 74 * Can now specify if a logout link should show in the widget -
s8-custom-login-and-registration/trunk/s8-login-registration.php
r612857 r633652 5 5 * Description: The way your site is presented to your users is important. That is why we made the "Custom Login and Registration" plugin. It is designed so that both you and your users never see the built-in WP login, registration, and password reset forms. It is still compatible with all of WordPress' built-in functionality and logout links will still function as they should. It also comes with a login form widget to make it easy for your non-logged in visitors to find the login form. 6 6 * Tags: custom login, login, registration, form, login widget, widget 7 * Version: 0.8. 27 * Version: 0.8.3 8 8 * Author: Sideways8 Interactive 9 9 * Author URI: http://sideways8.com/ … … 26 26 class s8_login_registration { 27 27 const ep_login = 'login'; 28 private $version = '0.8. 1',28 private $version = '0.8.3', 29 29 $title = '404 Not Found', 30 30 $content = 'Sorry, what you are looking for could not be found!'; … … 53 53 add_filter('login_url', array($this, 'login_url'), 10, 2); 54 54 add_filter('lostpassword_url', array($this, 'forgotpassword_url'), 10, 2); 55 // Add our (as of v0.8.1) internal shortcode 56 add_shortcode('login-form', array($this, 'form_shortcode')); 55 // Add our shortcodes 56 add_shortcode('s8-login-form', array($this, 'login_shortcode')); 57 add_shortcode('s8-registration-form', array($this, 'registration_shortcode')); 58 add_shortcode('s8-forgot-form', array($this, 'forgot_shortcode')); 59 add_shortcode('s8-reset-form', array($this, 'reset_shortcode')); // This is intended for internal use ONLY 57 60 //add_filter('register', array($this, 'register_url')); 58 61 // Add our admin stuff … … 94 97 } 95 98 $this->title = __('Register'); 96 $this->content = '[ login-form action="register" page="true"]';99 $this->content = '[s8-registration-form s8_internal="true"]'; 97 100 //$this->display_template('register'); 98 101 break; … … 103 106 } 104 107 $this->title = __('Reset Password'); 105 $this->content = '[ login-form action="reset" page="true"]';108 $this->content = '[s8-reset-form action="reset" s8_internal="true"]'; 106 109 //$this->display_template('login'); 107 110 break; … … 112 115 } 113 116 $this->title = __('Forgot Password'); 114 $this->content = '[ login-form action="forgot" page="true"]';117 $this->content = '[s8-forgot-form s8_internal="true"]'; 115 118 //$this->display_template('login'); 116 119 break; … … 122 125 // Do our stuff 123 126 $this->title = __('Login'); 124 $this->content = '[ login-form page="true"]';127 $this->content = '[s8-login-form s8_internal="true"]'; 125 128 //$this->display_template('login'); 126 129 } … … 273 276 wp_set_auth_cookie($user->ID, $remember); 274 277 do_action('wp_login', $username); 275 if($_POST['redirect'] != '') $url = $_POST['redirect']; 278 // Check for custom redirect 279 global $current_user; 280 $redirects = get_option('s8_login_redirects'); 281 $role = $current_user->roles; 282 if(is_array($role)) $role = $role[0]; 283 // Do our redirect! 284 if(isset($redirects[$role])) $url = $redirects[$role]; 285 elseif($_POST['redirect'] != '') $url = $_POST['redirect']; 276 286 else $url = home_url('/'); 277 287 wp_redirect($url, 302); … … 288 298 function no_wp_login() { 289 299 if(defined('S8_LOGIN_INIT') && S8_LOGIN_INIT === true) return; 300 $check = get_option('s8_allow_wp_register'); 301 if($check && $_REQUEST['action'] == 'register') return; 290 302 if($_GET['no-redirect'] == 'true') { 291 303 wp_enqueue_script('s8-login-failsafe', plugins_url('/js/s8-login-failsafe.js', S8_LOGIN_FILE), array('jquery')); … … 296 308 if($_GET['action'] == 'logout') 297 309 wp_redirect(s8_get_logout_url($url)); 310 elseif($_GET['action'] == 'register') 311 wp_redirect(s8_get_register_url($url)); 298 312 else 299 313 wp_redirect(s8_get_login_url($url)); … … 346 360 347 361 /** 348 * Logic for shortcode to show the various forms362 * Logic for shortcode to show the login form 349 363 * @since 0.8.1 350 364 * @param $atts 351 */ 352 function form_shortcode($atts) { 353 $page = $action = ''; 354 extract(shortcode_atts(array('page' => 'false', 'action' => 'login'), $atts)); 355 if($page == 'true') { 365 * @return bool|string Should only ever return a string when on a page not generated by us/widget 366 */ 367 function login_shortcode($atts) { 368 $s8_internal = $hide_links = ''; 369 extract(shortcode_atts(array('s8_internal' => 'false', 'hide_links' => ''), $atts)); 370 $action = 'login'; 371 if($s8_internal == 'true') { 372 $args = array('forgot' => false, 'register' => false, 'login' => false); 373 $form_text = get_option('s8_custom_login_form_text'); 374 if(!is_array($form_text)) $form_text = array(); 375 if($form_text[$action]) { 376 if(strpos($form_text[$action], '%FORM%') !== false) { 377 $output = explode('%FORM%', $this->prepare_content($form_text[$action]), 2); 378 echo ($output[0])?$output[0]:''; 379 s8_clr_get_form($action, $args); 380 echo ($output[1])?$output[1]:''; 381 } 382 else { 383 echo $this->prepare_content($form_text[$action]); 384 s8_clr_get_form($action, $args); 385 } 386 return ''; 387 } 388 } 389 $tmp = array(); 390 if(!empty($hide_links)) { 391 // Hide our links! 392 $hide = explode(',', $hide_links); 393 foreach($hide as $link) { 394 $link = strtolower(trim($link)); 395 if($link == 'login') $tmp['login'] = false; 396 elseif($link == 'register') $tmp['register'] = false; 397 elseif($link == 'forgot') $tmp['forgot'] = false; 398 } 399 } 400 $args = array_merge(array('forgot' => true, 'register' => true, 'login' => true), $tmp); 401 ob_start(); 402 s8_clr_get_form($action, $args); 403 return ob_get_clean(); 404 } 405 406 /** 407 * Logic for shortcode to show the register form 408 * @since 0.8.3 409 * @param $atts 410 * @return bool|string Should only ever return a string when on a page not generated by us/widget 411 */ 412 function registration_shortcode($atts) { 413 $s8_internal = $hide_links = ''; 414 extract(shortcode_atts(array('s8_internal' => 'false', 'hide_links' => ''), $atts)); 415 $action = 'register'; 416 if($s8_internal == 'true') { 356 417 $args = array('forgot' => false, 'register' => false, 'login' => false); 357 418 $form_text = get_option('s8_custom_login_form_text'); … … 368 429 s8_clr_get_form($action, $args); 369 430 } 370 return; 371 } 372 } 373 $args = array('forgot' => true, 'register' => true, 'login' => true); 431 return true; 432 } 433 } 434 $tmp = array(); 435 if(!empty($hide_links)) { 436 // Hide our links! 437 $hide = explode(',', $hide_links); 438 foreach($hide as $link) { 439 $link = strtolower(trim($link)); 440 if($link == 'login') $tmp['login'] = false; 441 elseif($link == 'register') $tmp['register'] = false; 442 elseif($link == 'forgot') $tmp['forgot'] = false; 443 } 444 } 445 $args = array_merge(array('forgot' => true, 'register' => true, 'login' => true), $tmp); 446 ob_start(); 374 447 s8_clr_get_form($action, $args); 448 return ob_get_clean(); 449 } 450 451 /** 452 * Logic for shortcode to show the forgot form 453 * @since 0.8.3 454 * @param $atts 455 * @return bool|string Should only ever return a string when on a page not generated by us/widget 456 */ 457 function forgot_shortcode($atts) { 458 $s8_internal = $hide_links = ''; 459 extract(shortcode_atts(array('s8_internal' => 'false', 'hide_links' => ''), $atts)); 460 $action = 'forgot'; 461 if($s8_internal == 'true') { 462 $args = array('forgot' => false, 'register' => false, 'login' => false); 463 $form_text = get_option('s8_custom_login_form_text'); 464 if(!is_array($form_text)) $form_text = array(); 465 if($form_text[$action]) { 466 if(strpos($form_text[$action], '%FORM%') !== false) { 467 $output = explode('%FORM%', $this->prepare_content($form_text[$action]), 2); 468 echo $output[0]; 469 s8_clr_get_form($action, $args); 470 echo $output[1]; 471 } 472 else { 473 echo $this->prepare_content($form_text[$action]); 474 s8_clr_get_form($action, $args); 475 } 476 return true; 477 } 478 } 479 $tmp = array(); 480 if(!empty($hide_links)) { 481 // Hide our links! 482 $hide = explode(',', $hide_links); 483 foreach($hide as $link) { 484 $link = strtolower(trim($link)); 485 if($link == 'login') $tmp['login'] = false; 486 elseif($link == 'register') $tmp['register'] = false; 487 elseif($link == 'forgot') $tmp['forgot'] = false; 488 } 489 } 490 $args = array_merge(array('forgot' => true, 'register' => true, 'login' => true), $tmp); 491 ob_start(); 492 s8_clr_get_form($action, $args); 493 return ob_get_clean(); 494 } 495 496 /** 497 * Logic for shortcode to show the forgot form 498 * @since 0.8.3 499 * @param $atts 500 * @return bool|string Should only ever return a string when on a page not generated by us/widget 501 */ 502 function reset_shortcode($atts) { 503 $s8_internal = $hide_links = ''; 504 extract(shortcode_atts(array('s8_internal' => 'false', 'hide_links' => ''), $atts)); 505 $action = 'reset'; 506 if($s8_internal == 'true') { 507 $args = array('forgot' => false, 'register' => false, 'login' => false); 508 $form_text = get_option('s8_custom_login_form_text'); 509 if(!is_array($form_text)) $form_text = array(); 510 if($form_text[$action]) { 511 if(strpos($form_text[$action], '%FORM%') !== false) { 512 $output = explode('%FORM%', $this->prepare_content($form_text[$action]), 2); 513 echo $output[0]; 514 s8_clr_get_form($action, $args); 515 echo $output[1]; 516 } 517 else { 518 echo $this->prepare_content($form_text[$action]); 519 s8_clr_get_form($action, $args); 520 } 521 return true; 522 } 523 } 524 return false; 375 525 } 376 526 … … 392 542 $tmp['REGISTER_LINK'] = s8_get_register_link(true); 393 543 } 394 foreach($tmp as $tag=>$value) {395 $content = str_replace('%'.$tag.'%', $value, $content);396 }397 544 $content = stripslashes($content); 398 545 $content = force_balance_tags($content); 399 546 $content = apply_filters('the_content', $content); 400 547 $content = str_replace(']]>', ']]>', $content); 548 foreach($tmp as $tag=>$value) { 549 $content = str_replace('%'.$tag.'%', $value, $content); 550 } 401 551 return $content; 402 552 } … … 426 576 function forgotpassword_url($url, $redirect) { 427 577 $url = s8_get_forgot_password_url(); 428 return $url;429 }430 431 /**432 * Filter the default register URL to our register URL433 * @since 0.8.0434 */435 function register_url($url) {436 $url = s8_get_register_url();437 578 return $url; 438 579 } … … 464 605 if(is_admin()) 465 606 wp_enqueue_style('s8-login-styles', plugins_url('/css/s8-login-admin.css', S8_LOGIN_FILE)); 607 wp_enqueue_style('s8-login-tabs.jquery', plugins_url('/css/jquery-ui-1.9.0.custom.min.css', S8_LOGIN_FILE)); 608 wp_enqueue_script('s8-login-admin', plugins_url('/js/s8-login-admin.js', S8_LOGIN_FILE), array('jquery', 'jquery-ui-tabs')); 466 609 } 467 610
Note: See TracChangeset
for help on using the changeset viewer.