Changeset 837305
- Timestamp:
- 01/12/2014 07:00:53 PM (12 years ago)
- Location:
- jonimo-simple-redirect/trunk
- Files:
-
- 5 added
- 5 edited
-
addons (added)
-
addons/redirect-default-addon.php (added)
-
assets/Thumbs.db (added)
-
assets/images/Thumbs.db (added)
-
class/redirect-core.php (modified) (1 diff)
-
class/redirect-default.php (added)
-
class/redirect-login.php (modified) (7 diffs)
-
jj_core_setup.php (modified) (5 diffs)
-
readme.txt (modified) (4 diffs)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
jonimo-simple-redirect/trunk/class/redirect-core.php
r832484 r837305 162 162 */ 163 163 function jj_redirect_get_logout_link( $value, $option ) { 164 global $user; 164 165 if( $option == 'categories' ){ 165 166 $uri = get_category_link( $value ); -
jonimo-simple-redirect/trunk/class/redirect-login.php
r832484 r837305 42 42 <h3>Select a role from a tab below</h3> 43 43 <?php 44 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : '';44 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : jj_get_default_role(); 45 45 $wp_roles = new WP_Roles(); 46 46 $roles = $wp_roles->get_names(); … … 102 102 function jj_redirect_page_select(){ 103 103 //set the active as administrator if no other tab setting is indiacted in the GET array. 104 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'administrator';104 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : jj_get_default_role(); 105 105 $wp_roles = new WP_Roles(); 106 106 $roles = $wp_roles->get_names(); … … 138 138 function jj_redirect_category_select(){?> 139 139 <?php 140 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'administrator';140 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : jj_get_default_role(); 141 141 $wp_roles = new WP_Roles(); 142 142 $roles = $wp_roles->get_names(); … … 186 186 */ 187 187 function jj_redirect_tag_select(){ 188 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'administrator';188 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : jj_get_default_role(); 189 189 $wp_roles = new WP_Roles(); 190 190 $roles = $wp_roles->get_names(); … … 235 235 function jj_redirect_bp_select(){?> 236 236 <?php 237 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'administrator';237 $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : jj_get_default_role(); 238 238 //Lets get the roles 239 239 $wp_roles = new WP_Roles(); … … 291 291 function jj_display_selected_link($role_name) { 292 292 global $user; 293 294 //we get the options 293 295 $options = get_option( 'jj_register_'.$role_name); 294 if ( $options ){ 296 if ( $options ){ 295 297 foreach ( $options as $option => $value ){ 296 //if the value does not equal 0 i.e it is the one selected..298 //if the value does not equal 0 i.e it is the one selected.. 297 299 if ($value != 0){ 298 300 $link = jj_redirect_get_login_link( $redirect_url = null , $request_url = null, $user, $value, $option, $role_name); … … 301 303 $link = esc_url( $link ); 302 304 echo _e('<p>On login these users will be directed to: <br><strong>'.$link.'</strong><p>'); 305 break; 303 306 } 307 304 308 //if we dont return a link (despite a value being passed to jj_redirect_get_login_link 305 309 else { 306 310 echo _e('<p>Select one of the options above to redirect users to on login.<p>'); 307 311 } 308 } 312 } 309 313 } 314 if (array_sum($options) == 0){ 315 //if all aptions are 0 316 echo _e('<p>Select one of the options above to redirect users with the role of "'.$role_name.'" to on login. 317 <br>If no option is set these users will be directed to the default link below.<p>'); 318 jj_redirect_get_default_link($user); 319 } 310 320 } 311 321 //if there are no options set... 312 322 else { 313 echo _e('<p>Select one of the options above to redirect users to on login.<p>'); 323 echo _e('<p>Select one of the options above to redirect users with the role of "'.$role_name.'" to on login. 324 <br>If no option is set these users will be directed to the default link below.<p>'); 325 jj_redirect_get_default_link($user); 326 314 327 } 315 328 } -
jonimo-simple-redirect/trunk/jj_core_setup.php
r832484 r837305 5 5 Description: Redirect different users based on their role, to any page, tag or category on login or logout. 6 6 * If you have buddypress installed, redirect users to their profile, their activity or their friends activity tabs. 7 Version: 1. 17 Version: 1.2 8 8 Author: jonimo 9 9 Author URI: http://www.jonimo.com … … 15 15 require_once( plugin_dir_path(__FILE__) . 'class/redirect-login.php' ); 16 16 require_once( plugin_dir_path(__FILE__) . 'class/redirect-logout.php' ); 17 require_once( plugin_dir_path(__FILE__) . 'class/redirect-default.php' ); 18 require_once( plugin_dir_path(__FILE__) . 'addons/redirect-default-addon.php' ); 17 19 //require_once( plugin_dir_path(__FILE__) . 'class/redirect-settings.php' ); 18 20 add_action( 'admin_menu', 'jj_redirect_admin_menu' ); … … 48 50 'manage_options', 'jonimo', 'jj_redirect_display_settings_page', 49 51 plugins_url( 'assets/images/ji_redirect.png', __FILE__ ) ); 50 add_submenu_page( 'jonimo', 'Login', 'Login', 'manage_options', 52 //check what the first role is and append this to the 53 add_submenu_page( 'jonimo', 'Login', 'Login', 'manage_options', 51 54 'jonimo', 'jj_redirect_display_settings_page' ); 52 55 add_submenu_page( 'jonimo', 'Logout', 'Logout', 'manage_options', 53 __FILE__.'_logout', 'jj_redirect_display_logout_page' );56 'logout', 'jj_redirect_display_logout_page' ); 54 57 //add_submenu_page( __FILE__, 'Settings', 'Settings', 'manage_options', 55 58 //__FILE__.'_settings', 'ji_redirect_display_settings' ); 59 add_submenu_page( 'jonimo', 'Default Link', 'Default Link', 'manage_options', 60 'default', 'jj_redirect_display_default_page' ); 56 61 add_submenu_page( 'jonimo', 'About', 'About', 'manage_options', 57 62 __FILE__.'_about', 'jj_redirect_display_about_page' ); 58 59 63 } 60 64 … … 64 68 function jj_redirect_display_about_page() { 65 69 ?> 66 <div class="wrap">70 <div class="wrap"> 67 71 <?php screen_icon(); ?> 68 72 <h2>About</h2> … … 71 75 and bpdev for some ideas that led to parts of this code being written. You can find his great work on <a href ="">www.buddydev.com</a> 72 76 </p> 73 </div>77 </div> 74 78 <?php 75 79 } 76 80 77 81 82 function jj_get_default_role(){ 83 $wp_roles = new WP_Roles(); 84 $roles = $wp_roles->get_names(); 85 foreach ($roles as $role_value => $role_name) { 86 return $role_name; 87 } 88 } 89 78 90 79 91 ?> -
jonimo-simple-redirect/trunk/readme.txt
r832973 r837305 1 1 === Plugin Name === 2 2 Contributors: jonimo 3 Tags: redirect, login, logout, buddypress, multisite, profile, page, tag, category3 Tags: redirect, login, logout, buddypress, multisite, profile, page, tag, user roles 4 4 Requires at least: 3.0.1 5 5 Tested up to: 3.8 6 Stable tag: 1. 16 Stable tag: 1.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 14 14 jonimo simple redirect helps your users with different roles get to the right place when they login or logout of your WordPress site. 15 15 16 * seamlessly redirect different users to different areas of your website based on their role 17 * simply select a role, then one page, content category or content tag to send these users to on login 18 * fully compatible with BuddyPress 1.9. You can give your users an experience more similar to popular social networks by redirecting them to 16 * Seamlessly redirect different users to different areas of your website based on their role. 17 * NEW Simply select a role, then one page, content category or content tag to send users to on login. 18 * NEW Set a default redirect location for any role where a redirect location is not set. 19 * Fully compatible with Wordpress 3.8 and BuddyPress 1.9.1 You can give your users an experience more similar to popular social networks by redirecting them to 19 20 their personal profile pages, their 'friends' menu or the activity stream 20 * fully multisite compatible, giving each site administration control over where the different users of their site are redirected to21 * extendable and built with developers in mind. It's easy to change the default redirect behaviour using custom filters.21 * Fully multisite compatible, giving each site administration control over where the different users of their site are redirected to 22 * Extendable and built with developers in mind. It's easy to change the default redirect behaviour using custom filters. 22 23 23 24 Coming in 2014: … … 45 46 46 47 Any other plugin that attempts to redirect users on login or logout may conflict with this plugin. Likewise, any plugin that uses a 47 custom login script such as woocommercemay cause jonimo simple redirect to be ineffective.48 custom login script may cause jonimo simple redirect to be ineffective. 48 49 We are looking at ways to ensure as wide a compatability as possible in upcoming releases. If you have any problems, please let us know at 49 50 [jonimo](http://jonimo.com/forums/support "jonimo support") … … 70 71 == Screenshots == 71 72 72 1. login73 2. logout73 1. On the login options screen you can choose where to redirect different users based on their role. 74 2. On the logout options screen you can direct all users to a common location. 74 75 75 76 == Changelog == 76 77 78 = 1.2 = 79 * You can now select a unique default place for users to be redirected to on login if no custom destination has been set for their role. 80 * Improved messaging 81 77 82 = 1.1 = 78 * You can now select different redirect options for different roles.79 * Tested on BuddyPress 1.9 and WordPress3.883 * You can now select different redirect destination for users based on their role. 84 * Tested on BuddyPress 1.9 and 3.8 80 85 * Added more filters for developers 81 86 -
jonimo-simple-redirect/trunk/uninstall.php
r832484 r837305 9 9 delete_option( 'jj_register_'.$role_name); 10 10 } 11 12 //delete the default link option on uninstall. 13 delete_option('jj_redirect_default'); 14 11 15 ?>
Note: See TracChangeset
for help on using the changeset viewer.