WordPress.org

Plugin Directory

Changeset 605026


Ignore:
Timestamp:
09/28/12 05:59:19 (19 months ago)
Author:
picklewagon
Message:

add new_user_approve_user_status filter

Location:
new-user-approve/branches/1.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • new-user-approve/branches/1.4/new-user-approve.php

    r605021 r605026  
    141141                </ul> 
    142142                <div id="pw_pending_users"> 
    143                     <?php $this->approve_table( 'pending', true, true ); ?> 
     143                    <?php $this->user_table( 'pending' ); ?> 
    144144                </div> 
    145145                <div id="pw_approved_users"> 
    146                     <?php $this->approve_table( 'approved', false, true ); ?> 
     146                    <?php $this->user_table( 'approved' ); ?> 
    147147                </div> 
    148148                <div id="pw_denied_users"> 
    149                     <?php $this->approve_table( 'denied', true, false ); ?> 
     149                    <?php $this->user_table( 'denied' ); ?> 
    150150                </div> 
    151151            </div> 
     
    155155 
    156156    /** 
    157      * @desc the table that shows the registered users grouped by status 
    158      */ 
    159     public function approve_table($status, $approve, $deny) { 
     157     * Output the table that shows the registered users grouped by status 
     158     *  
     159     * @param string $status the filter to use for which the users will be queried. Possible values are pending, approved, or denied. 
     160     */ 
     161    public function user_table( $status ) { 
    160162        global $current_user; 
    161  
     163         
     164        $approve = ( 'denied' == $status || 'pending' == $status ); 
     165        $deny = ( 'approved' == $status || 'pending' == $status ); 
     166         
    162167        if ( $status != 'approved' ) { 
    163168            // Query the users table 
     
    178183            } 
    179184 
    180             // get all approved users and any usr without a status 
     185            // get all approved users and any user without a status 
    181186            $query = array( 'include' => $approved_users ); 
    182187            $wp_user_search = new WP_User_Query( $query ); 
     
    184189 
    185190        if ( isset( $wp_user_search ) && $wp_user_search->total_users > 0 ) { 
     191            $users = $wp_user_search->get_results(); 
     192            $users = apply_filters( 'new_user_approve_user_status', $users, $status ); 
    186193        ?> 
    187194<table class="widefat"> 
     
    191198            <th><?php _e('Name', $this->plugin_id) ?></th> 
    192199            <th><?php _e('E-mail', $this->plugin_id) ?></th> 
    193         <?php if ($approve && $deny) { ?> 
     200        <?php if ( 'pending' == $status ) { ?> 
    194201            <th colspan="2" style="text-align: center"><?php _e('Actions', $this->plugin_id) ?></th> 
    195202        <?php } else { ?> 
     
    202209        // show each of the users 
    203210        $row = 1; 
    204         foreach ($wp_user_search->get_results() as $user) { 
     211        foreach ( $users as $user ) { 
    205212            $class = ($row % 2) ? '' : ' class="alternate"'; 
    206213            $avatar = get_avatar( $user->user_email, 32 ); 
    207             if ($approve) { 
     214            if ( $approve ) { 
    208215                $approve_link = get_option('siteurl').'/wp-admin/users.php?page='.$this->_admin_page.'&user='.$user->ID.'&status=approve'; 
    209216                $approve_link = wp_nonce_url($approve_link, 'pw_new_user_approve_action_' . get_class($this)); 
    210217            } 
    211             if ($deny) { 
     218            if ( $deny ) { 
    212219                $deny_link = get_option('siteurl').'/wp-admin/users.php?page='.$this->_admin_page.'&user='.$user->ID.'&status=deny'; 
    213220                $deny_link = wp_nonce_url($deny_link, 'pw_new_user_approve_action_' . get_class($this)); 
     
    228235                <td><?php echo get_user_meta( $user->ID, 'first_name', true )." ".get_user_meta( $user->ID, 'last_name', true ); ?></td> 
    229236                <td><a href="mailto:<?php echo $user->user_email; ?>" title="<?php _e('email:', $this->plugin_id) ?> <?php echo $user->user_email; ?>"><?php echo $user->user_email; ?></a></td> 
    230                 <?php if ($approve) { ?> 
     237                <?php if ( $approve ) { ?> 
    231238                <td align="center"><a href="<?php echo $approve_link; ?>" title="<?php _e('Approve', $this->plugin_id) ?> <?php echo $user->user_login; ?>"><?php _e('Approve', $this->plugin_id) ?></a></td> 
    232239                <?php } ?> 
    233                 <?php if ($deny) { ?> 
     240                <?php if ( $deny ) { ?> 
    234241                <td align="center"><a href="<?php echo $deny_link; ?>" title="<?php _e('Deny', $this->plugin_id) ?> <?php echo $user->user_login; ?>"><?php _e('Deny', $this->plugin_id) ?></a></td> 
    235242                <?php } ?> 
  • new-user-approve/branches/1.4/readme.txt

    r605021 r605026  
    5454 
    5555= 1.4 = 
     56* add *new_user_approve_user_status* filter 
    5657 
    5758= 1.3.5 = 
     
    149150== Other Notes == 
    150151 
     152= Filters = 
     153* *new_user_approve_user_status* - modify the list of users shown in the tables 
     154 
    151155= Translations = 
    152156The plugin has been prepared to be translated. If you want to help to translate the plugin to your language, please have a look at the localization/new-user-approve.pot file which contains all defintions and may be used with a gettext editor like Poedit (Windows). More information can be found on the [Codex](http://codex.wordpress.org/Translating_WordPress). 
Note: See TracChangeset for help on using the changeset viewer.