Changeset 1104
- Timestamp:
- 05/21/08 02:01:39 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
approve-user-registration/trunk/approve-user-registration.php
r1092 r1104 6 6 Author: Aditya Naik 7 7 Author URI: http://www.adityanaik.com/ 8 Version: 0. 28 Version: 0.3 9 9 */ 10 10 if (!function_exists('bb_new_user')) : … … 120 120 bb_update_option('approve_user_registration_options',$options); 121 121 } 122 //print_r($options);123 122 } 124 123 … … 223 222 <p class="submit"> 224 223 <input type="submit" name="approve_user_registration_button_approve" value="Approve" /> 224 <input type="submit" name="approve_user_registration_button_reject" value="Reject" /> 225 225 </p> 226 226 </form> … … 236 236 approve_user_registration_approve_user($user); 237 237 } 238 } 238 } elseif (isset($_POST['approve_user_registration_button_reject'])) { 239 $users = $_POST['userids']; 240 if ($users) 241 foreach($users as $user) { 242 approve_user_registration_reject_user($user); 243 } 244 } 245 239 246 } 240 247 … … 273 280 } 274 281 282 function approve_user_registration_reject_user($user_id) { 283 global $bbdb; 284 285 $user = new BB_User($user_id); 286 $user->remove_cap('waitingapproval'); 287 $user->remove_cap('member'); 288 $user->add_cap('blocked'); 289 290 $user = bb_get_user($user_id); 291 292 $message = __("Your user %1\$s has been rejected by the administrator."); 293 294 return bb_mail( 295 bb_get_user_email( $user->ID ), 296 bb_get_option('name') . ': ' . __('User Rejected'), 297 sprintf( $message, $user->user_login ) 298 ); 299 } 300 275 301 add_action('bb_admin-footer.php','approve_user_registration_dashboard'); 276 302 function approve_user_registration_dashboard() { 277 303 global $page,$bb_current_menu; 278 $waiting_user = $bb_waiting_users = new BB_Users_By_Role( 'waitingapproval', $_GET['userspage']);279 if($bb_current_menu[0] == 'Dashboard' && $waiting_user ) :304 $waiting_user = new BB_Users_By_Role( 'waitingapproval' ); 305 if($bb_current_menu[0] == 'Dashboard' && $waiting_user->total_users_for_query > 0 ) : 280 306 ?> 281 307 <h3><?php _e('Users waiting for approval'); ?></h3> 282 308 <ul> 283 <li><a href="<?php echo bb_get_option('path') . 'bb-admin/' . bb_get_admin_tab_link('approve_user_registration_admin_page') ; ?>"><?php echo count($waiting_user) . ((count($waiting_user)== 1) ? ' user' : ' users') . ' waiting for approval'; ?></a> </li>309 <li><a href="<?php echo bb_get_option('path') . 'bb-admin/' . bb_get_admin_tab_link('approve_user_registration_admin_page') ; ?>"><?php echo $waiting_user->total_users_for_query . (($waiting_user->total_users_for_query == 1) ? ' user' : ' users') . ' waiting for approval'; ?></a> </li> 284 310 </ul> 285 311 <?php
