Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 1.58 KB  |  hits: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /*
  3. Plugin Name: BP Redirect to Profile for Buddypress
  4. Description:Redirect user to their profile when they login
  5. Version: 1.1.1
  6. Requires at least: BuddyPress 1.1
  7. Tested up to: BuddyPress 1.2.8+WordPress 3.1
  8. License: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html
  9. Author: Brajesh Singh
  10. Author URI: http://buddydev.com
  11. Plugin URI:http://buddydev.com/buddypress/bp-redirect-to-profile-plugin-redirect-users-to-their-profile-on-login-on-buddypress-sites/
  12. Last updated:16th feb 2010
  13. */
  14. /***
  15.     Copyright (C) 2009 Brajesh Singh(buddydev.com)
  16.  
  17.     This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or  any later version.
  18.  
  19.     This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  20.  
  21.     You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses>.
  22.  
  23.     */
  24. /*Add a filter to filter the redirect url for login*/
  25. add_filter("login_redirect","bpdev_redirect_to_profile",100,3);
  26.  
  27. function bpdev_redirect_to_profile($redirect_to_calculated,$redirect_url_specified,$user){
  28. /*if no redirect was specified,let us think ,user wants to be in wp-dashboard*/
  29. if(empty($redirect_to_calculated))
  30.         $redirect_to_calculated=admin_url();
  31.        
  32.         //redirect all users
  33.         return bp_core_get_user_domain($user->ID );
  34.        
  35.  
  36. }
  37. ?>