WordPress.org

Plugin Directory

Changeset 354285


Ignore:
Timestamp:
03/02/11 22:11:17 (3 years ago)
Author:
MrWiblog
Message:

1.1.4

  • Added ability to increase number of available invites for all users who have had an invite limit set
  • Put reason for invite button not showing on the main settings page (this was a regularly-reported bug)
  • Fixed bug which showed invite reports to non-admin users
  • Fixed divide by zero bug when viewing an individual users invite report
Location:
wordpress-mu-secure-invites/trunk
Files:
2 edited

Legend:

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

    r326449 r354285  
    44Tags: buddypress, invite, invitation, secure, lock, email, signup, registration 
    55Requires at least: 2.7 
    6 Tested up to: 3.0.1 
    7 Stable tag: 1.1.3 
     6Tested up to: 3.1 
     7Stable tag: 1.1.4 
    88 
    99Secure Invites is a Wordpress plugin that allows you to only allow invited people to sign up. 
     
    126126== Changelog == 
    127127 
     128= 1.1.4 (2011/03/02) = 
     129 
     130* Added ability to increase number of available invites for all users who have had an invite limit set 
     131* Put reason for invite button not showing on the main settings page (this was a regularly-reported bug) 
     132* Fixed bug which showed invite reports to non-admin users 
     133* Fixed divide by zero bug when viewing an individual users invite report 
     134 
    128135= 1.1.3 (2010/12/27) = 
    129136 
  • wordpress-mu-secure-invites/trunk/secure_invite.php

    r326449 r354285  
    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.3 
     5Version: 1.1.4 
    66Author: Chris Taylor 
    77Author URI: http://www.stillbreathing.co.uk 
    88Plugin URI: http://www.stillbreathing.co.uk/wordpress/wordpress-mu-secure-invites/ 
    9 Date: 2010-12-27 
     9Date: 2011-03-02 
    1010*/ 
    1111 
    1212function secure_invite_version() { 
    13     return "1.1.3"; 
     13    return "1.1.4"; 
    1414} 
    1515 
     
    5454// add dashboard widgets 
    5555function secure_invite_dashboard() { 
    56     wp_add_dashboard_widget( 'secure_invite_admin_dashboard', __( 'Invitations reports', "secure_invite"  ), 'secure_invite_admin_dashboard' ); 
     56    if(current_user_can("edit_users")) wp_add_dashboard_widget( 'secure_invite_admin_dashboard', __( 'Invitations reports', "secure_invite"  ), 'secure_invite_admin_dashboard' ); 
    5757    wp_add_dashboard_widget( 'secure_invite_user_dashboard', __( 'Invite a friend', "secure_invite"  ), 'secure_invite_user_dashboard' ); 
    5858} 
     
    721721    '; 
    722722    do_action("secure_invite_user_can_invite"); 
     723     
     724    if (!secure_invite_registration_setting_ok()) { 
     725        secure_invites_disallowed_registration_error(); 
     726    } 
     727     
    723728    echo ' 
    724729    <h3>' . __("Settings presets", "secure_invite") . '</h3> 
     
    958963    { 
    959964         
    960         // show the user results 
     965        // search users 
    961966        if ($_POST["secure_invite_search_users"] != "") 
    962967        { 
     
    10161021            } 
    10171022         
    1018         } else { 
     1023        } 
     1024         
     1025        // update an individual user 
     1026        if ($_POST["secure_invite_user_invite_limit"] != "") 
     1027        { 
    10191028         
    10201029            // update the details 
     
    10291038            <div class="updated"><p>' . __("The settings for this user have been saved", "secure_invite") . '</p></div> 
    10301039            '; 
     1040         
     1041        } 
     1042         
     1043        // update all users 
     1044        if ($_POST["secure_invite_global_increase_limit"] != "") 
     1045        { 
     1046         
     1047            $done = 0; 
     1048            $increase = (int)$_POST["secure_invite_global_increase_limit"]; 
     1049            $sql = "select u.ID, m.meta_value as invites 
     1050                    from " . $wpdb->users . " u 
     1051                    inner join " . $wpdb->usermeta . " m on m.user_id = u.ID 
     1052                    where m.meta_key = 'secure_invite_user_invite_limit';"; 
     1053            $users = $wpdb->get_results($sql); 
     1054            if ($users && is_array($users) && count($users) > 0) 
     1055            { 
     1056                foreach($users as $user) 
     1057                { 
     1058                    update_user_meta($user->ID, "secure_invite_user_invite_limit", "_" .((int)trim($user->invites, "_") + $increase)); 
     1059                    $done++; 
     1060                } 
     1061            } 
     1062             
     1063            if ($done == 0) { 
     1064             
     1065            echo ' 
     1066            <div class="updated"><p>' . __("No users updated. Perhaps you haven't set the limit for any users yet?", "secure_invite") . '</p></div> 
     1067            '; 
     1068             
     1069            } else { 
     1070             
     1071            echo ' 
     1072            <div class="updated"><p>'; 
     1073            printf(__("%d users updated", "secure_invite"), $done); 
     1074            echo '</p></div> 
     1075            '; 
     1076             
     1077            } 
    10311078         
    10321079        } 
     
    10581105        $sent = secure_invite_user_sent_invites($user->ID); 
    10591106        $accepted = (int)secure_invite_user_accepted_invites($user->ID); 
    1060         $rate = round((($accepted / $sent) * 100), 1); 
     1107        $rate = 0; 
     1108        if ($sent > 0) $rate = round((($accepted / $sent) * 100), 1); 
    10611109        $points = (int)secure_invite_get_user_meta($user->ID, "secure_invite_points"); 
    10621110         
     
    11061154    </form> 
    11071155     
     1156    <h3>' . __("Increase invites for every user", "secure_invite") . '</h3> 
     1157    <p>' . __("Increase the number of invites for each user (only works for users you have explicitly set a limit for)", "secure_invite") . '</p> 
     1158    <form action="' . secure_invite_page_link() . '.php?page=secure_invite_list&amp;view=users" method="post"> 
     1159    <fieldset> 
     1160    <p><label for="secure_invite_global_increase_limit" style="float:left;width:50%;">' . __("Increase the number of invites each user can send by:", "secure_invite") . '</label> 
     1161    <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> 
     1162    </fieldset> 
    11081163    </div> 
     1164     
    11091165    '; 
    11101166} 
     
    16901746} 
    16911747 
     1748// check the registration setting 
     1749function secure_invite_registration_setting_ok() { 
     1750    $site_registration = stripslashes( get_site_option( "registration" ) ); 
     1751    if (version_compare(get_bloginfo('version'), "3") >= 0 && (!defined( 'WP_ALLOW_MULTISITE' ) || !WP_ALLOW_MULTISITE)) { 
     1752        $site_registration = get_option( "users_can_register" ); 
     1753    } 
     1754    if ($site_registration == "all" || $site_registration == "user" || $site_registration == "1") return true; 
     1755    return false; 
     1756} 
     1757 
    16921758// see if a user can send an invite 
    16931759function secure_invite_user_can_invite() { 
     
    16961762 
    16971763    global $wpdb, $current_user; 
    1698     $site_registration = stripslashes( get_site_option( "registration" ) ); 
    1699     if (version_compare(get_bloginfo('version'), "3") >= 0 && (!defined( 'WP_ALLOW_MULTISITE' ) || !WP_ALLOW_MULTISITE)) { 
    1700         $site_registration = get_option( "users_can_register" ); 
    1701     } 
    17021764 
    17031765    // if the current user exists and is logged in 
     
    17051767    { 
    17061768        // if site registration is allowed 
    1707         if ($site_registration == "all" || $site_registration == "user" || $site_registration == "1") 
     1769        if (secure_invite_registration_setting_ok()) 
    17081770        { 
    17091771            // if the user has not been overridden 
     
    17861848} 
    17871849function secure_invites_disallowed_registration() { 
    1788     echo '<!-- Secure Invites: User cannot send invites because the site registration option is not set to "all" or "user" -->'; 
     1850    echo '<!-- Secure Invites: User cannot send invites because site registration is not turned on -->'; 
    17891851} 
    17901852function secure_invites_disallowed_login() { 
     
    18021864} 
    18031865function secure_invites_disallowed_registration_error() { 
    1804     echo '<div id="message" class="updated"><p>Users cannot send invites because the site registration option is not set to &quot;all&quot; or &quot;user&quot;. <a href="options-general.php">Visit the General Settings page</a> and allow registrations.</p></div>'; 
     1866    echo '<div id="message" class="updated"><p>Users cannot send invites because site registration is not turned on (so anyone responding to an invitation would be unable to register). <a href="options-general.php">Visit the General Settings page</a> and allow registrations.</p></div>'; 
    18051867} 
    18061868function secure_invites_disallowed_login_error() { 
Note: See TracChangeset for help on using the changeset viewer.