I ended up having to create a plugin and managed to debug the first troublesome bits.
Let me share my solution to my problem. I used the same approach for other aspects of the project. So I will give one example which can be duplicated for similar requirements.
I had my own custom fields which also had a link to a custom module. I had normalised tables which I wanted the custom fields to be taken from. The challenge was having to display the custom fields when webloginpe was called either when:
1) a user views his/her own profile for editing
2) another user/website visitor views that users profile
The major challenge was on 1)
My Solution:
I modified WebloginPE code and added my own Event(
OnBeforeViewEditProfile) in the code (I cannot see the line number coz I’m on notepad right now...not my PC. You can search for "$system_eventnames =" to find the code section):
File: webloginpe.class.php
// Create the additional MODx events if they do not exist
$system_eventnames = $modx->getFullTableName('system_eventnames');
$newEvents = array('OnBeforeWebSaveUser', 'OnBeforeAddToGroup', 'OnViewUserProfile','OnBeforeViewEditProfile');//designetic: added OnBeforeViewEditProfile
Then before a profile is viewed, I "invoked" the event. I wrote a corresponding WebloginPE function(scroll down in the "webloginpe.class.php" file for examples) which passed on the parameters I needed in my plugin.
Then I just needed to add &tableCheck to just one place where there is a WebloginPE call:
&tableCheck=`1`
This makes it create the Event and execute the code above.
The Event will then be added to MODx and you can see it in your plugin configurations.
I ticked this then "listened" to the event in my plugin code.
My plugin then created a placeholder which would be used in the template.
And thats it!