Posted in : Plugins & Widgets
This plugin adds a shiny new tab to your users profiles tab in admin and allows your users to have such delights as avatars, signatures, location. It also adds the ability for each user to enter their time offset from the server and set the date and time formats that they prefer to use, although that bit means you need to do a tad of skin work
These extra profile fields, and settings, can then be used to enhance your current skin and there's also the ability to display each/any users profile instead of that ugly "edit profile" page that you get in the stock evo skins. There's a setting to allow you to restrict the viewing of profiles to logged in members so that the spamming arses don't get access to any details like aim/msn/etc
There's actually a couple of ways that you can call up the new settings in your skin. The individual methods are listed below. I'll ( try and ) explain the second method after them all ![]()
PHP:
<?php | |
$Plugins->trigger_event( 'UserAvatar', array( | |
'display' => true, // echo the results | |
'block_start' => '<div class="userAvatar">', // html used before the <img> tag | |
'block_end' => '</div>', // html used after the <img> tag | |
); | |
?> |
PHP:
<?php | |
$Plugins->trigger_event( 'UserSignature', array( | |
'display' => true, // echo the results | |
'block_start' => '<div class="userSignature">', // html used before the signature | |
'block_end' => '</div>', // html used after the signature | |
); | |
?> |
PHP:
<?php | |
$Plugins->trigger_event( 'UserSignature', array( | |
'display' => true, // echo the results | |
'block_start' => '<div class="userLocation">', // html used before the location | |
'block_end' => '</div>', // html used after the location | |
); | |
?> |
PHP:
<?php | |
$Plugins->trigger_event( 'UserSignature', array( | |
'block_start' => '<p class="userDateTime">', | |
'block_end' => '</p>', | |
'display' => true, | |
'output_format' => '$date$ @ $time$', // $date$ && $time$ will be replaced with users preferred format for date and time | |
); | |
?> |
PHP:
// for $Item use : | |
'localdatetime' => $Item->get( 'datecreated' ); | |
// for comments use | |
'localdatetime' => $Comment->get( 'date' ); |
An alternative method is to use the skintag call and pass it multiple parameters at the same time. It looks a tad more complicated but it really isn't that bad
Rather than repeat what's in the plugin code I'll just copy + paste it here and then try and explain it ![]()
PHP:
/** | |
* This is gonna be a doozy to write :p | |
* Displays all the various bits and bobs from the users profile | |
* Triggers event AMProfileSkinTag() to allow other plugins to hook in ;) | |
* | |
* @param array $params | |
* avatar - html output $avatar$ replaced with <img> tag for users avatar | |
* joined - html output $date$ && $time$ replaced with date/time user registered, display in current users preferred format and time offset | |
* location - html output $location$ replaced with users location | |
* name - html output $name$ replaced with users name ( replaces 'profile' if no linked profile ) | |
* posts - html output $posts$ replaced with total posts and comments by user | |
* profile - html output $profile$ replaced with profile link | |
* signature - html output $signature$ replaced by users signature | |
* website - html output $website$ replaced by website url, $name$ replaced with users preferred name | |
* no_guests - html output displayed when telling guests to piss off | |
* profile_display - boolean are we displaying the profile | |
* ouput_format - html output | |
* replacement vars | |
* $avatar$ - replaced with avatar html if set | |
* $joined$ - replaced with joined html if set | |
* $location$ - replaced with location html if set | |
* $posts$ - replaced with posts html if set | |
* $profile$ - replaced with profile html if set | |
* $signature$ - replaced with signature html if set | |
* $website$ - replaced with website html if set | |
* | |
*/ | |
function SkinTag( $params ) | |
{ | |
$params = array_merge( array( | |
'signature' => '<p class="userSignature">$signature$</p>', | |
'profile' => '<p class="userProfile">$profile$</p>', | |
'name' => '<p class="userName">$name$</p>', | |
'avatar' => '<p class="userAvatar">$avatar$</p>', | |
'datetime' => '<p class="userDateTime">$date$ @ $time$</p>', | |
'location' => '<p class="userLocation">$location$</p>', | |
'joined' => '<p class="userJoined">$date$</p>', | |
'posts' => '<p class="userPosts">$posts$</p>', | |
'website' => '<p class="userWebsite"><a href="$website$" title=" '.sprintf( $this->T_( 'visit %s\'s website' ), '$name$' ).' ">'.get_icon( 'www', 'imgtag' ).'</a></p>', | |
'no_guests' => $this->T_( 'You need to be a registered member to view profiles' ), | |
'profile_display' => false, | |
'output_format' => '', | |
), $params ); |
Looks simple huh ?
The main value is the output format, this is where you get to choose what's spat out and in which order. Continuing in my copy + paste fashion this is how it's called for the comments on my blog :
PHP:
<?php | |
$Plugins->call_by_code( 'am_profiles', array( | |
'obj' => $Comment, // change this to $Item for posts or $current_User for profiles | |
'profile' => '<span class="profileLink">$profile$</span>', | |
'name' => '<span class="userName">$name$</span>', | |
'avatar' => '$avatar$', | |
'posts' => '<p class="postCount">Posts : $posts$</p>', | |
'joined' => '<p class="userJoined">Joined : $date$</p>', | |
'location' => '<div class="userLocation">Location : $location$</div>', | |
'output_format' => '$profile$'."\n" | |
.'$avatar$'."\n" | |
.'$posts$'."\n" | |
.'$joined$'."\n" | |
.'$location$'."\n" | |
) ); | |
?> |
Displaying profiles is pretty similar to the code I pasted above. The main difference is that you want all fields and you pass on an extra parameter to tell the plugin that it's displaying the profile as opposed to just showing the users fancy new settings. When you do that the plugin will automatically trigger any other plugins that have the right hooks
Rather than re-pasting the sample profile pages code ( which is included in the zip ), you can see it here ( Sample _profile.disp.php ). You can just drop that page into your skins folder and it'll work
To enable other plugin developers to add their own profiles stuff this plugin adds a few new hooks. To use them you need to inform the core that you can react to them with the following :
PHP:
function GetExtraEvents() | |
{ | |
return array( | |
'AMProfileTabAction' => 'AdminTabAction() when on our profile tab', | |
'AMProfileTabPayload' => 'AdminTabPayload() when on our profile tab', | |
'AMProfileSkinTag' => 'Triggered when our SkinTag() is called', | |
); | |
} |
The events should be pretty self explanatory and are passed the following parameters :
PHP:
$Plugins->trigger_event( 'AMProfileTabAction', array( | |
'AMProfileUrl' => $this->url, | |
'user_ID' => $user, | |
) ); |
PHP:
$Plugins->trigger_event( 'AMProfileTabPayload', array( | |
'AMProfileUrl' => $this->url, | |
'Form' => & $Form, | |
'user_ID' => $user, | |
) ); |
PHP:
$Plugins->trigger_event( 'AMProfileSkinTag', array( | |
'AMProfileUrl' => $this->url, | |
'output_format' => $params['output_format'], | |
'user_ID' => $user, | |
) ); |
So, now that you've read all that, go download the plugin ( am_profiles.zip ) and enjoy your shiny new tab ![]()
¥
Posted in : Techno Babble
Finally, I've mostly integrated the old blogrum code with InnerVisions .... I've even started a tutorial on how to add a blogrum to your own b2evolution blog .... don't get excited though, it's nowhere near finished and I'm not in any great rush
. There's still a fair amount of work to do with it before it's anywhere near the end result I have in mind, and the skins a tad shagged in IE6, but I'll be re-skinning it as soon as I've got all the code working and testing, so either put up with it or switch to a browser that it does work in ![]()
I've decided that I can't be arsed importing all the current blogrums posts/comments/users, it's more hassle than it's worth so I'll just leave the current version where it is and shut down the ability to post/comment there. I also haven't redone the ability to create a new post from the frontend, I'll work on that when I get more free time. For the moment it's only linked in my drop down menus as I'd need to redo the header graphic to add it to the menu buttons, and I'm liable to go for a whole new skin if I have to go to that effort anyway ![]()
Anyway, feel free to have a play, and let me know if you find any bugs/quirks ![]()
¥
Posted in : Techno Babble, Skins, Hacks, Plugins & Widgets
On the grounds that it's often easier to show something than try explaining it .....go visit the blogrum. Before you ask, no it's not ready for release yet, I need to sort out some permissions stuff to do with comments and tidy up the code and css ..... cos it's a tad messy in there ..... and then it's gonna take a mammoth post to explain what it can do, how, where, why and when. The good news is that it's pretty much just a trick skin with a couple of plugins thrown in, although I have a few more plugins in the works to make it work even more like a forum.
Registration is open, so if you want to have a play then feel free, although guest users can comment in the chatter blogrum so if all you want to do is spam me then there's no need to even register ![]()
¥