Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Exporting a message content from the admin-viewable forum to DIV on site

edited November 2011 in Vanilla 2.0 - 2.8
How to ?

Comments

  • Do you mean notices ?

    There was an error rendering this rich post.

  • Hm, I need a tool to prepare site content - possibility to edit messages with the same way as on the forum, to format messages and to publish containers (div class="Message") on site. And edit them further.
  • You can do this via dashboard, publish to header sidebar etc

    There was an error rendering this rich post.

  • I have a site connected with forums through ProxyConnect plugin.

    And want to publish admin messages (prepared in hidden generic topic ) inside of site not the forum.

    something like this

    <?php //code on site echo Get_Div_From('GenericForum','message_1'); ?>
  • Sorry, I misunderstood your initial question, in fact I am pretty confused now.

    There was an error rendering this rich post.

  • x00x00 MVP
    edited November 2011
    you could do this through ajax using the api.

    Or through loading the bootstap.php. Then use model, get the message, format it, etc.

    However what you are trying to doesn't seem to be worth the effort. It is a botch job at best. Why not start with something fit for purpose in he first place?

    grep is your friend.

  • If it is truly hidden (can't think why) then you will also need a plugin to override this.
    hidden because it's an admin tool to prepare content. I just go to Generic forum and format and edit generic messages with comfortable way. Then with just one php string I may place an article to my site in any page where I want;

  • Seriously use a cms like wordpress. That sounds like a terrible idea.

    grep is your friend.

  • :) thanks for your mark of the idea. I've just asked about ways :)

    and I don't need no Wordpress by now at least.
  • great as long as you understand we are not here to teach you how to program.

    grep is your friend.

  • edited December 2011

    @x00 hmm i've done terrible idea for some days. now i have Vanilla based cms. it's terribly ;) you're right.

    Core function is very simple. styling and formatting - more boring to implement.

      function FindMessage ($Forum, $Topic, $FindText) {
    
        $config_path = rootpath().'forum/conf/config.php'; //PATH to Configuration
    
        if(!function_exists('value_from_line')) {  
            function value_from_line ($line, $param) {   
            $pattern = "#Configuration\['Database'\]\['$param'\] = '(.*)';#i";
            if(preg_match($pattern, $line, $match)) return $match[1]; }}
        $lines = file($config_path);
        $db_name = null;$db_host = null;$db_user = null;$db_pass = null;
        foreach($lines as $line){   
          if ($db_host==null) $db_host = value_from_line ($line,'Host');      
          if ($db_name==null) $db_name = value_from_line ($line,'Name');
          if ($db_user==null) $db_user = value_from_line ($line,'User');
          if ($db_pass==null) $db_pass = value_from_line ($line,'Password');
          if (($db_name!=null) and ($db_host!=null) 
          and ($db_user!=null) and ($db_pass!=null)) break; }   
        // GOT    $db_name    $db_host    $db_user    $db_pass
        //---------------------------------------------------------------------   
    
            Error_Reporting(E_ALL & ~E_NOTICE);
            $No_Connection = "Location: URLNOCONNECTION";
            $linker = mysql_connect($db_host, $db_user, $db_pass)or die ($No_Connection); 
            $db = mysql_select_db ($db_name) or die ($No_Connection);
    
            // заглавная мессага 
            $rst = mysql_query (
            "select `GDN_Discussion`.`Body` AS `Body` from (`GDN_Category` left join ".
            "`GDN_Discussion` on((`GDN_Category`.`CategoryID` = `GDN_Discussion`.".
            "`CategoryID`))) where ((`GDN_Category`.`Name` = '$Forum') and ".
            "(`GDN_Discussion`.`Name` = '$Topic'))");
    
            if ($row = mysql_fetch_object($rst)) 
            {
                $Message = $row->Body;             
                $pos = strpos($Message, $FindText);
                if ($pos !== false) return $Message; 
            }
            // список комментариев
            $rst = mysql_query (
            "select `GDN_Comment`.`Body` AS `Body` from (`GDN_Category` left join ".
            "(`GDN_Discussion` left join `GDN_Comment` on((`GDN_Discussion`.`DiscussionID`".
            " = `GDN_Comment`.`DiscussionID`))) on((`GDN_Category`.`CategoryID` = ".
            "`GDN_Discussion`.`CategoryID`))) where ((`GDN_Category`.`Name` = '$Forum')".
            " and (`GDN_Discussion`.`Name` = '$Topic'))");
            while ($row = mysql_fetch_object($rst))
                {
                $Message = $row->Body;             
                $pos = strpos($Message, $FindText);
                if ($pos !== false) return $Message;
              }
            return null;
        }
    
Sign In or Register to comment.