1

I am creating a little front end admin area for a client.

I am setting it up so they can administrate users on the front end.

One feature I would like is for the Administrator to be able to Register Members using the FreeMember Register Form on the front end.

I have it all setup although obviously since the Administrator is Logged in they can not register a member because the module is picking up they are logged in and giving the following message "You are already registered and logged in."

Is there a way we can override this?

1
  • I would also like to give the Administrator the ability to edit member details from a central area, bring up the members details within the Update Profile Tag - something along these lines: {exp:freemember:update_profile return="{segment_1}/{segment_2}/success" member_id="{segment_3}" require="current_password" error_handling="inline" error_delimiters='<span class="error">|</span>'} Jun 8, 2013 at 2:56

2 Answers 2

2

Unfortunately FreeMember (or even other Member modules) wont be able to help with what you're trying to achieve there. When a member is logged it they are given a unique session ID which is stored in the database in the exp_sessions table. This may be with session alone, cookies alone, or with both.

So if the user is logged in as Admin or anyone else then they wont be able to create a new member from the front-end templates.

Unfortunately most of EE's native CRUD functionality is locked in the CP so it's not that simple to work with much other than regular channel entries using Safecracker from the front-end templates. Even EE's own API mainly just provides a way to retrieve channel and category information and is only available to the back-end.

Thankfully there is now some light at the end of the tunnel thanks to Ben Croker and Open API. It's an open source API to provide CRUD functionality outside of the CP and includes Member functionality. It's nicely documented but you'd really need to take a look through and look to integrate that into your site to enable the functionality you're after. FreeMember alone wont help you to build a member management interface in your front-end templates.

2
  • 1
    Thanks for your response. I have ended up using Solspace User and FreeMember together to achieve what I am after. So I am happy. Jun 9, 2013 at 9:31
  • Interested in how you achieved this Trent as trying something similar. How did you combine User and FreeMember add-ons for registration? Dec 9, 2013 at 12:09
0

In EE 2, you can modify can_register() function, of freemember_lib.php, to check that current user belongs to editors or admins group, instead of just checking that user is not loged in, as follows (between START and END):

—-
public function can_register()
{
// do we allow new member registrations?
if (ee()->config->item(‘allow_member_registration’) == ‘n’) {
return lang(‘mbr_registration_not_allowed’);
}
// is user already logged in?
/* START */
$eh_auth = new ehampstead_Auth;
if (!$eh_auth->isEditUsersAllowed() && (ee()->session->userdata(‘member_id’) != 0)) {
/* END */
return lang(‘mbr_you_are_registered’);
}
}
—–

Everything else works seamlessly, except that you’ll need to disable email validation e-mail, if you require user e-mail validation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.