Thanks.
The most straightforward solution, I think, would be the use of folders as I initially suggested.
If we go by the docs (viewtopic.php?f=5&t=8063), the 'members' template (i.e. the template the cloned pages of which represent actual member accounts) and the 'profile' template (i.e. where the logged in user can modify her own data) are two distinct entities.
Let us keep it the same way.
So let us suppose the members template is named 'members.php' and the profile is 'profile.php'.
The config will have the following entry -
In the 'members.php', define folders for the membership type (e.g. 'gold' and 'silver').
Also define editable regions for *all* membership types.
The last point is important for you to understand as that is where you had the most difficulty.
Create all editable regions in the single template. So for example the 'designation' field will be shown only to 'gold' members, yet define it with all the other regions. A sample implementation -
// members.php
I am now assuming that (as you informed me), the admin will place each member account in one particular folder (e.g. gold or silver).
So now let us move to the 'profile.php' template.
We'll make one small modification to it. Just above the databound form, we'll place the following code -
The code above will simply set the current logged-in users folder (i.e. the membership type) in a variable named 'my_membership_type'.
So now while showing the form we can make use of the variable we got above to show/hide certain fields in the form depending on the membership type of the user.
In our example we had assumed that the 'designation' region will be shown only to 'gold' members. We can do that by a simple check as follows -
The full code would look like this (showing only the relevant parts) -
I think you should be able to adapt the technique to your own requirement.
Hope it helps.
The most straightforward solution, I think, would be the use of folders as I initially suggested.
If we go by the docs (viewtopic.php?f=5&t=8063), the 'members' template (i.e. the template the cloned pages of which represent actual member accounts) and the 'profile' template (i.e. where the logged in user can modify her own data) are two distinct entities.
Let us keep it the same way.
So let us suppose the members template is named 'members.php' and the profile is 'profile.php'.
The config will have the following entry -
- Code: Select all
$t['members_tpl'] = 'members.php';
In the 'members.php', define folders for the membership type (e.g. 'gold' and 'silver').
Also define editable regions for *all* membership types.
The last point is important for you to understand as that is where you had the most difficulty.
Create all editable regions in the single template. So for example the 'designation' field will be shown only to 'gold' members, yet define it with all the other regions. A sample implementation -
// members.php
- Code: Select all
<cms:template title='members' clonable='1'>
<cms:editable
name='name'
label='Name'
desc='Enter Your Name'
type='text' />
<cms:editable
name='designation'
label='Designation'
desc='Enter Designation Here i.e. Actor, Makeup artist etc.'
type='text' />
<cms:folder name='gold' title='Gold' />
<cms:folder name='silver' title='Silver' />
</cms:template>
I am now assuming that (as you informed me), the admin will place each member account in one particular folder (e.g. gold or silver).
So now let us move to the 'profile.php' template.
We'll make one small modification to it. Just above the databound form, we'll place the following code -
- Code: Select all
<cms:pages masterpage=k_member_template id=k_member_id>
<cms:set my_membership_type=k_page_foldername 'global' />
</cms:pages>
The code above will simply set the current logged-in users folder (i.e. the membership type) in a variable named 'my_membership_type'.
So now while showing the form we can make use of the variable we got above to show/hide certain fields in the form depending on the membership type of the user.
In our example we had assumed that the 'designation' region will be shown only to 'gold' members. We can do that by a simple check as follows -
- Code: Select all
<cms:if my_membership_type='gold' >
<p>Enter Designation:</p>
<cms:input class="login-input" id="designation" name="designation" placeholder="Your designation" type="bound" value="" />
</cms:if>
The full code would look like this (showing only the relevant parts) -
- Code: Select all
..
<cms:pages masterpage=k_member_template id=k_member_id>
<cms:set my_membership_type=k_page_foldername 'global' />
</cms:pages>
<cms:form
masterpage=k_member_template
mode='edit'
page_id=k_member_id
enctype="multipart/form-data"
method='post'
anchor='0'
class="login"
>
..
..
<p>Enter Name:</p>
<cms:input class="login-input" id="first-name" name="name" placeholder="First Name Last Name" type="bound" value="" />
<cms:if my_membership_type='gold' >
<p>Enter Designation:</p>
<cms:input class="login-input" id="designation" name="designation" placeholder="Your designation" type="bound" value="" />
</cms:if>
<input style="width:200px;" type="submit" name="submit" class="login-submit" value="Save"/>
</cms:form>
..
I think you should be able to adapt the technique to your own requirement.
Hope it helps.