Site icon Hip-Hop Website Design and Development

wp_dropdown_roles() to switch possibility worth = code

I am making an attempt to switch a hardcoded dropdown record of roles in a plugin. At the moment that is the code:

echo '<choose identify="xf_user_role_' . $id . '" id="xf_user_role_' . $id . '">';
?>

<possibility worth='subscriber'
<?php echo ($xf_options['xf_user_role'][$id] == 'subscriber') ? "chosen='sure'" : ''; ?> >Subscriber</possibility>

<possibility worth='contributor'
<?php echo ($xf_options['xf_user_role'][$id] == 'contributor') ? "chosen='sure'" : ''; ?> >Contributor</possibility>

<possibility worth='writer'
<?php echo ($xf_options['xf_user_role'][$id] == 'writer') ? "chosen='sure'" : ''; ?> >Creator</possibility>

<possibility worth='editor'
<?php echo ($xf_options['xf_user_role'][$id] == 'editor') ? "chosen='sure'" : ''; ?> >Editor</possibility>

<possibility worth='administrator'
<?php echo ($xf_options['xf_user_role'][$id] == 'administrator') ? "chosen='sure'" : ''; ?> >Administrator</possibility>

</choose> 

This code is modified to :

echo '<choose identify="xf_user_role_' . $id . '" id="xf_user_role_' . $id . '">';
wp_dropdown_roles( );
?>
</choose> 

The dropdown record exhibits however choosing would not give the $xf_options …

The wp_dropdown_roles is not nicely documented within the Codex web page. I’ve tried a couple of alternative ways so as to add info into the () however am not getting it proper.

What’s the correct info for inside the ()?