Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OUGC Better Portal News

Please note that this is pretty much a negative criticism post, rather than a balanced review as mentioned in this thread. Also be aware that stuff posted here may be highly subjective.
Please feel free to criticise this post, however.

Plugin Reviewed: OUGC Better Portal News
Plugin Version: 1.0 (last updated 31st March 2012)
Plugin Author: Omar G.
Author Message
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #1
OUGC Better Portal News
This is a plugin "review" requested by Sama34.

This is an interesting plugin which gives moderators an option to make a copy of the thread (into a specified forum) when it is created (that is, the option only appears when making a new thread and won't show up on edit thread).
I personally would've probably taken a completely different approach - just simply parsing a {SPLIT} tag on the portal page would be suffice, and doesn't suffer issues with having to manage two threads / duplicate data (such as having to update two threads instead of one), but maybe you have a reason to have a copy instead.

Plugin in general does a good job, but I'm feeling a little pedantic at the moment.
  • Typo (2 instances):

    PHP Code:
    	$active_plugins = $cache->read('plugins');
    	if(!$pscom_plugins['active']['default_post_icon'])

  • I'd recommend a mb_stripos check rather than this

    PHP Code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    		$message = preg_split("#{SPLIT}#ims", $mybb->input['message']);
    		if($modoptions['portalnews'] == 1)
    		{
    			if(!$message[0])
    			{
    				error($lang->ougc_portalnews_newthreaderror);
    			}
    			else
    			{
    				$count = my_strlen($message[0]);
    				$mincount = intval($mybb->settings['minmessagelength']);
    				if($count < $mincount)
    				{
    					error($lang->sprintf($lang->ougc_portalnews_newthreaderror3, $mincount));
    				}
    				else
    				{
    					$ougc_message = $mybb->input['message'];
    					$mybb->input['message'] = $message[0].$message[1];
    					$GLOBALS['plugins']->add_hook("newthread_do_newthread_end", "ougc_portalnews_end");
    				}
    			}
    		}

    Slightly faster and won't fall over with multiple instances of {SPLIT} in the message, although I guess it's not a big deal.

  • PHP Code:
    $ougc_message = $mybb->input['message'];

    Since only $message[0] is used later on, why not just pass that?  Less processing code, and less memory usage.

  • I suspect the following is incorrect

    PHP Code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    //Cache our template.
    if(my_strpos($_SERVER['PHP_SELF'], 'newthread.php'))
    {
    	global $templatelist;
    	if(isset($templatelist))
    	{
    		$templatelist .= ', newreply_modoptions';
    	}
    	else
    	{
    		$templatelist = 'newreply_modoptions';
    	}
    }

    as newreply_modoptions is already cached on newthread.php, whilst the added template ougc_portalnews_input isn't.  Although not particularly important, I might suggest using THIS_SCRIPT constant rather than PHP_SELF, as it's a bit more reliable.

  • Querying the forum is unnecessary here, as you can simply check with $thread['fid']

    PHP Code:
    			$thread = get_thread(intval($mybb->input['tid']));
    			$forum = get_forum($thread['fid']);
    			if($forum['fid'] == intval($mybb->settings['ougc_portalnews_newsforum']))

  • Replacement 'read more' text is in bbcode, so may not work if you have that disabled (ie you prefer HTML)

My Blog
(This post was last modified: 04-04-2012 03:08 PM by ZiNgA BuRgA.)
04-04-2012 03:06 PM
Find all posts by this user Quote this message in a reply


Messages In This Thread
OUGC Better Portal News - ZiNgA BuRgA - 04-04-2012 03:06 PM
RE: OUGC Better Portal News - Sama34 - 04-11-2012, 01:51 PM
RE: OUGC Better Portal News - ZiNgA BuRgA - 04-11-2012, 03:17 PM
RE: OUGC Better Portal News - Sama34 - 04-13-2012, 11:23 AM

Forum Jump: