Plugin Directory

Changeset 460028


Ignore:
Timestamp:
11/06/2011 08:02:51 PM (14 years ago)
Author:
tombenner
Message:

Adding changes for 1.1

Location:
front-end-users/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • front-end-users/trunk/README.md

    r459314 r460028  
    26261. Upload `front-end-users` to the `wp-content/plugins/` directory
    27271. Activate the plugin through the 'Plugins' menu in WordPress
     281. Make sure that [Pretty Permalinks](http://codex.wordpress.org/Introduction_to_Blogging#Pretty_Permalinks) are enabled and working
    2829
    2930Frequently Asked Questions
  • front-end-users/trunk/lib/front_end_users.php

    r459314 r460028  
    1717        $wp_rewrite->flush_rules();
    1818        add_option('front_end_users_url_path', 'profile');
     19        add_option('front_end_users_display_custom_profile_settings', 0);
    1920    }
    2021   
     
    5152        $defaults = array(
    5253            '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
    5456        );
    5557       
     
    6365        $default_settings = array(
    6466            '404_include_path' => get_theme_root().'/'.get_template().'/404.php',
    65             'views' => $default_views,
     67            'display_custom_profile_settings' => $options['display_custom_profile_settings'],
    6668            'roles_with_admin_access' => $options['roles_with_admin_access'],
    6769            'url_path' => $options['url_path'],
     70            'views' => $default_views,
    6871            'views_directory' => $this->plugin_file_path.'views/'
    6972        );
     
    8386        register_setting('front-end-users', 'front_end_users_options', array($this, 'validate_options'));
    8487        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');
    8589        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');
    8791    }
    8892   
     
    340344        global $current_user;
    341345        get_currentuserinfo();
     346        $script_name = $_SERVER['SCRIPT_NAME'];
    342347        if ($current_user->ID == 0) {
    343348            return site_url().'/';
    344         } else if (!$this->has_admin_access()) {
     349        }
     350        if (!$this->has_admin_access()) {
    345351            // Allow admin AJAX to be used
    346352            if ($url == get_bloginfo('wpurl').'/wp-admin/admin-ajax.php') {
     
    353359            }
    354360            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            }
    355366        }
    356367        if (preg_match('/\/wp-admin\/profile\.php$/', $url)) {
     
    560571           
    561572                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                }
    563576                $redirect_url = feu_get_url('settings');
    564577                wp_redirect($redirect_url.'?updated=true');
     
    606619        return $display_name_options_html;
    607620       
     621    }
     622   
     623    public function get_display_custom_profile_settings() {
     624        return $this->settings['display_custom_profile_settings'];
    608625    }
    609626   
     
    644661            $options['url_path'] = 'profile';
    645662        }
     663        if (!isset($options['display_custom_profile_settings'])) {
     664            $options['display_custom_profile_settings'] = 0;
     665        }
    646666        $this->flush_rules();
    647667        return $options;
     
    654674    public function settings_input_url_path() {
    655675        $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>';
    658686    }
    659687   
  • front-end-users/trunk/readme.txt

    r459314 r460028  
    44Requires at least: 3.0
    55Tested up to: 3.2.1
    6 Stable tag: trunk
     6Stable tag: 1.1
    77
    88Hides the WordPress admin section from specified user roles, allows users to edit their settings from the front-end, and more.
     
    29291. Upload `front-end-users` to the `wp-content/plugins/` directory
    30301. Activate the plugin through the 'Plugins' menu in WordPress
     311. Make sure that [Pretty Permalinks](http://codex.wordpress.org/Introduction_to_Blogging#Pretty_Permalinks) are enabled and working
    3132
    3233== Frequently Asked Questions ==
     
    44451. 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.
    45461. 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  
    126126            </fieldset>
    127127           
     128            <?php if ($feu->get_display_custom_profile_settings()): ?>
     129           
     130                <?php do_action( 'show_user_profile', $user ); ?>
     131           
     132            <?php endif; ?>
     133           
    128134            <div class="submit">
    129135           
Note: See TracChangeset for help on using the changeset viewer.