As you may know, there's one single permission that controls user's access to other user's creation - permission is called 'administer users'. It either gives access to full user's administration or to nothing.
On my system I have tiered users who are supposed to have some permissions in relation to user administration. But not all permissions. I basically need to be able to create user accounts (based on profile2) on the frontend url (not /admin/people/p2rp-create/user but eg. /add-user.
I know there's a way of rendering an existing Drupal registration form, not sure how to a) render profile2 form, or, to be precise, render profile2 form that includes forms for few created profile (I have 3 at the moment) b) make it create a user even tho user doesn't have 'administer user'
I played with the following for starters
function module_menu(){
$items['add-user'] = array(
'title' => 'Add user',
'page callback' => 'module_reg_form',
'access arguments' => array('access create customer'),
);
function module_reg_form(){
$user_register_form = drupal_get_form('user_register_form');
$form_state = array('profiles' => array('contact_details'));
$registration_with_profile_fields_form = profile2_attach_form($user_register_form, $form_state);
print(drupal_render($user_register_form));
}
This throws an error
EntityMalformedException: Missing bundle property on entity of type profile2. in entity_extract_ids() (line 7721 of /home/dreamweddings/www/dreamweddings.eu/public/includes/common.inc).