PDA

View Full Version : Allow members to opt-out of column?


Andy R
09-30-2008, 01:47 PM
I am currently working on a new side column for my sites. It's going to be 300 pixels wide and include a couple new ad placements. Since this is a change from the past, I'd like to be able to allow the members to opt-out of seeing this side column on all the pages if they choose. Do you have any suggestions on how I can give them an option to hide a column from their UserCP?

I want the page to expand if the column is hidden so it look just like the page does currently before adding the side column.

If this were only vBulletin I could use template conditionals and a user profile field to do this. I would set the conditional so the profile option is only available to members of a certain usergroup and then when the templates are rendered it would only hide if member was part of X usergroup and had also set value of Profile field to 'hide'. I just don't know how to do this with a whole column and CMPS.

Thanks in advance for any guidance on how to do this.

Regards,

Andy

PhilMcKrackon
09-30-2008, 05:57 PM
You should be able to do this with conditionals. Wrap the columns in the adv _portal with VB conditionals. Something like this maybe?



<if condition="$bbuserinfo[field11] != 'NO'">
<table align="center" class="page" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<if condition="$bbuserinfo[field12] == 'YES'">
<if condition="$show['left_column']">
<td width="$vba_style[portal_leftcolwidth]"<if condition="$show['center_column'] OR $show['right_column']"> style="padding-$stylevar[right]: $vba_style[portal_colspacing]px"</if>>
$home[leftblocks]
</td>
</if></if>
<if condition="$bbuserinfo[field13] == 'YES'">
<if condition="$show['center_column']">
<td valign="top">
$home[centerblocks]
</td>
</if></if>
<if condition="$bbuserinfo[field14] == 'YES'">
<if condition="$show['right_column']">
<td valign="top" width="$vba_style[portal_rightcolwidth]"<if condition="$show['center_column'] OR $show['left_column']"> style="padding-$stylevar[left]: $vba_style[portal_colspacing]px"</if>>
$home[rightblocks]
</td>
</if></if>
</tr>
</table>
</if>




This scenario should work assuming that

Field 11 would have the question like 'Show CMPS columns?' YES / NO
Field 12 would have the question like 'Show CMPS Left column?' YES / NO
and so on.

Of course you would have to edit your field numbers and values accordingly. I use radio button fields for my conditionals that I have for my users to control data in the CMPS modules. You will also have to wrap the padding (left or right) depending on what columns are shown.