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.


Importing

There are no pages beneath this page

Posted
Submitted by Chris Graham
This is a useful little script for cleaning out very large numbers of redundant news categories, when importing from Wordpress (Wordpress defines a complex taxonomy that ocPortal instead imports as categories and also meta keywords, hence why the category number can be so large)…

Code

   $delete=false;
   require_code('news');
   $cats=$GLOBALS['SITE_DB']->query_select('news_categories',array('*'),array('nc_owner'=>NULL));
   $out=array();
   foreach ($cats as $c)
   {
      $id=$c['id'];
      $num=$GLOBALS['SITE_DB']->query_value('news','COUNT(*)',array('news_category'=>$id));//+$GLOBALS['SITE_DB']->query_value('news_category_entries','COUNT(*)',array('news_entry_category'=>$id));
      $out[$id.'_'.get_translated_text($c['nc_title'])]=$num;
      if ($delete)
      {
         if ($num==0)
         {
            delete_news_category($id);
         }
      }
   }
   if (!$delete)
   {
      echo 'You have the following news categories with the given number of primary entries in. Empty ones will be deleted if you set $delete=true...';
      asort($out);
      @var_dump($out);
   }
 
Posted
Submitted by Chris Graham
If you need to mass-reset a timezone, run this OcCLE command:

Code

:$GLOBALS['FORUM_DB']->query_update('f_members',array('m_timezone_offset'=>'America/New_York'));
Where America/New_York is the correct timezone code (you can find it by looking at ocPortal's HTML for the selection list).
 
Posted
Submitted by Chris Graham
If you import news from multiple sources, you may find a script to find duplicated news useful:
Attachment
» Download: execute_temp.php (4 Kb, 95 downloads so far)
 
CEDI change-log Post