I though maybe someone might be interested in the working version of this userbot. Even if others might not want to do wiki linking this is the gist of a userbot. Here goes:
[code:1]
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$_PLUGINS->registerFunction('onBeforeUserProfileDisplay', 'do_halowikilinking');
/**
* halowiki.net linking in user profile
* @package Community Builder
* @author Peter Strömberg - PEZ - pezius@gmail.com
*/
function do_halowikilinking ($user, $ui, $cbUserIsModerator, $cbMyIsModerator) { // ui=1 front, ui=2 backend, 2* boolean
foreach ($user as $field => $value) {
$user->$field = preg_replace_callback("#\[\[(.*?)\]\]#s", 'bothalowiki_replacer', $value);
}
}
/**
* Replaces the WikiTagged words
* @return Wikilinked words
*/
function bothalowiki_replacer(&$matches) {
$result = split('\|', $matches[1]);
if (empty($result[1])) {
$result[1] = $result[0];
}
return '<a href="
halowiki.net/wiki/'.$result
[0].'" title="halowiki.net: '.$result[0].'" target="halowiki.net">'.$result[1].'</a>';
}
?>
[/code:1]
As should be obvious from the code this only works on Cb fields, all other data in the profile will remain untouched.
Possible uses of this kind of bot includes working on a specific field, be it a cb defined or user defined one. Birthday countdowns anyone?
I have sort of given up on trying to make some global joomla content bot/hack. I realized all components would need a plugin/hack for it to work as I want. Maybe some future version of joomla will make this task more realistic.