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 'pt' icon that is configurable...

I don't like the whole 'whisper' thing, but I wanted a very small button that showed under a users data by their posts, so it was quick and easy to initiate a private topic (i.e. PM) with that user.

To start, we need to add a field into the ocp_config table for the new option:


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_pt_button', 'IS_ON_PT_BUTTON', 1, '1', 'tick', 'return ''1'';', 'SECTION_FORUMS', 'GENERAL', 'CONFIG_OPTION_is_on_pt_button', 0, '');

Next is lang/EN/ocf_config.ini, where I added the text for the config screen:


IS_ON_PT_BUTTON=Show PT button
CONFIG_OPTION_is_on_pt_button=Turn on/off an icon on the left of each post that allows users to start a PT with the member that made that post.

Next, in OCF_TOPIC_POST.tpl, added the code you can see below for PT button:


   <div class="ocf_left_post_buttons {CLASS*}">
         <div class="ocf_post_back_to_top">
              <!-- PT button -->
                <a href='{$PAGE_LINK,forum:topics:new_pt:{POSTER_ID}}'><img  title="Start Personal Topic" alt="Start Personal Topic" src="{PTBUTTON*}" /></a>
           <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">

In topicview.php, add the following code above // Avatar


               // PT Button:  Show for each user that is not the one viewing post, but not if guest
               if ( (get_option('is_on_pt_button')) && (!(is_guest())) && ($_postdetails['poster'] != strval(get_member())) ){
                 $do_pt_button = '1';
               } else {
                 $do_pt_button = '';

Then further down at the end of the rendered_post=do_template … added the following two…



Also, in sources/ocf_posts2.php, add the below text in the do_template call.   This will ensure that no missing language stuff happens when a user posts a reply.



Here is the graphic file I use for it:

There are no pages beneath this page

There are no posts yet

CEDI change-log Post