A new version for Open Community has just been released. This will be the last release this summer, as I will take some holidays until September, 15. Anyway I will be in contact, and will follow everything related to this. I hope will be not needed, but bugfixes will be provided on this time, just don’t expect new features before then.
This new Open Community release includes a completely new component, and with it you will have a new feature. This is the activity component that will record all site activity on a log: Post/Pages added or edited, users who commented something, when a user uploads a new picture or changes the profile picture…
This is the base, and developers can extend the activity log just by using a simple action and creating a hook that is used to display the format. I will try to post some instructions as soon as possible about how to do it.
The plugin does not only record the user events, also provides a way to display them. How to display it is up to you as you can do in your own format by using the templating system introduced on 0.8, just have to create your custom template to show the Activity Wall the way you want. You will find some sample templates you can use directly on your site or use as a base to extend the functionality. This templates are:
- User profile with activity log. You have to set the ‘Wall’ template on the profile settings. See how the sample walled profile looks.
- Activity wall page. Have to be set on activity wall settings page. This is always shown on the address /wall/username and you have to set a link to it in any template or page. See how default template looks.
- System activity. Shows the activity from all registered users. For this, you have to create a new page an set it on the activity wall settings page. See how default template looks.
In the future, some new features are planned for the activity wall, like to allow users inserting comments on it as small limited notes.
Hope you will enjoy this new release and this new feature component. Don’t forget to activate it on Alkivia General settings!
Imagine you want to show a user gallery anywhere on your site, outside the regular plugin gallery page. Perhaps you want to set the gallery as a footer for an author page, or anything you can imagine. The only thing you need to know on the file you want to include it, is the user ID or the user login you want the gallery of.
You just have to call a plugin existing function that does all it: aoc_gallery_content(). This function returns the HTML formated gallery if user have a gallery. It returns false if there is nothing to show.
You can call the function this way if you’re using inside the plugin (perhaps on a plugin template) :
<?php
if ( aoc_is_active('gallery') ) {
if ( false === ( $gallery = aoc_gallery_content($user_login_or_id) ) ) {
echo 'No gallery for this user';
} else {
echo $gallery;
}
}
Look I’m checking first that the gallery component is active to not broke anything if the component is disabled. If you will use outside the plugin, check that function exists instead checking if component is active:
<?php
if ( function_exists('aoc_gallery_content') ) {
// Same stuff seen above
}
The only parameter the function needs is self-explanatory. Pass the user ID or the user login. You will get the HTML gallery code if the user has images, if not, the function returns false.
The gallery output comes from the selected gallery template (on the settings page). Templates are located in the ‘templates’ directory, and those for gallery are prefixed ‘gallery-’. If you create your own template, upload it to this folder and select it on the settings page, you template output will be returned.
Open Community provides now a simple way to style your pages and chose what you want to output by creating your own template. You will need basic PHP knowledge to do it.
Inside the plugin directory, you will find a ‘templates’ directory. This is the default place where the plugin looks for templates, but this can be changed. To prevent loosing your own templates it is recommended to copy the templates folder anywhere outside the plugin folder. Just copy the templates folder anywhere you want, and set the constant AOC_TEMPLATES in your wp-config.php file. It have to look like this: define(’AOC_TEMPLATES, ‘/path/to/your/templates/directory’);
You have some samples in the templates folder, on each file header is a list of available variables to the template. (This variables content depend on the different components settings). This can be used as a guide to see the information you can show. Also looking at the samples, you can get an idea how to do ti get different presentations.
Al template filenames have a prefix which is used to look for the correct templates used on each component. When you write your own template, you have to set exactly the same prefix that you can see on provided samples. At this moment there are three prefixes, as we have three different components:
- ‘userlist-‘ Used for the user list output.
- ‘profile-‘ This is used for the user profile page. All users will use the same template.
- ‘gallery-‘ The user image gallery output.
Hope this helps you to customize your Open Community pages. As always, you can post your problems on the support forum.
UPDATE: This feature has been included on Open Community 0.9 and you can set it on the gallery settings. You have not to follow this instructions unless you want the image to be shown in a different way.
Perhaps you want to use the thumbnail from the user main image in the author pages in your blog. This can be done in a really easy way, but are two ways to do it.
In both examples we’re calling the same function, aoc_get_user_image() which expects three parameters: author_ID, CSS class, and true (To indicate that the we want the thumbnail instead the large image).
Editing the post template:
By default, WordPress single post page shows by calling the single.php file from your theme. You have to edit this file and include this code just before calling ‘the_content()’ function:
if ( function_exists('aoc_get_user_image') ) {
echo aoc_get_user_image($post->post_author, 'alignleft', true);
}
Adding a content filter:
This is the preferred method to do it, as you will embed the image inside the post content and you will have not to worry about loosing the content format. Just it will not work if your theme does not support the WordPress images styles and this does not occur on well designed themes.
In this case we will place the filter on the functions.php file of the theme, and we have to write this code:
function give_a_function_name( $content ) {
if ( function_exists('aoc_get_user_image') ) {
global $post;
$content = aoc_get_user_image($post->post_author, 'alignleft', true)
. $content;
}
return $content;
}
add_filter('the_content', 'give_a_function_name');
This will be included as an option in the next plugin version.
Just released Alkivia Open Community 0.8. I’m sorry it has been released with some delay and not all planed features were finally included on this release. Not included features have moved to the next 0.9 release.
The most important change in this version, is the new templating system. Now all pages use templates, and you can have as many templates for each page type as you want. On the plugin settings, you will be able to choose the template to use for each page. Templates are located on the plugin’s templates folder where you will find the default and sample templates.
If you write your own template, upload it to this folder. If you modify an existing template, it is recommended to give it its own name. Doing this way, you have to save your copy as every time you update the plugin, your templates will be deleted. There is a better way to do it:
- Copy the templates folder outside the plugin’s folder. (Copy it, don’t move). And at least leave on the copy the default templates (The plugin looks for them if other templates fail to load).
- Edit your wp-config.php file (that one that configures your WordPress). This file is normally located on your blog root directory.
- Add the following line to it:
- define(‘AOC_TEMPLATES, ‘/path/to/your/templates/directory’);
- Now you can place your templates on your custom directory and them will not be deleted when you update the plugin.
Other changes in this release include some settings to set the minimum megapixels for images, allow users to upload more than one image at once and a lot of internal code changes to prepare things for next versions.
I’m working on the next release for the Community plugin. Basically it will provide more stable code, some bugfixes, and some new features over the already existing ones. Most of the features will be some new settings, multi-upload for galleries, and the most significant will be a templating system for all plugin pages. With the templating feature, to create a different layout for the page and to adjust to your theme’ style.
From the next release, the plugin will change its name to ‘Alkivia Open Comunity’, as it is becoming a project itself and the list of future features I have is really long. I hope to be able to make releases more often than now, as you know, I’m working on other related projects and I’m trying to port as many features as I can into this project.