Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/13/2009 01:24:21 AM (17 years ago)
Author:
apeatling
Message:

Add first revision of new default BuddyPress parent theme. This theme is designed to be extended from with child themes, not used directly. The original default themes from the old two theme system are deprecated, but will remain compatible with 1.1. Still more work to do there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-activation.php

    r1636 r1655  
    11<?php
    2  // New activation code here next week.
     2
     3function bp_core_screen_activation() {
     4    global $bp, $wpdb;
     5   
     6    if ( BP_ACTIVATION_SLUG != $bp->current_component )
     7        return false;
     8       
     9    /* Check if an activation key has been passed */
     10    if ( isset( $_GET['key'] ) ) {
     11       
     12        require_once( ABSPATH . WPINC . '/registration.php' );
     13       
     14        /* Activate the signup */
     15        $signup = apply_filters( 'bp_core_activate_account', wpmu_activate_signup( $_GET['key'] ) );
     16       
     17        /* If there was errors, add a message and redirect */
     18        if ( $signup->errors ) {
     19            bp_core_add_message( __( 'There was an error activating your account, please try again.', 'buddypress' ), 'error' );
     20            bp_core_redirect( $bp->root_domain . '/' . BP_ACTIVATION_SLUG );
     21        }
     22       
     23        /* Set the password */
     24        if ( !empty( $signup['meta']['password'] ) )
     25            $wpdb->update( $wpdb->users, array( 'user_pass' => $signup['meta']['password'] ), array( 'ID' => $signup['user_id'] ), array( '%s' ), array( '%d' ) );
     26       
     27        /* Set any profile data */
     28        if ( function_exists( 'xprofile_set_field_data' ) ) {
     29           
     30            if ( !empty( $signup['meta']['profile_field_ids'] ) ) {
     31                $profile_field_ids = explode( ',', $signup['meta']['profile_field_ids'] );
     32           
     33                foreach( $profile_field_ids as $field_id ) {
     34                    $current_field = $signup['meta']["field_{$field_id}"];
     35               
     36                    if ( !empty( $current_field ) )
     37                        xprofile_set_field_data( $field_id, $signup['user_id'], $current_field );
     38                }
     39            }
     40           
     41        }
     42       
     43        /* Check for an uploaded avatar and move that to the correct user folder */
     44        $hashed_key = wp_hash( $_GET['key'] );
     45       
     46        /* Check if the avatar folder exists. If it does, move rename it, move it and delete the signup avatar dir */
     47        if ( file_exists( WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/signups/' . $hashed_key ) ) {
     48            @rename( WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/signups/' . $hashed_key, WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/' . $signup['user_id'] );
     49        }
     50       
     51        do_action( 'bp_core_account_activated', &$signup, $_GET['key'] );
     52        bp_core_add_message( __( 'Your account is now active!', 'buddypress' ) );
     53       
     54        $bp->activation_complete = true;
     55    }
     56   
     57    bp_core_load_template( 'registration/activate' );
     58}
     59add_action( 'wp', 'bp_core_screen_activation', 3 );
     60
    361?>
Note: See TracChangeset for help on using the changeset viewer.