WordPress.org

Plugin Directory

Changeset 368370


Ignore:
Timestamp:
04/03/11 15:51:33 (3 years ago)
Author:
MrWiblog
Message:

1.1.5

  • Fixed bug where users could still send invites after they had run out of invites to send
  • Added function to reset a users invite settings to the global default
  • System now shows reason why a user cannot send invites
Location:
wordpress-mu-secure-invites/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wordpress-mu-secure-invites/trunk/readme.txt

    r354298 r368370  
    55Requires at least: 2.7 
    66Tested up to: 3.1 
    7 Stable tag: 1.1.4.1 
     7Stable tag: 1.1.5 
    88 
    99Secure Invites is a Wordpress plugin that allows you to only allow invited people to sign up. 
     
    126126== Changelog == 
    127127 
     128= 1.1.5 (2011/04/03) = 
     129 
     130* Fixed bug where users could still send invites after they had run out of invites to send 
     131* Added function to reset a users invite settings to the global default 
     132* System now shows reason why a user cannot send invites 
     133 
    128134= 1.1.4.1 (2011/03/02) = 
    129135 
  • wordpress-mu-secure-invites/trunk/secure_invite.php

    r354298 r368370  
    33Plugin Name: Secure Invites 
    44Description: Stops public signup on your Wordpress MultiSite or BuddyPress site, but allows existing users to email and invite their friend to join your blog community. This plugin is based on a plugin by kt (Gord), from http://www.ikazoku.com. 
    5 Version: 1.1.4.1 
     5Version: 1.1.5 
    66Author: Chris Taylor 
    77Author URI: http://www.stillbreathing.co.uk 
    88Plugin URI: http://www.stillbreathing.co.uk/wordpress/wordpress-mu-secure-invites/ 
    9 Date: 2011-03-02 
     9Date: 2011-04-03 
    1010*/ 
    1111 
     
    139139// administrators user dashboard widget 
    140140function secure_invite_user_dashboard() { 
     141    global $current_user; 
    141142    $secure_invite_show_admin_link = stripslashes( get_site_option("secure_invite_show_admin_link", "yes") ); 
    142143    if ($secure_invite_show_admin_link == "") { $secure_invite_show_admin_link = "yes"; } 
    143144    // if the user can send invites 
    144     if (secure_invite_user_can_invite() && ($secure_invite_show_admin_link == "yes" || current_user_can("edit_users"))) { 
     145    if (secure_invite_user_can_invite( $current_user->ID ) && ($secure_invite_show_admin_link == "yes" || current_user_can("edit_users"))) { 
    145146        secure_invite_form(); 
    146147    } 
     
    426427// add the admin invitation button 
    427428function secure_invites_add_admin() { 
     429    global $current_user; 
    428430    $secure_invite_show_admin_link = stripslashes( get_site_option("secure_invite_show_admin_link", "yes") ); 
    429431    if ($secure_invite_show_admin_link == "") { $secure_invite_show_admin_link = "yes"; } 
    430432    // if the user can send invites 
    431     if (secure_invite_user_can_invite() && ($secure_invite_show_admin_link == "yes" || current_user_can("edit_users"))) 
     433    if (secure_invite_user_can_invite( $current_user->ID ) && ($secure_invite_show_admin_link == "yes" || current_user_can("edit_users"))) 
    432434    { 
    433435        add_submenu_page('index.php', __('Invite friends', "secure_invite"), __('Invite friends', "secure_invite"), 'read', 'secure_invite', 'secure_invite_admin'); 
     
    568570    if ($name == "secure_invite_signup_time_limit") { return 3; } 
    569571     
    570     if ($name == "secure_invite_invite_limit") { return 0; } 
     572    if ($name == "secure_invite_invite_limit") { return -1; } 
    571573     
    572574    if ($name == "secure_invite_show_admin_link") { return "yes"; } 
     
    613615        { 
    614616            $values["secure_invite_days_after_joining"] = 0; 
    615             $values["secure_invite_invite_limit"] = 0; 
     617            $values["secure_invite_invite_limit"] = -1; 
    616618        } 
    617619        // preset 2 
     
    619621        { 
    620622            $values["secure_invite_days_after_joining"] = 0; 
    621             $values["secure_invite_invite_limit"] = 0; 
     623            $values["secure_invite_invite_limit"] = -1; 
    622624            $values["secure_invite_open_signup"] = ""; 
    623625        } 
     
    626628        { 
    627629            $values["secure_invite_days_after_joining"] = 30; 
    628             $values["secure_invite_invite_limit"] = 0; 
     630            $values["secure_invite_invite_limit"] = -1; 
    629631            $values["secure_invite_open_signup"] = ""; 
    630632        } 
     
    697699    if ($secure_invite_signup_time_limit == "") { $secure_invite_signup_time_limit = secure_invite_default_setting("secure_invite_signup_time_limit"); } 
    698700     
    699     $secure_invite_invite_limit = stripslashes( get_site_option("secure_invite_invite_limit", "0") ); 
     701    $secure_invite_invite_limit = stripslashes( get_site_option("secure_invite_invite_limit", "-1") ); 
    700702    if ($secure_invite_invite_limit == "") { $secure_invite_invite_limit = secure_invite_default_setting("secure_invite_invite_limit"); } 
     703    if ($secure_invite_invite_limit == "-1") { $secure_invite_invite_limit = ""; } 
    701704     
    702705    $secure_invite_show_admin_link = stripslashes( get_site_option("secure_invite_show_admin_link", "yes") ); 
     
    773776     
    774777    <p><label for="secure_invite_invite_limit" style="float:left;width:30%;">' . __("Maximum number of invites per person", "secure_invite") . '</label> 
    775     <input type="text" name="secure_invite_invite_limit" id="secure_invite_invite_limit" value="'.$secure_invite_invite_limit.'" style="width:10%" /> <span class="description">' . __('How many invites can each user send (<a href="' . secure_invite_page_link(). '.php?page=secure_invite_list&amp;view=users">override this for particular users here</a>)? (set as 0 or blank for unlimited)', "secure_invite") . '</span></p> 
     778    <input type="text" name="secure_invite_invite_limit" id="secure_invite_invite_limit" value="'.$secure_invite_invite_limit.'" style="width:10%" /> <span class="description">' . __('How many invites can each user send (<a href="' . secure_invite_page_link(). '.php?page=secure_invite_list&amp;view=users">override this for particular users here</a>)? (set as blank for unlimited)', "secure_invite") . '</span></p> 
    776779     
    777780    <h3 style="padding-top:2em">' . __( "Security settings", "secure_invite" ) . '</h3> 
     
    10241027         
    10251028        // update an individual user 
    1026         if ($_POST["secure_invite_user_invite_limit"] != "") 
     1029        if (isset($_POST["secure_invite_user_invite_limit"])) 
    10271030        { 
    1028          
    10291031            // update the details 
    10301032            $can = "no"; 
     
    10331035            } 
    10341036            update_user_meta($_GET["id"], "secure_invite_user_can_invite", $can); 
    1035             update_user_meta($_GET["id"], "secure_invite_user_invite_limit", "_" .$_POST["secure_invite_user_invite_limit"]); 
    1036          
    1037             echo ' 
    1038             <div class="updated"><p>' . __("The settings for this user have been saved", "secure_invite") . '</p></div> 
    1039             '; 
    1040          
     1037            if ($_POST["secure_invite_user_invite_limit"] != "") 
     1038            { 
     1039                update_user_meta($_GET["id"], "secure_invite_user_invite_limit", "_" . $_POST["secure_invite_user_invite_limit"]); 
     1040                echo ' 
     1041                <div class="updated"><p>' . __("The settings for this user have been saved", "secure_invite") . '</p></div> 
     1042                '; 
     1043            } else { 
     1044                update_user_meta($_GET["id"], "secure_invite_user_invite_limit", "_-1"); 
     1045                echo ' 
     1046                <div class="updated"><p>' . __("The settings for this user have been saved", "secure_invite") . '</p></div> 
     1047                '; 
     1048            } 
    10411049        } 
    10421050         
     
    10791087        } 
    10801088         
     1089        // if resetting 
     1090        if ($_POST["secure_invite_user_invite_limit_reset"] == "1") 
     1091        { 
     1092            delete_user_meta( $_GET["id"], "secure_invite_user_can_invite" ); 
     1093            delete_user_meta( $_GET["id"], "secure_invite_user_invite_limit" ); 
     1094             
     1095            echo ' 
     1096            <div class="updated"><p>' . __("The settings for this user have been saved", "secure_invite") . '</p></div> 
     1097            '; 
     1098        } 
     1099         
    10811100    } 
    10821101     
     
    10951114         
    10961115        $invite_limit = trim(secure_invite_get_user_meta($_GET["id"], "secure_invite_user_invite_limit"), "_"); 
    1097          
    1098         $remaining = secure_invite_user_invites_remaining($user->ID); 
     1116        if ($invite_limit == "-1") { $invite_limit = ""; } 
     1117         
    10991118        $remaining_header = ""; 
    1100         if ($remaining != "") { 
     1119        if ($invite_limit != "-1") { 
     1120            $remaining = "<td>" . secure_invite_user_invites_remaining($user->ID) . "</td>"; 
    11011121            $remaining_header = "<th>" . __("Remaining invites", "secure_invite") . "</th>"; 
    11021122        } 
     
    11111131        echo ' 
    11121132        <p>' . __("Username", "secure_invite") . ': ' . $user->user_login . ' (<a href="mailto:' . $user->user_email . '">' . $user->user_email . '</a>)</p> 
     1133        '; 
     1134         
     1135        echo secure_invite_user_can_invite( $user->ID, false, false ); 
     1136         
     1137        echo ' 
    11131138        <table class="widefat"> 
    11141139        <thead> 
     
    11371162        <input type="checkbox" name="secure_invite_user_can_invite" id="secure_invite_user_can_invite" value="1"' . $can_invite . ' /> <span class="description">' . __("Can this user send invitations?", "secure_invites") . '</span></p> 
    11381163        <p><label for="secure_invite_user_invite_limit" style="float:left;width:15%;">' . __("Invitation limit", "secure_invite") . '</label> 
    1139         <input type="text" name="secure_invite_user_invite_limit" id="secure_invite_user_invite_limit" value="' . $invite_limit . '" style="width:10%" /> <span class="description">' . __("Number of invitations this user can send (leave blank to use the global default, or 0 for unlimited)", "secure_invites") . '</span></p> 
     1164        <input type="text" name="secure_invite_user_invite_limit" id="secure_invite_user_invite_limit" value="' . $invite_limit . '" style="width:10%" /> <span class="description">' . __("Number of invitations this user can send (leave blank for unlimited)", "secure_invites") . '</span></p> 
     1165        <p><label for="secure_invite_user_invite_limit_reset" style="float:left;width:15%;">' . __("Reset invitation limit", "secure_invite") . '</label> 
     1166        <input type="checkbox" name="secure_invite_user_invite_limit_reset" id="secure_invite_user_invite_limit_reset" value="1" style="width:10%" /> <span class="description">' . __("Reset number of invitations this user can send to the global default", "secure_invites") . '</span></p> 
    11401167        <p><input type="submit" name="save" class="button-primary" value="' . __("Save settings for this user", "secure_invite") . '" /></p> 
    11411168        </fieldset> 
     
    11451172    } 
    11461173 
    1147     echo '<h3>' .  __("Search users", "secure_invite") . '</h3> 
     1174    echo ' 
     1175    <div style="float:left;width:45%"> 
     1176    <h3>' .  __("Search users", "secure_invite") . '</h3> 
    11481177    <p>' . __("Search for a user to override their invitation settings.", "secure_invite") . '</p> 
    11491178    <form action="' . secure_invite_page_link() . '.php?page=secure_invite_list&amp;view=users" method="post"> 
     
    11531182    </fieldset> 
    11541183    </form> 
    1155      
     1184    </div> 
     1185     
     1186    <div style="float:right;width:45%"> 
    11561187    <h3>' . __("Increase invites for every user", "secure_invite") . '</h3> 
    11571188    <p>' . __("Increase the number of invites for each user (only works for users you have explicitly set a limit for)", "secure_invite") . '</p> 
     
    11611192    <input type="text" name="secure_invite_global_increase_limit" id="secure_invite_global_increase_limit" value="" style="width:15%" /> <input type="submit" name="search" class="button" value="' . __("Increase invites", "secure_invite") . '" /></p> 
    11621193    </fieldset> 
     1194    </form> 
    11631195    </div> 
    1164      
    11651196    '; 
    11661197} 
     
    12281259    global $wpdb; 
    12291260    // get the best inviters by signups 
    1230     $sql = "select u.user_nicename, 
     1261    $sql = "select u.id, u.user_nicename, 
    12311262            count(i.invited_email) as invites, 
    12321263            (select count(i2.invited_email) 
     
    12641295        echo ' 
    12651296        <tr'.$alt.'> 
    1266             <td>'.__($best_inviter->user_nicename).'</td> 
     1297            <td><a href="?page=secure_invite_list&view=users&id=' . $best_inviter->id . '">'.__($best_inviter->user_nicename).'</a></td> 
    12671298            <td>'.__($best_inviter->invites).'</td> 
    12681299            <td>'.__($best_inviter->signups).'</td> 
     
    14171448            if ($alt == '') { $alt = ' class="alternate"'; } else { $alt = ''; } 
    14181449            echo '<tr'.$alt.'> 
    1419             <td>' . $invite->inviter . '</td> 
     1450            <td><a href="?page=secure_invite_list&view=users&id=' . $invite->user_id . '">' . $invite->inviter . '</a></td> 
    14201451            <td>' . date("F j, Y, g:i a", $invite->datestamp) . '</td> 
    14211452            <td>' . $invite->invited_email . '</td> 
     
    16301661// show a BuddyPress form 
    16311662function secure_invite_buddypress_form($hidelink = false, $usepost = false) { 
     1663    global $current_user; 
    16321664    $secure_invite_show_admin_link = stripslashes( get_site_option("secure_invite_show_admin_link", "yes") ); 
    16331665    if ($secure_invite_show_admin_link == "") { $secure_invite_show_admin_link = "yes"; } 
    16341666    // if the user can send invites 
    1635     if (secure_invite_user_can_invite() && ($secure_invite_show_admin_link == "yes" || current_user_can("edit_users"))) { 
     1667    if (secure_invite_user_can_invite( $current_user->ID ) && ($secure_invite_show_admin_link == "yes" || current_user_can("edit_users"))) { 
    16361668        $name = ""; 
    16371669        $email = ""; 
     
    17061738// show an invitation form 
    17071739function secure_invite_form($success='Thanks, your invitation has been sent', $error='Sorry, your invitation could not be sent. Perhaps this email address is already registered.', $return=false) { 
     1740    global $current_user; 
    17081741    $secure_invite_show_admin_link = stripslashes( get_site_option("secure_invite_show_admin_link", "yes") ); 
    17091742    if ($secure_invite_show_admin_link == "") { $secure_invite_show_admin_link = "yes"; } 
    17101743    // if the user can send invites 
    1711     if (secure_invite_user_can_invite() && ($secure_invite_show_admin_link == "yes" || current_user_can("edit_users"))) { 
     1744    if (secure_invite_user_can_invite( $current_user->ID ) && ($secure_invite_show_admin_link == "yes" || current_user_can("edit_users"))) { 
    17121745        $r = ' 
    17131746        <div id="secure_invite_form"> 
     
    17571790 
    17581791// see if a user can send an invite 
    1759 function secure_invite_user_can_invite() { 
     1792function secure_invite_user_can_invite($userid = "", $allow_admins = true, $return_bool = true) { 
    17601793    // return true for administrators 
    1761     if (current_user_can("edit_users")) { return true; } 
    1762  
    1763     global $wpdb, $current_user; 
    1764  
    1765     // if the current user exists and is logged in 
    1766     if ($current_user && $current_user->id != "") 
     1794    if ($allow_admins && current_user_can("edit_users")) { return true; } 
     1795 
     1796    global $wpdb; 
     1797     
     1798    if ($userid == "") { 
     1799        global $current_user; 
     1800        $userid = $current_user->ID; 
     1801    } 
     1802 
     1803    // if the user is set 
     1804    if ($userid != "") 
    17671805    { 
    17681806        // if site registration is allowed 
     
    17701808        { 
    17711809            // if the user has not been overridden 
    1772             if (secure_invite_get_user_meta($current_user->ID, "secure_invite_user_can_invite") != "no") 
     1810            if (secure_invite_get_user_meta($userid, "secure_invite_user_can_invite") != "no") 
    17731811            { 
    17741812                // get the date this user was registered 
    1775                 $registered = $wpdb->get_var($wpdb->prepare("select UNIX_TIMESTAMP(user_registered) from ".$wpdb->users." where id=%d;", $current_user->id)); 
     1813                $registered = $wpdb->get_var($wpdb->prepare("select UNIX_TIMESTAMP(user_registered) from ".$wpdb->users." where id=%d;", $userid)); 
    17761814                 
    17771815                // get how many days after registration invites are locked 
     
    17801818                 
    17811819                // if the user is not too new, or is a site admin 
    1782                 if ($registered < (time() - ($secure_invite_days_after_joining * 24 * 60 * 60)) || $secure_invite_days_after_joining == "0" || secure_invite_is_super_admin()) 
     1820                if ($registered < (time() - ($secure_invite_days_after_joining * 24 * 60 * 60)) || $secure_invite_days_after_joining == "0" || secure_invite_is_super_admin($userid)) 
    17831821                { 
    17841822                    // get the total number of invites a user is allowed to send 
     
    17871825                     
    17881826                    // get the limit for this user 
    1789                     $user_limit = trim(secure_invite_get_user_meta($current_user->ID, "secure_invite_user_invite_limit"), "_"); 
    1790                     if ($user_limit != "") { $secure_invite_invite_limit = (int)$user_limit; } 
     1827                    $user_limit = trim(secure_invite_get_user_meta($userid, "secure_invite_user_invite_limit"), "_"); 
     1828                    if ($user_limit != "-1") { $secure_invite_invite_limit = (int)$user_limit; } 
    17911829                     
    17921830                    // get the number of invites this user has sent 
     
    17941832                 
    17951833                    // if the user has sent less than their limit, or there is no limit 
    1796                     if ($sent < $secure_invite_invite_limit || $secure_invite_invite_limit == "" || $secure_invite_invite_limit == 0 || $user_limit == 0) 
     1834                    if ($sent < $secure_invite_invite_limit || $secure_invite_invite_limit == "" || $secure_invite_invite_limit == -1 || $user_limit == -1) 
    17971835                    { 
    1798                         return true; 
     1836                        if ($return_bool) return true; 
     1837                        return secure_invites_user_allowed_message(); 
    17991838                    } else { 
    1800                         add_action('admin_head', 'secure_invites_disallowed_limit'); 
    1801                         add_action('wp_head', 'secure_invites_disallowed_limit'); 
    1802                         add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_limit_error'); 
    1803                         return false; 
     1839                        if ($return_bool) { 
     1840                            add_action('admin_head', 'secure_invites_disallowed_limit'); 
     1841                            add_action('wp_head', 'secure_invites_disallowed_limit'); 
     1842                            add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_limit_error'); 
     1843                            return false; 
     1844                        } else { 
     1845                            return secure_invites_disallowed_limit_error(); 
     1846                        } 
    18041847                    } 
    18051848                } else { 
    1806                     add_action('admin_head', 'secure_invites_disallowed_new'); 
    1807                     add_action('wp_head', 'secure_invites_disallowed_new'); 
    1808                     add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_new_error'); 
    1809                     return false; 
     1849                    if ($return_bool) { 
     1850                        add_action('admin_head', 'secure_invites_disallowed_new'); 
     1851                        add_action('wp_head', 'secure_invites_disallowed_new'); 
     1852                        add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_new_error'); 
     1853                        return false; 
     1854                    } else { 
     1855                        return secure_invites_disallowed_new_error(); 
     1856                    } 
    18101857                } 
    18111858            } else { 
    1812                 add_action('admin_head', 'secure_invites_disallowed_turnedoff'); 
    1813                 add_action('wp_head', 'secure_invites_disallowed_turnedoff'); 
    1814                 add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_turnedoff_error'); 
     1859                if ($return_bool) { 
     1860                    add_action('admin_head', 'secure_invites_disallowed_turnedoff'); 
     1861                    add_action('wp_head', 'secure_invites_disallowed_turnedoff'); 
     1862                    add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_turnedoff_error'); 
     1863                    return false; 
     1864                } else { 
     1865                    return secure_invites_disallowed_turnedoff_error(); 
     1866                } 
     1867            } 
     1868        } else { 
     1869            if ($return_bool) { 
     1870                add_action('admin_head', 'secure_invites_disallowed_registration'); 
     1871                add_action('wp_head', 'secure_invites_disallowed_registration'); 
     1872                add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_registration_error'); 
    18151873                return false; 
    1816             } 
     1874            } else { 
     1875                return secure_invites_disallowed_registration_error(); 
     1876            } 
     1877        } 
     1878    } else { 
     1879        if ($return_bool) { 
     1880            add_action('admin_head', 'secure_invites_disallowed_login'); 
     1881            add_action('wp_head', 'secure_invites_disallowed_login'); 
     1882            add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_login_error'); 
     1883            return false; 
    18171884        } else { 
    1818             add_action('admin_head', 'secure_invites_disallowed_registration'); 
    1819             add_action('wp_head', 'secure_invites_disallowed_registration'); 
    1820             add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_registration_error'); 
    1821             return false; 
    1822         } 
    1823     } else { 
    1824         add_action('admin_head', 'secure_invites_disallowed_login'); 
    1825         add_action('wp_head', 'secure_invites_disallowed_login'); 
    1826         add_action('secure_invite_user_can_invite', 'secure_invites_disallowed_login_error'); 
    1827         return false; 
     1885            return secure_invites_disallowed_login_error(); 
     1886        } 
    18281887    } 
    18291888} 
     
    18401899} 
    18411900 
     1901// the user is allowed to send invites 
     1902function secure_invites_user_allowed_message() { 
     1903    echo '<div id="message" class="updated"><p>You are allowed to send invites</p></div>'; 
     1904} 
     1905 
    18421906// the reasons why people are disallowed from sending invites 
    18431907function secure_invites_disallowed_limit() { 
     
    18581922 
    18591923function secure_invites_disallowed_limit_error() { 
    1860     echo '<div id="message" class="updated"><p>You send invites because you have sent your limit of invitations</p></div>'; 
     1924    echo '<div id="message" class="updated"><p>You cannot send invites because you have sent your limit of invitations</p></div>'; 
    18611925} 
    18621926function secure_invites_disallowed_new_error() { 
     
    18881952 
    18891953// show how many invites this user is allowed to send 
    1890 function secure_invite_user_invites_remaining() { 
    1891     global $current_user; 
     1954function secure_invite_user_invites_remaining($userid) { 
     1955    $remaining = secure_invite_user_invites_remaining_num($userid); 
     1956    if ($remaining > 0) 
     1957    { 
     1958        return __("Number of invites left to send:", "secure_invite") . " " . $remaining; 
     1959    } else if($remaining == -1) { 
     1960        return __("Unlimited invites", "secure_invite"); 
     1961    } else { 
     1962        return __("No invites left to send", "secure_invite"); 
     1963    } 
     1964} 
     1965 
     1966// show how many invites this user is allowed to send 
     1967function secure_invite_user_invites_remaining_num($userid) { 
     1968    if ($userid == "") { 
     1969        global $current_user; 
     1970        $userid = $current_user->ID; 
     1971    } 
    18921972    // get the total number of invites a user is allowed to send 
    1893     $secure_invite_invite_limit = stripslashes( get_site_option("secure_invite_invite_limit", "0") ); 
    1894     if ($secure_invite_invite_limit == "") { $secure_invite_invite_limit = secure_invite_default_setting("secure_invite_invite_limit"); } 
     1973    $secure_invite_invite_limit = stripslashes( get_site_option("secure_invite_invite_limit", "-1") ); 
     1974    if ($secure_invite_invite_limit == "") { $secure_invite_invite_limit = (int)secure_invite_default_setting("secure_invite_invite_limit"); } 
     1975     
    18951976    // get the limit for this user 
    1896     $user_limit = trim(secure_invite_get_user_meta($current_user->ID, "secure_invite_user_invite_limit"), "_"); 
    1897     if ($user_limit != "") { $secure_invite_invite_limit = (int)$user_limit; } 
    1898     if ($secure_invite_invite_limit > 0) 
    1899     { 
     1977    $user_limit = secure_invite_get_user_meta($userid, "secure_invite_user_invite_limit"); 
     1978    if (substr($user_limit, 0, 1) == "_") { $secure_invite_invite_limit = (int)trim($user_limit, "_"); } 
     1979     
     1980    if ($secure_invite_invite_limit == -1) 
     1981    { 
     1982        return -1; 
     1983    } else if ($secure_invite_invite_limit == 0) { 
     1984        return 0; 
     1985    } else { 
    19001986        // get the number of invites sent 
    1901         $sent = secure_invite_user_sent_invites(); 
    1902         return __("Number of invites left to send:", "secure_invite") . " " . ($secure_invite_invite_limit - $sent); 
    1903     } else { 
    1904         return ""; 
     1987        $sent = secure_invite_user_sent_invites($userid); 
     1988        return ($secure_invite_invite_limit - $sent); 
    19051989    } 
    19061990} 
     
    19372021    global $current_site, $current_user, $blog_id, $wpdb; 
    19382022    // check the user can invite 
    1939     if (secure_invite_user_can_invite()) 
     2023    if (secure_invite_user_can_invite( $current_user->ID )) 
    19402024    { 
    19412025        // check this email address isn't already registered 
Note: See TracChangeset for help on using the changeset viewer.