• Resolved mowlman

    (@mowlman)


    Subscriber is automatically checked for Default Role, where is this being set? I would like a different role to be automatically checked instead of Subsciber.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter mowlman

    (@mowlman)

    Is there a way to override or hook this change so I don’t lose when I update?

    I found where default role is being set within importer.php around line 718

    I commented out original which had checked=’checked’

    if($key == "subscriber")
    	//echo "<label style='margin-right:5px;'><input name='role[]' type='checkbox' checked='checked' value='$key'/>$value</label>";
    	echo "<label style='margin-right:5px;'><input name='role[]' type='checkbox'  value='$key'/>$value</label>";
    	else
    	echo "<label style='margin-right:5px;'><input name='role[]' type='checkbox' value='$key'/>$value</label>";
    						}

    Thank you for your time

    Plugin Author Javier Carazo

    (@carazo)

    @mowlman,

    If you want, we continue this by this thread.

    Thread Starter mowlman

    (@mowlman)

    Yes. We have a process where we have customers sign up to be in a special shopper group. We were going to use your CSV import to import the users from our other site which happens a couple times a week. We are not using Subscriber so much but our new shopper rule called Contractor1 which will be the case 99% of the time. So i thought if I do Not have anything automatically checked, when we perform an import we can check the appropriate role as needed.

    Sorry for the similar thread, i will go in and close it or reference this thread.

    I just don’t know if I can override within my functions.php file somehow or I will just have to keep re-applying the change after each update.

    Plugin Author Javier Carazo

    (@carazo)

    @mowlman,

    Most of the users want to upload their users as “Subscriber” so it would be bad for most of the users do it as you want.

    It has no sens to make a hook here, maybe the best solution would be to “remember” the last selection.

    What do you think about it? Could you help us with the code or maybe with a little donation?

    Tell me.

    Thread Starter mowlman

    (@mowlman)

    Yes, having option saved within user_meta would work. Have not checked yet, are you already using a specific meta key?

    Plugin Author Javier Carazo

    (@carazo)

    @mowlman, it would be a custom develop.

    Thread Starter mowlman

    (@mowlman)

    Hello Javier,
    I can try to make time to code it, I just wasn’t sure if you were already using a specific meta_key within the usermeta table for Import Users From CSV with Meta , something beginning with IUCM for example. Just wanted to be consistent with any of your other code that might be using the usermeta table

    So meta_key would be something like: iucm_default_role
    meta_value: Subsriber would be an example value.

    I’ll have to also edit importer.php to save and read in the meta key / value pair

    My initial thought was to save the default role within the usermeta table so each user could have their own default, but could also just possibly use the wp_options table?

    Plugin Author Javier Carazo

    (@carazo)

    Uhm… not you should use the same way the plugin use in other options.

    If you don’t do it, we cannot include any code in the plugin.

    If you are not sure about how to do it, we will include it in future features. If you need it fast, send us a mail and we talk: contacto@codection.com.

    Thanks.

    Javier

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How To Set Default User Role’ is closed to new replies.