Attempting to add transparency to Profile Customizer/Need help

Hello all,

I'm trying to make a modification to the profile customizer to allow for transparent backgrounds. So for I have only been able to add code to BxProfileCustomizeTemplate.php (modules/boonex/profile_customize/classes) in order to display the field to allow the user to select a transparency in a drop-down box (this field displays right below the Color selector using the Background customize option). I have no idea where to go from here or what CSS files I need to change in order to add the opacity option. Could anyone shed some insight into this or let me know if I'm on the right track? Thanks in advance!

Quote · 8 Mar 2011

Solved

Quote · 10 Mar 2011

How did you solve it?

It is good to place your solutions on the web site for others who may have the same problem.

There are none so blind as those that will not see.
Quote · 10 Mar 2011

Of course, sorry I wasn't sure there was any interest in this mod. The solution to add a background transparency option involves changes in two of the PHP files in /modules/boonex/profile_customize/classes/, /templates/base/css/common.css, and the addition of a language key. I will describe the changes below. The only problem I having with this mod so far is that ideally, I only want the background of the blocks on the profile page to be transparent. Currently, the entire block, including content inherit the transparent property. I'll update this thread when I figure it out, or maybe someone else can chip in too. I've tested this in D7.0.4.

1)

Around line 645 in /modules/boonex/profile_customize/classes/BxProfileCustomizeTemplate.php, the transparency item needs to be added to the inputs array like so. In this case I want the transparency option to appear after the color option, so I position the code accordingly (changes in red):

'params' => array (),

'inputs' => array(

'color' => array(

'type' => 'text',

'name' => 'color',

'value' => isset($aVars['color']) ? $aVars['color'] : '',

'caption' => _t('_bx_profile_customize_color'),

'display' => true,

),

//Start profile customizer additions - Marvin

'transparency' => array(

'type' => 'select',

'name' => 'transparency',

'values' => array(

-1 => _t('_bx_profile_customize_default'),

0 => _t('_bx_profile_customize_none'),

1 => '10%',

2 => '20%',

3 => '30%',

4 => '40%',

5 => '50%',

6 => '60%',

7 => '70%',

8 => '80%',

9 => '90%',

),

'value' => isset($aVars['transparency']) ? $aVars['transparency'] : '',

'caption' => _t('_bx_profile_customize_transparency'),

'display' => true,

),

//End profile customizer additions - Marvin

'useimage' => array(

'type' => 'custom',

'name' => 'useimage',

'caption' => _t('_bx_profile_customize_use_image'),

'content' => ''

),

'image' => array(

'type' => 'file',

'name' => 'image',

'value' => isset($aVars['image']) ? $aVars['image'] : '',

'caption' => _t('_bx_profile_customize_image'),

'display' => true,

),

'repeat' => array(

'type' => 'select',

'name' => 'repeat',

'values' => array(

'default' => _t('_bx_profile_customize_default'),

'no-repeat' => _t('_bx_profile_customize_no'),

'repeat' => _t('_bx_profile_customize_repeat'),

'repeat-x' => _t('_bx_profile_customize_repeat_x'),

'repeat-y' => _t('_bx_profile_customize_repeat_y'),

),

'value' => isset($aVars['repeat']) ? $aVars['repeat'] : '',

'caption' => _t('_bx_profile_customize_repeat'),

'attrs' => array(

'multiplyable' => false

),

'display' => true,

),

'position' => array(

'type' => 'select',

'name' => 'position',

'values' => array(

'default' => _t('_bx_profile_customize_default'),

'left top' => _t('_bx_profile_customize_top_left'),

'center top' => _t('_bx_profile_customize_top_center'),

'right top' => _t('_bx_profile_customize_top_right'),

'left center' => _t('_bx_profile_customize_center_left'),

'center center' => _t('_bx_profile_customize_center'),

'right center' => _t('_bx_profile_customize_center_right'),

'left bottom' => _t('_bx_profile_customize_bottom_left'),

'center bottom' => _t('_bx_profile_customize_bottom_center'),

'right bottom' => _t('_bx_profile_customize_bottom_right')

),

'value' => isset($aVars['position']) ? $aVars['position'] : 'default',

'caption' => _t('_bx_profile_customize_position'),

'attrs' => array(

'multiplyable' => false

),

'display' => true,

),

'page' => array(

'type' => 'hidden',

'name' => 'page',

'value' => $sPage,

),

'trg' => array(

'type' => 'hidden',

'name' => 'trg',

'value' => $sTarget,

),

)

 

2)

Around line 761 in /modules/boonex/profile_customize/classes/BxProfileCustomizeModule.php, the following code needs to be added to the end of the switch statement. This is the code that will actually set the CSS values according to the selected transparency (changes in red):

switch ($sKey)

{

case 'color':

$sParams .= 'background-color: ' . $sValue . ';';

if (!isset($aParam['image']))

$sParams .= 'background-image: none;';

break;

 

case 'image':

if (isset($aParam['useimage']))

$sParams .= 'background-image: url(' . $this->_getImagesPath() . $sValue . ');';

else

$sParams .= 'background-image: none;';

break;

 

case 'repeat':

$sParams .= 'background-repeat: ' . $sValue . ';';

break;

 

case 'position':

$sParams .= 'background-position: ' . $sValue . ';';

break;

//Start profile customizer additions - Marvin

case 'transparency':

$sParams .= 'filter: alpha(opacity=' . ($sValue*10) . ');' . 'opacity: ' . ($sValue/10) . ';' . '-moz-opacity:' . ($sValue/10) . ';';

break;

//End profile customizer additions - Marvin

}

 

3)

Around line 247 in /templates/base/css/common.css, the following CSS code needs to be added to .designBoxFirst. This is the actuall CSS for the transparency, tested in all three major browsers (changes in red):

.disignBoxFirst {

border:1px solid #CCC;

margin-bottom:10px;

background-image:url(../images/head_cutting.gif);

background-repeat:repeat-x;

background-color: transparent;

position:relative;

/*Start profile customizer additions - Marvin*/

filter: alpha(opacity=100);

opacity: 1;

-moz-opacity:1;

zoom: 1; /*Hack for IE*/

/*End profile customizer additions - Marvin*/

}

 

I hope this modification is helpful to someone in the Unity-verse. And suggestions or questions welcome.

Quote · 14 Mar 2011

This is starnge, I did this on my my site1 and worked fine but then i tried on site 2 and it did not work

could it be because of the location of site2?

site1 is on public_html

site 2 is on public_html/site2

 

?????

Quote · 19 Jan 2012

 

This is starnge, I did this on my my site1 and worked fine but then i tried on site 2 and it did not work

could it be because of the location of site2?

site1 is on public_html

site 2 is on public_html/site2

 

?????

 anyone?

Quote · 21 Jan 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.