Skip to:
Content

BuddyPress.org

Changeset 2863 for trunk/bp-friends.php


Ignore:
Timestamp:
03/22/2010 11:34:23 AM (15 years ago)
Author:
apeatling
Message:

Added new install/upgrade wizard. Removed root components and replaced them with actual WordPress pages. Testing on WordPress vhost/novhost and root profile support still to do.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends.php

    r2822 r2863  
    11<?php
    2 
    3 define ( 'BP_FRIENDS_DB_VERSION', '1800' );
    4 
    5 /* Define the slug for the component */
    6 if ( !defined( 'BP_FRIENDS_SLUG' ) )
    7     define ( 'BP_FRIENDS_SLUG', 'friends' );
    8 
    92require ( BP_PLUGIN_DIR . '/bp-friends/bp-friends-classes.php' );
    103require ( BP_PLUGIN_DIR . '/bp-friends/bp-friends-templatetags.php' );
    114
    12 function friends_install() {
    13     global $wpdb, $bp;
    14 
    15     if ( !empty($wpdb->charset) )
    16         $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    17 
    18     $sql[] = "CREATE TABLE {$bp->friends->table_name} (
    19                 id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    20                 initiator_user_id bigint(20) NOT NULL,
    21                 friend_user_id bigint(20) NOT NULL,
    22                 is_confirmed bool DEFAULT 0,
    23                 is_limited bool DEFAULT 0,
    24                 date_created datetime NOT NULL,
    25                 KEY initiator_user_id (initiator_user_id),
    26                 KEY friend_user_id (friend_user_id)
    27                ) {$charset_collate};";
    28 
    29     require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
    30     dbDelta($sql);
    31 
    32     update_site_option( 'bp-friends-db-version', BP_FRIENDS_DB_VERSION );
    33 }
    34 
    355function friends_setup_globals() {
    366    global $bp, $wpdb;
     7
     8    if ( !defined( 'BP_FRIENDS_SLUG' ) )
     9        define( 'BP_FRIENDS_SLUG', 'friends' );
    3710
    3811    /* For internal identification */
     
    4922}
    5023add_action( 'bp_setup_globals', 'friends_setup_globals' );
    51 
    52 function friends_check_installed() {
    53     global $wpdb, $bp;
    54 
    55     if ( !is_site_admin() )
    56         return false;
    57 
    58     /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    59     if ( get_site_option( 'bp-friends-db-version' ) < BP_FRIENDS_DB_VERSION )
    60         friends_install();
    61 }
    62 add_action( 'admin_menu', 'friends_check_installed' );
    6324
    6425function friends_setup_nav() {
Note: See TracChangeset for help on using the changeset viewer.