Thread Rating:
  • 1 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Show Referrals in Profile Review

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: Show Referrals in Profile
Plugin Version: 1.2 (last updated 3rd September 2015)
Plugin Author: LeeFish
Author Message
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #4
RE: Show Referrals in Profile Review
I would like to suggest some things.
  • You should consider loading the language file only when necessary.
  • Instead of:

    PHP Code:
    $referrer = (int)$mybb->input['uid'];
    	
    $query = $db->simple_select("users", "uid,username,usergroup,displaygroup,avatar,avatardimensions,referrer,referrals" , "referrer = '$referrer'");


    You could just do:

    PHP Code:
    $referrer = (int)$memprofile['uid'];
    	
    $query = $db->simple_select("users", "uid,username,usergroup,displaygroup,avatar,avatardimensions,referrer,referrals" , "referrer = '$referrer'");


    Which is more reliable.

  • Instead of:

    PHP Code:
    1
    2
    3
    4
    5
    6
    $referrer = htmlspecialchars($user['referrer']);
    		
    //Fetch Referrer uid
    $query = $db->simple_select("users", "uid,username" , "username = '".$db->escape_string($referrer)."'");
    
    $refers = $db->fetch_array($query);


    You could just do:

    PHP Code:
    //Fetch Referrer uid
    $query = $db->simple_select("users", "uid,username" , "uid = '".(int)$GLOBALS['userhandler']->data['referrer_uid']."'");
    
    $refers = $db->fetch_array($query);


    Ideally and if using 1.8:

    PHP Code:
    //Fetch Referrer uid
    $refers = get_user_by_username($user['referrer']/*, array('fields' => array('username'))*/); // You don't really make use of the username.
    


    Even better you should be rather be hooking at datahandler_user_insert in whether 1.6 or 1.8

  • Instead of:

    PHP Code:
    $newblink = '[url='.$mybb->settings['bburl'].'/member.php?action=profile&uid='.$new_uid.']'.$new_user.'[/url]';


    You should be using:

    PHP Code:
    $newblink = '[url='.$mybb->settings['bburl'].'/'.get_profile_link($new_uid).']'.$new_user.'[/url]';

  • Ideally you should be using send_pm() instead in 1.8.

Most of those could not make any difference in your board where, IIRC, yo do not use SEF urls and users with small boards will probably not even notice/care for the others  but since you are releasing this to the public I felt just like sharing my thoughts.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
10-01-2015 04:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply


Messages In This Thread
RE: Show Referrals in Profile Review - Sama34 - 10-01-2015 04:56 PM

Forum Jump: