<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Control Center hook cc_panel and OKMSG</title>
        <description> I am trying to use the cc_panel hook.  I don&amp;#039;t want to completely override a CC panel, I am just introducing some additional processing.  So my module would prefer to keep $hook_info[&amp;quot;handled&amp;quot;] = false so that control.php will continue processing the panel as normal.

But, as part of the processing I might set $hook_info[&amp;quot;okmsg&amp;quot;] to a custom message.  Which gets over-written by the core processing for the panel.  It seems the only way I can get my own okmsg onto the panel is to completely over-ride the panel processing, but I don&amp;#039;t really want to do that because then the panel&amp;#039;s core processing won&amp;#039;t perform its tasks.

So...  I did find a workaround. Although it works, it seems like there should be a better way than to trick the core like this.  If I could suggest a change it would be that control.php would honor the module&amp;#039;s status messages regardless of whether or not the handled flag is set within the cc_panel hook.

[code=&amp;quot;php&amp;quot;]
function phorum_mod_foo_cc_panel($data)
{
  global $PHORUM;

  // Working on the Signature panel
  if ($data[&amp;quot;panel&amp;quot;] == PHORUM_CC_SIGNATURE)
  {
    // We are intercepting the form post
    if ( conditions_are_met() )
    {
      // My custom actions are handled
      list($error,$okmsg) = mod_foo_custom_actions();
      
      // Mad Hack so that we can force Phorum to process the panel, yet keep
      // our own UI status messages.
      $panel = PHORUM_CC_SIGNATURE;      // sig.php expects this variable to be in scope
      $data[&amp;quot;handled&amp;quot;] = true;
      $data[&amp;quot;template&amp;quot;] = &amp;quot;cc_usersettings&amp;quot;;
      include &amp;quot;./include/controlcenter/sig.php&amp;quot;;

      $data[&amp;quot;okmsg&amp;quot;] = $okmsg;
      $data[&amp;quot;error&amp;quot;] = $error;
    }
  }
  return $data;
}
[/code]

-phil.</description>
        <link>https://www.phorum.org/support/read.php?14,143116,143116#msg-143116</link>
        <lastBuildDate>Thu, 15 Oct 2026 05:31:45 -0500</lastBuildDate>
        <generator>Phorum 6.0.4</generator>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,143116,143183#msg-143183</guid>
            <title>Re: Control Center hook cc_panel and OKMSG</title>
            <link>https://www.phorum.org/support/read.php?14,143116,143183#msg-143183</link>
            <description><![CDATA[ nice.  Simple and clean solution.  Thanks!<br />
<br />
-phil.]]></description>
            <dc:creator>Phil Connolly</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Tue, 16 Feb 2010 11:45:47 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,143116,143182#msg-143182</guid>
            <title>Re: Control Center hook cc_panel and OKMSG</title>
            <link>https://www.phorum.org/support/read.php?14,143116,143182#msg-143182</link>
            <description><![CDATA[ As I was working in this area today I implemented an option for that.<br />
[<a href="http://trac.phorum.org/changeset/4661" target="_blank"  rel="nofollow">trac.phorum.org</a>] should get you going.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Tue, 16 Feb 2010 10:04:04 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,143116,143122#msg-143122</guid>
            <title>Re: Control Center hook cc_panel and OKMSG</title>
            <link>https://www.phorum.org/support/read.php?14,143116,143122#msg-143122</link>
            <description><![CDATA[ So as you say, &quot;always&quot; may not be appropriate.  But maybe the hook could allow the module developer to choose when the module&#039;s message gets displayed rather than the core stock message.  There is currently an assumption that the only time a mod developer would want his own CC panel messages is when completely over-riding a panel&#039;s processing.  This leads to the ugly hack I posted above.  So maybe I *can* hack around the design, but then that is not my preferred architectural choice.<br />
<br />
-phil.]]></description>
            <dc:creator>Phil Connolly</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Wed, 10 Feb 2010 15:19:28 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,143116,143118#msg-143118</guid>
            <title>Re: Control Center hook cc_panel and OKMSG</title>
            <link>https://www.phorum.org/support/read.php?14,143116,143118#msg-143118</link>
            <description><![CDATA[ the panels can&#039;t just always use your status messages as they have to determine the status on their own.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Wed, 10 Feb 2010 15:00:02 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,143116,143116#msg-143116</guid>
            <title>Control Center hook cc_panel and OKMSG</title>
            <link>https://www.phorum.org/support/read.php?14,143116,143116#msg-143116</link>
            <description><![CDATA[ I am trying to use the cc_panel hook.  I don&#039;t want to completely override a CC panel, I am just introducing some additional processing.  So my module would prefer to keep <b>$hook_info[&quot;handled&quot;] = false</b> so that control.php will continue processing the panel as normal.<br />
<br />
But, as part of the processing I might set <b>$hook_info[&quot;okmsg&quot;]</b> to a custom message.  Which gets over-written by the core processing for the panel.  It seems the only way I can get my own okmsg onto the panel is to completely over-ride the panel processing, but I don&#039;t really want to do that because then the panel&#039;s core processing won&#039;t perform its tasks.<br />
<br />
So...  I did find a workaround. Although it works, it seems like there should be a better way than to trick the core like this.  If I could suggest a change it would be that control.php would honor the module&#039;s status messages regardless of whether or not the handled flag is set within the cc_panel hook.<br />
<br />
[code=&quot;php&quot;]<br />
function phorum_mod_foo_cc_panel($data)<br />
{<br />
  global $PHORUM;<br />
<br />
  // Working on the Signature panel<br />
  if ($data[&quot;panel&quot;] == PHORUM_CC_SIGNATURE)<br />
  {<br />
    // We are intercepting the form post<br />
    if ( conditions_are_met() )<br />
    {<br />
      // My custom actions are handled<br />
      list($error,$okmsg) = mod_foo_custom_actions();<br />
      <br />
      // Mad Hack so that we can force Phorum to process the panel, yet keep<br />
      // our own UI status messages.<br />
      $panel = PHORUM_CC_SIGNATURE;      // sig.php expects this variable to be in scope<br />
      $data[&quot;handled&quot;] = true;<br />
      $data[&quot;template&quot;] = &quot;cc_usersettings&quot;;<br />
      include &quot;./include/controlcenter/sig.php&quot;;<br />
<br />
      $data[&quot;okmsg&quot;] = $okmsg;<br />
      $data[&quot;error&quot;] = $error;<br />
    }<br />
  }<br />
  return $data;<br />
}<br />
[/code]<br />
<br />
-phil.]]></description>
            <dc:creator>Phil Connolly</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Wed, 10 Feb 2010 14:49:51 -0600</pubDate>
        </item>
    </channel>
</rss>
