Wednesday, December 15, 2010

MODx 2.0.5 form customization for profile

The new form customisation for MODx 2.0.5-pl seems to only cater for resource create/update.

If you need a form customization for user profile, you may do it by adding a plugin on initialized manager with event "OnManagerPageInit":
-----------
define("IS_PROFILE_MODULE", $_GET["a"] == 71? true: false);
if (IS_PROFILE_MODULE) {
$modx->regClientStartupScript("url to your file.js",true);
}
-----------

URL to your file.js:
-----------
Ext.onReady(function() {
doHideProfileTabs();
});

function doHideProfileTabs() {
if (!Ext.getCmp("modx-panel-profile-tabs")) {
setTimeout("doHideProfileTabs()", 1000);
return;
}

MODx.hideTab("modx-panel-profile-tabs","modx-panel-profile-update");
MODx.hideTab("modx-panel-profile-tabs","modx-profile-recent-docs");
//MODx.hideTab("modx-panel-profile-tabs","ext-comp-1020"); //change password
Ext.getCmp("modx-panel-profile-tabs").setActiveTab(2);
}
-----------
Please take note: The hidden tab is still in the tabs container, therefore setactivetab have to reflect the index of the original position.

No comments: