HTML Logo by World Wide Web Consortium (www.w3.org). 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 compo.sr 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:

Code

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:

Code

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:

Code

<div>
   <div class="ocf_left_post_buttons {CLASS*}">
      {EMPHASIS*}
      
      {+START,IF_EMPTY,{EMPHASIS}}{+START,IF_NON_EMPTY,{ID}}
         <div class="ocf_post_back_to_top">
          
              <!-- PT button -->
              {+START,IF_NON_EMPTY,{DO_PTBUTTON}}
                <a href='{$PAGE_LINK,forum:topics:new_pt:{POSTER_ID}}'><img  title="Start Personal Topic" alt="Start Personal Topic" src="{PTBUTTON*}" /></a>
              {+END}
           <a href="#"><img title="{!BACK_TO_TOP}" alt="{!BACK_TO_TOP}" src="{$IMG*,top}" /></a>
         </div>
      {+END}{+END}
             
    </td>
   </div>

   <div class="buttons_group post_buttons ocf_post_main_column">
      {BUTTONS}
   </div>
</div>

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

Code

               // 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…

Code

'DO_PTBUTTON'=>$do_pt_button,
'PTBUTTON'=>find_theme_image('personaltopic'),

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.

Code

'DO_PTBUTTON'=>'',
'PTBUTTON'=>'',

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