Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter abrautigam

    (@abrautigam)

    If you just need the CAS login, and maybe automatic account creation, just use WPCAS. Use the wpcas-conf.php file, as instructed. This will hide the settings from everyone, and set them. It won’t get overwritten when it’s updated, either. If you need automatic account creation, change the function at the bottom of wpcas-conf.php to:

    function wpcas_nowpuser( $user_name ){
        wp_create_user($user_name, '', $user_name.'@sulross.edu');
        wp_redirect('wp-admin/');
    }

    or whatever account creation code you choose. This is the function to put it in.

    Thread Starter abrautigam

    (@abrautigam)

    It’s not enough to limit the configuration page to Super Admins. There are other plugins that can hide it from everyone else. If you hide it, the settings stay blank and it doesn’t work on the sub-sites. For now, I’ve cloned the plugin, and changed its name/ folder so that it won’t update, and activated it. I’ve installed but not activated the original, so it will let me know when to manually update the other, so my settings are not lost.

    In /wordpress/wp-content/plugins/cas-maestro_NO_Update/cas-maestro.php

    /*
    Plugin Name: CAS Maestro NO Update
    Plugin URL:
    Description: This does not update: Make sure to manually update after CAS Maestro auto-updates
    Version: 1.1.3
    Author: Modified by Al
    Author URI:
    Text Domain: CAS_Maestro_NO_Update
    */
    // This version does not update: Let the original version update itself then copy all files but this one to this folder.
    // Make sure the modifications, including this header, are made to a copy of this file. Then replace this file with the updated and modified file.
    /*

    Then I altered the constructor to set the defaults I needed:

    /**
         * Initializes the plugin by setting localization, filters, and administration functions.
         */
        function __construct() {
    
            //Initialize the settings
             $default_settings = array(
                     'cas_menu_location'=>'sidebar',
                     'new_user' => false,
                    'email_suffix' => '@email.edu',
                    'cas_version' => "1.0",
                    'server_hostname' => 'cas.server.edu',
                    'server_port' => '###',
                    'server_path' => '***',
                    'e-mail_registration' => 1,
                    'global_sender'=>get_bloginfo('admin_email'),
                    'full_name' => '',
                    //Welcome email

    To hide the configuration page, replace the entire register_menus function with this:

    function register_menus()
    {
        get_currentuserinfo();
        if (is_super_admin( $current_user->ID )){
        {
                switch($this->settings['cas_menu_location']) {
                    case 'sidebar':
                        $settings_page = add_menu_page(__('CAS Maestro Settings', "CAS_Maestro"),
                            __('CAS Maestro', "CAS_Maestro"),
                            'manage_options',
                            'wpcas_settings',
                            array(&$this,'admin_interface'),
                            '',
                            214);
                        break;
                    case 'settings':
                    default:
                        $settings_page = add_options_page(__('CAS Maestro', "CAS_Maestro"),
                            __('CAS Maestro', "CAS_Maestro"), 8,
                            'wpcas_settings',
                            array(&$this,'admin_interface'));
                        break;
                }
                add_action( "load-{$settings_page}", array(&$this, 'onLoad_settings_page') );
            }
        }
    }
Viewing 2 replies - 1 through 2 (of 2 total)