HTML Logo by World Wide Web Consortium ( Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.

Adding a 'user online' icon that is configurable...

I want, on each message, where it shows the posts user information, to have a few things, the first is a user is online/offline little icon.  I did this back in v7, of course it's gone once I upgraded to v9.   But now I want to put it in as a configuration item where it can be turned on/off as I think this would be one of many small things that can be added to OCP in the future.

So in ocp_config (table), I added the following record, based on looking at what other on/off options related to the forum were:


INSERT INTO `ocp_config` (`the_name`, `human_name`, `c_set`, `config_value`, `the_type`, `eval`, `the_page`, `section`, `explanation`, `shared_hosting_restricted`, `c_data`) VALUES
('is_on_show_online', 'IS_ON_SHOW_ONLINE', 1, '0', 'tick', 'return \'1\';', 'SECTION_FORUMS', 'GENERAL', 'CONFIG_OPTION_is_on_show_online', 0, '');

admin_config.php handles the new config option automatically.  It was just a matter of looking in the database to see what other on/off items used as a return.  So I got that right.

Now, in lang/EN/ocf_config.ini  I had to add:


IS_ON_SHOW_ONLINE=Enable on/Offline image
CONFIG_OPTION_is_on_show_online=Show user online/Offline Icon on the left of each post for user that posted the message.

As the title used as 'explanation' in the db is used as the description on the config page, then I figured out you take off the CONFIG_OPTION_ and that is used as the label in the left column.   

In forum/pages/modules/topicview.php,  look for '//Avatar' and before that added:

Code (php)

// user online/offline
if (member_is_online($_postdetails['poster'])) {
} else {

Then search down for:

Code (php)


At the bottom of that list, add USER_ONLINE and IS_ON_SHOW_ONLINE lines:

Code (php)


Also, because when a user replies to a post, it shows previous posts below their input area, it calls OCF_TOPIC_POST.tpl when making that screen, so in  sources/ocf_posts2.php you also need to go down to the do_template part and add :

Code (php)


Next is modification to OCF_TOPIC_POST.tpl, add the is_on_show_online bit where you see it below.


   <div class="ocf_left_post_buttons {CLASS*}">

         <div class="ocf_post_back_to_top">
            <a href="#"><img title="{!BACK_TO_TOP}" alt="{!BACK_TO_TOP}" src="{$IMG*,top}" /></a>

   <div class="buttons_group post_buttons ocf_post_main_column">

Create a new file, OCF_TOPIC_POST_ONLINE.tpl :


<img  title="" alt="Online Status" src="{OSTATUS*}" />

This is how it looks, online and offline examples:

The ison.png and isoff.png I use are attached:

There are no pages beneath this page

There are no posts yet

CEDI change-log Post