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 Offline
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
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #2
RE: OUGC Better Portal News
The reason to use this way was so that moderators could copy any thread to the portal forum, otherwise everybody threads will appear in portal, even if they were no mods.

Thanks for the review, I edited many parts of the plugin and I´m reading about that function you mentioned.

Thanks again!

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
04-11-2012 01:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #3
RE: OUGC Better Portal News
(04-11-2012 01:51 PM)Sama34 Wrote:  The reason to use this way was so that moderators could copy any thread to the portal forum, otherwise everybody threads will appear in portal, even if they were no mods.
In which case, I'd modify the query that the portal uses, to pull marked threads instead.
Generally should try not to duplicate data when possible (although, again, there may be a purpose).

My Blog
04-11-2012 03:17 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #4
RE: OUGC Better Portal News
Yes, maybe I will try to find a better way using portal hooks and drop this plugin.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
04-13-2012 11:23 AM
Visit this user's website Find all posts by this user Quote this message in a reply


Forum Jump: