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.

Website and forum now closer together (#news_83)

Login / Search

 [ Join | More ]

Website and forum now closer together (#news_83)

This is a spacer post for an ocPortal comment topic. The content this topic relates to: Website and forum now closer together

Right, so how did I do this ;)? Well, ocPortal doesn't support it out of the box, but thanks to our override system and my coding knowledge, I just needed to make some very minor changes. I knew the 'do_comments' function in sources/feedback.php handled the comments, so I took that function and made some changes, and saved my new function in sources_custom/feedback.php as follows:



function do_comments($allow_comments,$module,$id,$self_url,$self_title,$forum=NULL)

   if ((get_option('is_on_comments')=='0') || (!$allow_comments)) return;

   if (!has_specific_permission(get_member(),'comment',get_page_name())) return;



   if ($post!='') enforce_captcha();


   if (is_null($forum)) $forum=get_option('comments_forum_name');

   $full_title=$self_title.' (#'.$module.'_'.$id.')';

   if ($post!='') assign_refresh($GLOBALS['FORUM_DRIVER']->topic_link($GLOBALS['FORUM_DRIVER']->get_tid_from_topic($full_title,$forum)),$forum);


This was made possible by one of our new ocPortal-3 features - per-function overriding. I just wanted to change one function so instead of overriding a whole file full of them (which would have caused conflicts should I need to fix yet-unknown bugs in those) I just did one.

I admit that whilst this is a nice architectural thing, most people don't know how to code PHP. However lots do and I'm hoping more people will be publishing this kind of thing in addon form in the future.

Last edit: by Chris Graham

1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: