by
tim » Fri Feb 13, 2015 10:34 pm
So sorry if you have already put some time into this but no I don't need this anymore, went a slightly different route with this that works even better for me with the help of a friend. I edited my original post but must not have been obvious enough, sorry for any unnecessary work!! I really do appreciate the help though!
No trouble. I only work on these problems when they're fun and educational for me. In case it helps you or someone else, here are the ideas I had.
I’m going to assume that you were able to derail the registration process like KK suggested so that instead of activating the account an email is sent to the admin to verify the member's credentials.
At this point, the account will be set up in the members.php template, but it will be deactivated by being 'unpublished' in the admin panel. To activate an account, the admin simply hits the 'published' button and saves the page. There is no provision for doing this in bulk as far as I know. Each account will have to be activated separately.
When it comes to sending an email to the member letting them know that their account is active, what if the admin... sends them an email? They could keep a stock response that they copy and paste into an email and fire it off using an administrator's email account. Like @KK mentioned, it wouldn't be possible (or appropriate) to send someone their password. Just tell them they can login using the email and password they used to sign up and send a link to the members section. If they forgot their password, Couch has provisions for them to reset it.
If you would prefer to allow the admin to use the website for notification, you can create a simple form for them to use. Let's start by restricting access so only administrators can use it.
- Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Notify' hidden='1' access_level='7' />
The email address is the only thing needed for the form to send a notification. The following is essentially lifted straight from the documentation.
- Code: Select all
<cms:form method="post">
<cms:if k_success >
<h3>Notification has been sent to <cms:show frm_email />.</h3>
<cms:send_mail from='<cms:k_email_from />' to='<cms:show frm_email />' subject='Access to Members Area Approved'>
Your access to the members area of the Affiliated Association of Organizations has been approved. Access the online resources at aao.org/resources/ using your email address and the password that you used to register.
<cms:show k_success />
</cms:send_mail>
</cms:if>
<cms:if k_error >
<h3>Failed to submit form</h3>
<cms:each k_error >
<cms:show item /><br>
</cms:each>
</cms:if>
Email: <cms:input type="text" size="10" name="email" /> <br />
<cms:input name="submit" type="submit" value="Send Notification" />
</cms:form>
This will do the job, but let's refine it. We don't want to have to type in a bunch of email addresses. That's too much work and prone to error. In addition, I'd like to be able to handle multiple notifications at once.
This form uses a checkbox for the input that shows all member emails using the cms:pages tag. The newest will be at the top of the list. A notification is then sent to each of the selected emails.
- Code: Select all
<cms:form method="post">
<cms:if k_success >
<h3>Notification has been sent to:</h3>
<cms:each frm_email>
<cms:send_mail from='<cms:k_email_from />' to='<cms:show item />' subject='Access to Members Area Approved'>
Your access to the members area of the Affiliated Association of Organizations has been approved. Access the online resources at aao.org/resources/ using your email address and the password that you used to register.
<cms:show k_success />
</cms:send_mail>
<cms:show item/>
</cms:each>
</cms:if>
<cms:if k_error >
<h3>Failed to submit form</h3>
<cms:each k_error >
<cms:show item /><br>
</cms:each>
</cms:if>
Choose accounts to notify:<br>
<cms:input type="checkbox" name="email" opt_values="<cms:pages masterpage="members/index.php" >k_member_email | </cms:pages>" /> <br />
<cms:input name="submit" type="submit" value="Send Notifications" />
</cms:form>
You could refine this by only showing members activated during the last week or so. Of course, the admin still has to remember which members need to be notified.
This is OK. But what would be really nice is if Couch would keep track of who has been notified or not, and automate the process of notification. We'll start by adding a checkbox to the members template to indicate whether the member has been notified.
- Code: Select all
<cms:editable
name="notified"
label="Has the member been notified of their account activation? "
opt_values='Yes=1'
type='checkbox'
/>
Now we'll use the pages and db_persist_form tags to automate the whole process. This will be it's own separate template. When the admin visits the page, it runs through all activated, un-notified members, sends an email and checks the box. Let's see if it works.
- Code: Select all
<cms:pages masterpage='members/index.php'>
<cms:if notified='0' >
<cms:form
masterpage=k_template_name
page_id=k_page_id
mode='edit'
enctype='multipart/form-data'
method='post'
anchor='0' >
<cms:db_persist_form
_invalidate_cache='0'
notified='1' />
<cms:send_mail from='<cms:k_email_from />' to='<cms:show member_email />' subject='Access to Members Area Approved'>
Your access to the members area of the Affiliated Association of Organizations has been approved. Access the online resources at aao.org/resources/ using your email address and the password that you used to register.
</cms:send_mail>
<p><cms:show member_email /> has been notified.</p>
</cms:form>
</cms:if>
</cms:pages>
All of this code is untested, so I'm sorry if there are any errors. The last option in particular is an untested concept. Please try them. If you run into trouble, let us know and hopefully someone will be able to sort it out.