I'm watching this thread, and will read the code, and if needed, try to implement the needed events into 1.0 stable, so that a plugin can handle this
Please Log in or Create an account to join the conversation.
beat wrote:
I'm watching this thread, and will read the code, and if needed, try to implement the needed events into 1.0 stable, so that a plugin can handle this
Thanks Beat ! I hope the code is clear enough.
I'll wait with the plugin until stable comes out.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Notexa wrote:
beat wrote:
I'm watching this thread, and will read the code, and if needed, try to implement the needed events into 1.0 stable, so that a plugin can handle this
Thanks Beat ! I hope the code is clear enough.
I'll wait with the plugin until stable comes out.
I've just checked how to do this, and added to 1.0 stable a new plugin API event "onBeforeUserProfileRequest", which gets fired at the very begin of any user profile request, and will allow you to execute your code right there, before the CB template is outputed.
Same event has other useful applications .
Thanks for your suggestion. Please continue sharing your excellent work on CB templating
Please Log in or Create an account to join the conversation.
I've managed to get a dynamic template per user.
It's still very alpha (meaning it are only code hacks nw) but I'm going to try to put it all in a plugin.
What did I do:
First I created a single dropdown field with the name cb_template. This field is populated with three values: dark, osx and webfx (just for testing purposes).
I'm going to put this in a plugin with a template preview.
Next I changed in comprofiler.class.php the function selectTemplate($ui):
Added to globals:
global $database, $my, $_REQUEST;
Right after the globals I added this:
if (ISSET($_REQUEST)) {
$query="SELECT cb_template FROM #__comprofiler WHERE id = ".$_REQUEST;
} else {
$query="SELECT cb_template FROM #__comprofiler WHERE id = ".$my->id;
}
$database->setQuery( $query );
$templates = $database->loadObjectList();
$template = $templates[0];
$templatedir=$template->cb_template;
if ($templatedir) $ueConfig=$templatedir;
Now each user has his own profile template. Users with no profile set get the default profile.
Anybody got an idea how I can add the changes to the selecttemplate function in a plugin ? I don't want to create a plugin that requires code hacks.
Post edited by: Notexa, at: 2006/04/13 12:50
Please Log in or Create an account to join the conversation.
Notexa wrote:
I've managed to get a dynamic template per user.
It's still very alpha (meaning it are only code hacks nw) but I'm going to try to put it all in a plugin.
What did I do:
First I created a single dropdown field with the name cb_template. This field is populated with three values: dark, osx and webfx (just for testing purposes).
I'm going to put this in a plugin with a template preview.
Next I changed in comprofiler.class.php the function selectTemplate($ui):
Added to globals:
global $database, $my, $_REQUEST;
Right after the globals I added this:
if (ISSET($_REQUEST)) {
$query="SELECT cb_template FROM #__comprofiler WHERE id = ".$_REQUEST;
} else {
$query="SELECT cb_template FROM #__comprofiler WHERE id = ".$my->id;
}
$database->setQuery( $query );
$templates = $database->loadObjectList();
$template = $templates[0];
$templatedir=$template->cb_template;
if ($templatedir) $ueConfig=$templatedir;
Now each user has his own profile template. Users with no profile set get the default profile.
Anybody got an idea how I can add the changes to the selecttemplate function in a plugin ? I don't want to create a plugin that requires code hacks.
Post edited by: Notexa, at: 2006/04/13 12:50
Thanks ALOT. Tested just now. The code does works...... Like u said, i dont think its necessary to build a plugins, just hope beat put this code in his next stable released.....
Please Log in or Create an account to join the conversation.