Topic: Preventing a member from reading their inbox until field completed
There are times I create a new field in the control panel that I want all members to fill out. No problem with new members -- I'll make it a required field when they sign up.
For existing members who signed up before the new field was created, they need to edit their profile to update the new field.
You can send existing members a message asking them to update, but if your members are like my members, they don't always do what you ask.
Since I wanted existing members to update their profile for the new field, I coded the inbox template so existing members could not read their inbox messages until they updated the new field in their profile.
Here is how (I'm using version 2.5.3 but it should work for all versions):
[START CODING NOTES]
OPEN: account_messages_inbox.tpl (note this is the template used for members to read the messages in their inbox.)
FIND:
Find the form in the template. On my template it started around line 110 and ended around line 178 but it should be easy to find. Just look for something like: <form name="messages" method="post" action="{virtual_path}{messages_delete_link}"> for the start of the form and </form> for the end of the form.
BEFORE: <form name="messages" method="post" action="{virtual_path}{messages_delete_link}">
ADD: <!-- IF session.profile_matter --> (here you want to use the label you assign to the field when creating it in the CP. In my case the label name was "matter")
FIND: </form>
AFTER ADD:
<!-- ELSE -->
Put your message here telling the member they need to update the new field in their profile. You can format it so it is pretty, put a link to "edit member's profile" etc.
<!-- ENDIF -->
[END OF CODING NOTES]
That's it. Now when an existing member has a message in their inbox, they will not have access to their messages until they updated the new field in their profile. After they updated their profile, the above message after the <!-- ELSE --> statement will go away and they will have access to the messages in their inbox.
You also could use more than one field -- just use AND in your IF statement:
<!-- IF session.profile_matter AND session.profile_country -->
Last edited by db3204 (2010-10-18 15:52:30)