• Resolved nd54448

    (@nd54448)


    Hi
    I am using Authorizer for CAS authentification and it works fine. I have a question regarding a feature.
    I am now using a small script (see below) to populate a dropbox list with usernames. But only the WP-users appear. How to put the CAS users on this list ? (only the CAS or, better, both CAS and WP users).
    Thanks

    Here is the script I use :

    //This adds display names for all users to a drop down box on a gravity form.
    add_filter(“gform_pre_render”, “populate_userdrop”);

    //Note: when changing drop down values, we also need to use the gform_admin_pre_render so that the right values are displayed when editing the entry.
    add_filter(“gform_admin_pre_render”, “populate_userdrop”);

    function populate_userdrop($form){

    //only populating drop down for form id 1- if editing this change to your own form ID
    if($form[“id”] != 1)

    return $form;

    //Creating item array.
    $items = array();
    // Get the custom field values stored in the array
    // If editing this lookup where you would like to get your data from
    // this example loads through all users of the website
    $metas = get_users();

    if (is_array($metas))
    {
    // in this example we just load the display_name for each user into our drop-down field
    foreach($metas as $meta)
    $items[] = array(“value” => $meta->user_email, “text” => $meta->display_name);
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter nd54448

    (@nd54448)

    Hi again,
    Let me put this question differently : is there a way to create a WP user from CAS user ? (like CAS Maestro ?)
    thanks

    Plugin Author pkarjala

    (@pkarjala)

    Hi @nd54448,

    To clarify, you want to be able to export a user list of both the WP Users and the users listed in the Authorizer Access List who do not yet have a WordPress account?

    Authorizer automatically generates a WP User from the Authorizer Approved Access List the first time a user in that list successfully logs in via CAS. Otherwise, a WP User is not created until that time.

    You can pull the data about the current Authorizer Users List by doing:

    $users_list = get_option( 'auth_settings_access_users_approved' );

    and then iterating through the values in $users_list[i]['email'] to pull out the email addresses. This is all the information that Authorizer stores in terms of approved users; as long as your usernames are meant to match the first part of the email address, i.e., ‘[email protected]’ would be ‘name’, you could store the substring for login username information.

    Note that this list may include users who are ALSO in the already parsed WordPress Users list; you will need to check for duplicates. Authorizer maintains a “mirror” of the users already existing in WordPress for keeping track of role data.

    We do not (to my knowledge) currently have a hook to pull this data.

    Hope this helps!

    Thread Starter nd54448

    (@nd54448)

    Hi
    What I would need is to have automatically a user created as WP user when he is approved for the first time.
    I see in the Authorizer list some users that can connect to WP but which are NOT listed in the standard WP Users panel.
    Is it normal or is it my setup ?
    I am not sure I am very clear,
    Thanks for help
    N

    Thread Starter nd54448

    (@nd54448)

    Hi again,

    Sorry for bothering you : my mistake. I was looking at the Users list after I approved but before a new connection of the user. You are right, when the new user connects the user is created and not when the new user is approved (which makes sense).
    Thanks again
    N

    Plugin Author pkarjala

    (@pkarjala)

    No problem, glad that we were able to help clarify!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘CAS users and WP users’ is closed to new replies.