Changeset 837902
- Timestamp:
- 01/13/2014 08:25:57 PM (12 years ago)
- Location:
- jonimo-simple-redirect/trunk
- Files:
-
- 7 edited
-
addons/redirect-default-addon.php (modified) (1 diff)
-
assets/images/Thumbs.db (modified) (previous)
-
class/redirect-core.php (modified) (1 diff)
-
class/redirect-login.php (modified) (2 diffs)
-
class/redirect-logout.php (modified) (2 diffs)
-
jj_core_setup.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jonimo-simple-redirect/trunk/addons/redirect-default-addon.php
r837305 r837902 41 41 } 42 42 } 43 var_dump($new_default); 43 44 if (array_sum($new_default) == 0){ 44 45 echo '<strong>'.admin_url().'</strong><br>'; -
jonimo-simple-redirect/trunk/class/redirect-core.php
r837305 r837902 106 106 elseif ( $option === 'bp' ){ 107 107 if(function_exists('bp_is_active')){ 108 global $bp; 109 if( $value == 1 ){ 110 //just in case this is depricated... 111 if(function_exists('bp_core_get_user_domain')){ 112 //if we are logged in lets get the domain by the loggedin_user_id 113 if (is_user_logged_in()){ 114 $profile_url = bp_core_get_user_domain( bp_loggedin_user_id() ); 115 } 116 //if not we use the user object 117 else{ 118 $profile_url = bp_core_get_user_domain( $user->ID ); 119 } 120 return $profile_url; 121 } 108 global $bp; 109 if( $value == 1 ){ 110 //just in case this is depricated... 111 if(function_exists('bp_core_get_user_domain')){ 112 //if we are logged in lets get the domain by the loggedin_user_id 113 if (is_user_logged_in()){ 114 $profile_url = bp_core_get_user_domain( bp_loggedin_user_id() ); 115 } 116 //if not we use the user object 117 else{ 118 $profile_url = bp_core_get_user_domain( $user->ID ); 119 } 120 return $profile_url; 121 } 122 } 123 elseif( $value === 2 ){ 124 if(function_exists('bp_get_activity_root_slug')){ 125 $activity_slug = bp_get_activity_root_slug(); 126 $activity_url = $bp->root_domain."/".$activity_slug; 127 return $activity_url; 128 } 129 } 130 elseif( $value === 3 ){ 131 if(function_exists('bp_get_activity_root_slug')){ 132 $activity_slug = bp_get_activity_root_slug(); 133 $friends_activity = $bp->root_domain."/".$ctivity_slug."/friends/"; 134 return $friends_activity; 135 } 136 } 137 elseif( $value === 4 ){ 138 //just in case this is depricated... 139 if(function_exists('bp_core_get_user_domain')){ 140 //if we are logged in lets get the domain by the loggedin_user_id 141 if (is_user_logged_in()){ 142 $profile_url = bp_core_get_user_domain( bp_loggedin_user_id() ); 143 } 144 //if not we use the user object 145 else{ 146 $profile_url = bp_core_get_user_domain( $user->ID ); 147 } 148 $edit_profile_url .= $profile_url.'profile/edit'; 149 return $edit_profile_url; 150 } 151 } 122 152 } 123 elseif( $value === 2 ){ 124 if(function_exists('bp_get_activity_root_slug')){ 125 $activity_slug = bp_get_activity_root_slug(); 126 $activity_url = $bp->root_domain."/".$activity_slug; 127 return $activity_url; 128 } 129 } 130 elseif( $value === 3 ){ 131 if(function_exists('bp_get_activity_root_slug')){ 132 $activity_slug = bp_get_activity_root_slug(); 133 $friends_activity = $bp->root_domain."/".$ctivity_slug."/friends/"; 134 return $friends_activity; 135 } 136 } 137 } 153 } 138 154 //if buddypress is deactivated or uninstalled, and there is a BP option set, we reset all options to 0 and redirect users to the admin. 139 else{140 $args = array();141 $args['page'] = 0;142 $args['categories'] = 0;143 $args['tag'] = 0;144 $args['bp'] = 0;145 update_option( 'jj_register_'.$role_name, $args );146 147 $default_link = admin_url();148 $default = apply_filters( 'ji_filter_default_link' , $default_link, $user );149 return $default;150 }151 }152 } 155 else{ 156 $args = array(); 157 $args['page'] = 0; 158 $args['categories'] = 0; 159 $args['tag'] = 0; 160 $args['bp'] = 0; 161 update_option( 'jj_register_'.$role_name, $args ); 162 163 $default_link = admin_url(); 164 $default = apply_filters( 'ji_filter_default_link' , $default_link, $user ); 165 return $default; 166 } 167 } 168 153 169 154 170 -
jonimo-simple-redirect/trunk/class/redirect-login.php
r837305 r837902 29 29 } 30 30 add_action( 'admin_init', 'jj_register_admin_init'); // register the admin 31 31 32 32 33 /** … … 255 256 <?php if ( bp_is_active( 'friends' )) { ?> 256 257 <option value="3" <?php if ( $options['bp'] == 3 ) echo 'selected="selected"'; ?>>Friends Activity</option> 258 <?php }?> 259 <?php if ( bp_is_active( 'friends' )) { ?> 260 <option value="4" <?php if ( $options['bp'] == 4 ) echo 'selected="selected"'; ?>>User profile edit</option> 257 261 <?php }?> 258 262 </select> -
jonimo-simple-redirect/trunk/class/redirect-logout.php
r832484 r837902 44 44 //if the value does not equal -1 i.e it is the one selected.. 45 45 if ( $value != 0 ){ 46 $link = jj_redirect_get_logout_link( $value, $option ); 47 } 46 $link = jj_redirect_get_logout_link( $value, $option ); 47 if ($link != null ){ 48 $link = esc_url( $link ); 49 echo _e('<p>On logout all users will be directed to: <br><strong>'.$link.'</strong><p>'); 50 } 51 } 48 52 } 49 echo '<p>On logout all users will be directed to: <br><strong>'.$link.'</strong><p>'; 53 if (array_sum($options) == 0){ 54 //if all aptions are 0 55 echo _e('<p>Select one of the options above to redirect users to on login.<p>'); 56 } 50 57 } 51 else {52 echo '<p>Select one of the options above to redirect users to on logout.<p>';58 else { 59 echo _e('<p>Select one of the options above to redirect users to on logout.<p>'); 53 60 } 54 61 ?> … … 185 192 } 186 193 194 195 /** 196 * Adds a homepage option to the wp_dropdown_pages 197 * Credit goes to http://www.churchthemer.com/ for this bit of code. 198 * @since 1.2 199 * 200 * @return array of valid values 201 */ 202 function jj_dropdown_addhome($output){ 203 $frontpage_id = get_option('page_on_front'); 204 $dropdown = $output; 205 $homepage = str_replace("<select name='page_id'>","<select name='page_id'><option value=\"$frontpage_id\">Home</option>",$dropdown); 206 return $homepage; 207 } 208 add_filter('wp_dropdown_pages','jj_dropdown_addhome'); 209 210 187 211 ?> -
jonimo-simple-redirect/trunk/jj_core_setup.php
r837305 r837902 1 1 <?php 2 2 /* 3 Plugin Name: Jonimo Simple Redirect3 Plugin Name: jonimo Simple Redirect 4 4 Plugin URI: http://www.jonimo.com 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.2 7 Version: 1.2.1 8 8 Author: jonimo 9 9 Author URI: http://www.jonimo.com -
jonimo-simple-redirect/trunk/readme.txt
r837305 r837902 4 4 Requires at least: 3.0.1 5 5 Tested up to: 3.8 6 Stable tag: 1.2 6 Stable tag: 1.2.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 * NEW Set a default redirect location for any role where a redirect location is not set. 19 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 20 their personal profile pages, their 'friends' menu or the activity stream 20 their personal profile pages, their 'friends' menu or the activity stream. 21 21 * Fully multisite compatible, giving each site administration control over where the different users of their site are redirected to 22 22 * Extendable and built with developers in mind. It's easy to change the default redirect behaviour using custom filters. … … 34 34 To install: 35 35 36 1. Upload `j i_redirect` to the `/wp-content/plugins/` directory of your site.36 1. Upload `jonimo_simple_redirect` to the `/wp-content/plugins/` directory of your site. 37 37 1. Activate the plugin through the 'Plugins' menu in WordPress 38 38 1. You should be able to see a top level menu called 'Redirect Settings' appear in your administration panel.
Note: See TracChangeset
for help on using the changeset viewer.