Changeset 460028
- Timestamp:
- 11/06/2011 08:02:51 PM (14 years ago)
- Location:
- front-end-users/trunk
- Files:
-
- 5 edited
-
README.md (modified) (1 diff)
-
lib/front_end_users.php (modified) (10 diffs)
-
readme.txt (modified) (3 diffs)
-
screenshot-1.png (modified) (previous)
-
views/settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
front-end-users/trunk/README.md
r459314 r460028 26 26 1. Upload `front-end-users` to the `wp-content/plugins/` directory 27 27 1. Activate the plugin through the 'Plugins' menu in WordPress 28 1. Make sure that [Pretty Permalinks](http://codex.wordpress.org/Introduction_to_Blogging#Pretty_Permalinks) are enabled and working 28 29 29 30 Frequently Asked Questions -
front-end-users/trunk/lib/front_end_users.php
r459314 r460028 17 17 $wp_rewrite->flush_rules(); 18 18 add_option('front_end_users_url_path', 'profile'); 19 add_option('front_end_users_display_custom_profile_settings', 0); 19 20 } 20 21 … … 51 52 $defaults = array( 52 53 'url_path' => 'profile', 53 'roles_with_admin_access' => array($this->administrator_role_key) 54 'roles_with_admin_access' => array($this->administrator_role_key), 55 'display_custom_profile_settings' => 0 54 56 ); 55 57 … … 63 65 $default_settings = array( 64 66 '404_include_path' => get_theme_root().'/'.get_template().'/404.php', 65 ' views' => $default_views,67 'display_custom_profile_settings' => $options['display_custom_profile_settings'], 66 68 'roles_with_admin_access' => $options['roles_with_admin_access'], 67 69 'url_path' => $options['url_path'], 70 'views' => $default_views, 68 71 'views_directory' => $this->plugin_file_path.'views/' 69 72 ); … … 83 86 register_setting('front-end-users', 'front_end_users_options', array($this, 'validate_options')); 84 87 add_settings_section('front-end-users-main', 'Settings', array($this, 'settings_text'), 'front-end-users'); 88 add_settings_field('roles_with_admin_access', 'Roles with Admin Access', array($this, 'settings_input_roles_with_admin_access'), 'front-end-users', 'front-end-users-main'); 85 89 add_settings_field('url_path', 'URL Base', array($this, 'settings_input_url_path'), 'front-end-users', 'front-end-users-main'); 86 add_settings_field(' roles_with_admin_access', 'Roles with Admin Access', array($this, 'settings_input_roles_with_admin_access'), 'front-end-users', 'front-end-users-main');90 add_settings_field('display_custom_profile_settings', 'Display Custom Profile Settings', array($this, 'settings_input_display_custom_profile_settings'), 'front-end-users', 'front-end-users-main'); 87 91 } 88 92 … … 340 344 global $current_user; 341 345 get_currentuserinfo(); 346 $script_name = $_SERVER['SCRIPT_NAME']; 342 347 if ($current_user->ID == 0) { 343 348 return site_url().'/'; 344 } else if (!$this->has_admin_access()) { 349 } 350 if (!$this->has_admin_access()) { 345 351 // Allow admin AJAX to be used 346 352 if ($url == get_bloginfo('wpurl').'/wp-admin/admin-ajax.php') { … … 353 359 } 354 360 return $this->get_view_url(); 361 } 362 if ($this->has_admin_access()) { 363 if (preg_match('/\/wp-admin\/profile\.php/', $script_name)) { 364 return $url; 365 } 355 366 } 356 367 if (preg_match('/\/wp-admin\/profile\.php$/', $url)) { … … 560 571 561 572 do_action('feu_after_update_user', $user, $_POST); 562 573 if ($this->get_display_custom_profile_settings()) { 574 do_action('personal_options_update', $user_id); 575 } 563 576 $redirect_url = feu_get_url('settings'); 564 577 wp_redirect($redirect_url.'?updated=true'); … … 606 619 return $display_name_options_html; 607 620 621 } 622 623 public function get_display_custom_profile_settings() { 624 return $this->settings['display_custom_profile_settings']; 608 625 } 609 626 … … 644 661 $options['url_path'] = 'profile'; 645 662 } 663 if (!isset($options['display_custom_profile_settings'])) { 664 $options['display_custom_profile_settings'] = 0; 665 } 646 666 $this->flush_rules(); 647 667 return $options; … … 654 674 public function settings_input_url_path() { 655 675 $options = get_option('front_end_users_options'); 656 echo '<input id="url_path" name="front_end_users_options[url_path]" type="text" value="'.esc_attr($options['url_path']).'" />'; 657 echo '<br /><em>(a value of "profile" will mean the user landing page is at "http://mysite.com/profile/")</em>'; 676 echo '<input type="text" id="url_path" name="front_end_users_options[url_path]" value="'.esc_attr($options['url_path']).'" />'; 677 echo '<br /><em>(A value of "profile" will mean the user landing page is at "http://mysite.com/profile/".)</em>'; 678 } 679 680 public function settings_input_display_custom_profile_settings() { 681 $options = get_option('front_end_users_options'); 682 $checked = isset($options['display_custom_profile_settings']) ? 683 ($options['display_custom_profile_settings'] ? ' checked="checked"' : '') : ''; 684 echo '<input type="checkbox" id="display_custom_profile_settings" name="front_end_users_options[display_custom_profile_settings]" value="1"'.$checked.' />'; 685 echo '<br /><em>(This determines whether profile fields added by plugins or themes will show up in the default public settings view. Please note that some plugins\' profile fields may not function correctly outside of the admin section.)</em>'; 658 686 } 659 687 -
front-end-users/trunk/readme.txt
r459314 r460028 4 4 Requires at least: 3.0 5 5 Tested up to: 3.2.1 6 Stable tag: trunk6 Stable tag: 1.1 7 7 8 8 Hides the WordPress admin section from specified user roles, allows users to edit their settings from the front-end, and more. … … 29 29 1. Upload `front-end-users` to the `wp-content/plugins/` directory 30 30 1. Activate the plugin through the 'Plugins' menu in WordPress 31 1. Make sure that [Pretty Permalinks](http://codex.wordpress.org/Introduction_to_Blogging#Pretty_Permalinks) are enabled and working 31 32 32 33 == Frequently Asked Questions == … … 44 45 1. The default profile settings page that's displayed on the front-end to users. This can easily be modified or re-styled if any changes are desired. 45 46 1. An example of how user-specific pages and a menu listing them can be added. 47 48 == Changelog == 49 50 = 1.1 = 51 * Added a switch that allows custom profile fields added by plugins and themes to show up in the default public settings view 52 * Added an exception to the admin URL rewrite to correct the admin profile form's action -
front-end-users/trunk/views/settings.php
r393053 r460028 126 126 </fieldset> 127 127 128 <?php if ($feu->get_display_custom_profile_settings()): ?> 129 130 <?php do_action( 'show_user_profile', $user ); ?> 131 132 <?php endif; ?> 133 128 134 <div class="submit"> 129 135
Note: See TracChangeset
for help on using the changeset viewer.