当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_update_option函数代码示例

本文整理汇总了PHP中bp_update_option函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_update_option函数的具体用法?PHP bp_update_option怎么用?PHP bp_update_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_update_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_bp_xprofile_fullname_field_id_invalidation

 /**
  * @group bp_xprofile_fullname_field_id
  * @group cache
  */
 public function test_bp_xprofile_fullname_field_id_invalidation()
 {
     // Prime the cache
     $id = bp_xprofile_fullname_field_id();
     bp_update_option('bp-xprofile-fullname-field-name', 'foo');
     $this->assertFalse(wp_cache_get('fullname_field_id', 'bp_xprofile'));
 }
开发者ID:dcavins,项目名称:buddypress-svn,代码行数:11,代码来源:functions.php

示例2: test_group_access_test_friends

 /**
  * @group invite_anyone_group_invite_access_test
  *
  * Using this as a proxy for testing every possible combination
  */
 public function test_group_access_test_friends()
 {
     $settings = bp_get_option('invite_anyone');
     bp_update_option('invite_anyone', array('group_invites_can_admin' => 'friends', 'group_invites_can_group_admin' => 'friends', 'group_invites_can_group_mod' => 'friends', 'group_invites_can_group_member' => 'friends'));
     unset($GLOBALS['iaoptions']);
     $g = $this->factory->group->create();
     $u1 = $this->factory->user->create(array('role' => 'administrator'));
     $this->add_user_to_group($u1, $g);
     $u2 = $this->factory->user->create();
     $this->add_user_to_group($u2, $g);
     $u3 = $this->factory->user->create();
     $this->add_user_to_group($u3, $g);
     $m3 = new BP_Groups_Member($u3, $g);
     $m3->promote('mod');
     $u4 = $this->factory->user->create();
     $this->add_user_to_group($u4, $g);
     $m4 = new BP_Groups_Member($u4, $g);
     $m4->promote('admin');
     $user = new WP_User($u1);
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u1));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u2));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u3));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u4));
     bp_update_option('invite_anyone', $settings);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:30,代码来源:test-sample.php

示例3: test_bp_core_delete_account

 /**
  * @ticket BP4915
  * @group bp_core_delete_account
  */
 public function test_bp_core_delete_account()
 {
     // Stash
     $current_user = get_current_user_id();
     $deletion_disabled = bp_disable_account_deletion();
     // Create an admin for testing
     $admin_user = $this->factory->user->create(array('role' => 'administrator'));
     $this->grant_super_admin($admin_user);
     // 1. Admin can delete user account
     $this->set_current_user($admin_user);
     $user1 = $this->factory->user->create(array('role' => 'subscriber'));
     bp_core_delete_account($user1);
     $maybe_user = new WP_User($user1);
     $this->assertEquals(0, $maybe_user->ID);
     unset($maybe_user);
     $this->restore_admins();
     // 2. Admin cannot delete superadmin account
     $user2 = $this->factory->user->create(array('role' => 'administrator'));
     $this->grant_super_admin($user2);
     bp_core_delete_account($user2);
     $maybe_user = new WP_User($user2);
     $this->assertNotEquals(0, $maybe_user->ID);
     unset($maybe_user);
     // User cannot delete other's account
     $user3 = $this->factory->user->create(array('role' => 'subscriber'));
     $user4 = $this->factory->user->create(array('role' => 'subscriber'));
     $this->set_current_user($user3);
     bp_core_delete_account($user4);
     $maybe_user = new WP_User($user4);
     $this->assertNotEquals(0, $maybe_user->ID);
     unset($maybe_user);
     // Cleanup
     $this->set_current_user($current_user);
     bp_update_option('bp-disable-account-deletion', $deletion_disabled);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:39,代码来源:functions.php

示例4: bp_core_install_extended_profiles

function bp_core_install_extended_profiles()
{
    global $nxtdb;
    $charset_collate = bp_core_set_charset();
    $bp_prefix = bp_core_get_table_prefix();
    // These values should only be updated if they are not already present
    if (!($base_group_name = bp_get_option('bp-xprofile-base-group-name'))) {
        bp_update_option('bp-xprofile-base-group-name', _x('Base', 'First XProfile group name', 'buddypress'));
    }
    if (!($fullname_field_name = bp_get_option('bp-xprofile-fullname-field-name'))) {
        bp_update_option('bp-xprofile-fullname-field-name', _x('Name', 'XProfile fullname field name', 'buddypress'));
    }
    $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_groups (\n\t\t\t    id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t    name varchar(150) NOT NULL,\n\t\t\t    description mediumtext NOT NULL,\n\t\t\t    group_order bigint(20) NOT NULL DEFAULT '0',\n\t\t\t    can_delete tinyint(1) NOT NULL,\n\t\t\t    KEY can_delete (can_delete)\n\t\t\t   ) {$charset_collate};";
    $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_fields (\n\t\t\t    id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t    group_id bigint(20) unsigned NOT NULL,\n\t\t\t    parent_id bigint(20) unsigned NOT NULL,\n\t\t\t    type varchar(150) NOT NULL,\n\t\t\t    name varchar(150) NOT NULL,\n\t\t\t    description longtext NOT NULL,\n\t\t\t    is_required tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t    is_default_option tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t    field_order bigint(20) NOT NULL DEFAULT '0',\n\t\t\t    option_order bigint(20) NOT NULL DEFAULT '0',\n\t\t\t    order_by varchar(15) NOT NULL DEFAULT '',\n\t\t\t    can_delete tinyint(1) NOT NULL DEFAULT '1',\n\t\t\t    KEY group_id (group_id),\n\t\t\t    KEY parent_id (parent_id),\n\t\t\t    KEY field_order (field_order),\n\t\t\t    KEY can_delete (can_delete),\n\t\t\t    KEY is_required (is_required)\n\t\t\t   ) {$charset_collate};";
    $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_data (\n\t\t\t    id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t    field_id bigint(20) unsigned NOT NULL,\n\t\t\t    user_id bigint(20) unsigned NOT NULL,\n\t\t\t    value longtext NOT NULL,\n\t\t\t    last_updated datetime NOT NULL,\n\t\t\t    KEY field_id (field_id),\n\t\t\t    KEY user_id (user_id)\n\t\t\t   ) {$charset_collate};";
    $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_meta (\n\t\t\t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\tobject_id bigint(20) NOT NULL,\n\t\t\t\tobject_type varchar(150) NOT NULL,\n\t\t\t\tmeta_key varchar(255) DEFAULT NULL,\n\t\t\t\tmeta_value longtext DEFAULT NULL,\n\t\t\t\tKEY object_id (object_id),\n\t\t\t\tKEY meta_key (meta_key)\n\t\t   \t   ) {$charset_collate};";
    dbDelta($sql);
    // Insert the default group and fields
    $insert_sql = array();
    if (!$nxtdb->get_var("SELECT id FROM {$bp_prefix}bp_xprofile_groups WHERE id = 1")) {
        $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_groups ( name, description, can_delete ) VALUES ( " . $nxtdb->prepare('%s', stripslashes(bp_get_option('bp-xprofile-base-group-name'))) . ", '', 0 );";
    }
    if (!$nxtdb->get_var("SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE id = 1")) {
        $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_fields ( group_id, parent_id, type, name, description, is_required, can_delete ) VALUES ( 1, 0, 'textbox', " . $nxtdb->prepare('%s', stripslashes(bp_get_option('bp-xprofile-fullname-field-name'))) . ", '', 1, 0 );";
    }
    dbDelta($insert_sql);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:27,代码来源:bp-core-schema.php

示例5: tearDown

 public function tearDown()
 {
     if (is_multisite()) {
         update_site_option('registration', $this->signup_allowed);
     } else {
         bp_update_option('users_can_register', $this->signup_allowed);
     }
     parent::tearDown();
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:9,代码来源:class-bp-signup.php

示例6: admin_submit

 function admin_submit()
 {
     if (isset($_POST['bp-smp-submit'])) {
         if (!is_super_admin()) {
             return;
         }
         check_admin_referer('bp_smp');
         $save_data = $_POST['bp_smp'];
         // Make sure that there is an empty 'display' array if no data is sent
         if (!isset($save_data['display'])) {
             $save_data['display'] = array();
         }
         bp_update_option('bp_smp_settings', $save_data);
         // Redirect to avoid any refresh issues
         $redirect_url = add_query_arg('page', 'bp-smp', is_network_admin() ? network_admin_url('admin.php') : admin_url('admin.php'));
         wp_redirect($redirect_url);
     }
 }
开发者ID:rjbaniel,项目名称:bp-social-media-profiles,代码行数:18,代码来源:admin.php

示例7: bp_checkins_admin_css

function bp_checkins_admin_css()
{
    wp_enqueue_style('bp-checkins-admin-css', BP_CHECKINS_PLUGIN_URL_CSS . '/admin.css');
    if (isset($_POST['bp_checkins_admin_submit']) && isset($_POST['bpci-admin'])) {
        if (!check_admin_referer('bp-checkins-admin')) {
            return false;
        }
        // Settings form submitted, now save the settings.
        foreach ((array) $_POST['bpci-admin'] as $key => $value) {
            bp_update_option($key, $value);
        }
    }
    /* handling install / desinstall of checkin page ! */
    $checkins_and_places_activated = (int) bp_get_option('bp-checkins-activate-component');
    $pages = bp_get_option('bp-pages');
    $active_components = bp_get_option('bp-active-components');
    if ($checkins_and_places_activated == 1) {
        // first check if page exists !
        if (empty($pages[BP_CHECKINS_SLUG])) {
            $page_checkins = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords(BP_CHECKINS_SLUG), 'post_status' => 'publish', 'post_type' => 'page'));
            $pages[BP_CHECKINS_SLUG] = $page_checkins;
            bp_update_option('bp-pages', $pages);
        }
        if (empty($active_components[BP_CHECKINS_SLUG])) {
            $active_components[BP_CHECKINS_SLUG] = 1;
            bp_update_option('bp-active-components', $active_components);
        }
        do_action('bp_checkins_component_activated');
    } else {
        if (!empty($pages[BP_CHECKINS_SLUG])) {
            wp_delete_post($pages[BP_CHECKINS_SLUG], true);
            unset($pages[BP_CHECKINS_SLUG]);
            bp_update_option('bp-pages', $pages);
        }
        if (!empty($active_components[BP_CHECKINS_SLUG])) {
            unset($active_components[BP_CHECKINS_SLUG]);
            bp_update_option('bp-active-components', $active_components);
        }
        do_action('bp_checkins_component_deactivated');
    }
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:41,代码来源:bp-checkins-admin.php

示例8: test_buddydrive_upload_item_mimes

 /**
  * @group upload
  * @group check_mimes
  */
 public function test_buddydrive_upload_item_mimes()
 {
     $reset_files = $_FILES;
     $reset_post = $_POST;
     $file = trailingslashit(buddydrive()->plugin_dir) . 'readme.txt';
     $tmp_name = wp_tempnam($file);
     copy($file, $tmp_name);
     $_POST['action'] = 'buddydrive_upload';
     $_FILES['buddyfile-upload'] = array('tmp_name' => $tmp_name, 'name' => 'readme.txt', 'type' => 'text/plain', 'error' => 0, 'size' => filesize($file));
     bp_update_option('_buddydrive_allowed_extensions', array('png'));
     // Upload the file
     $upload = buddydrive_upload_item($_FILES, bp_loggedin_user_id());
     $this->assertTrue(!empty($upload['error']));
     bp_update_option('_buddydrive_allowed_extensions', array('png', 'txt|asc|c|cc|h|srt'));
     $upload = buddydrive_upload_item($_FILES, bp_loggedin_user_id());
     $this->assertTrue(file_exists($upload['file']));
     bp_delete_option('_buddydrive_allowed_extensions');
     // clean up!
     $_FILES = $reset_files;
     $_POST = $reset_post;
 }
开发者ID:MrVibe,项目名称:buddydrive,代码行数:25,代码来源:item-functions.php

示例9: bp_rbe_activate

/**
 * Adds default settings when plugin is activated
 */
function bp_rbe_activate()
{
    // Load the bp-rbe functions file
    require BP_RBE_DIR . '/includes/bp-rbe-functions.php';
    if (!($settings = bp_get_option('bp-rbe'))) {
        $settings = array();
    }
    // Set default mode to Inbound if no mode exists
    if (!isset($settings['mode'])) {
        $settings['mode'] = 'inbound';
    }
    // generate a unique key if one doesn't exist
    if (!isset($settings['key'])) {
        $settings['key'] = uniqid('');
    }
    // set a default value for the keepalive value
    if (!isset($settings['keepalive'])) {
        $settings['keepalive'] = bp_rbe_get_execution_time('minutes');
    }
    bp_update_option('bp-rbe', $settings);
    // remove remnants from any previous failed attempts to stop the inbox
    bp_rbe_cleanup();
}
开发者ID:r-a-y,项目名称:bp-reply-by-email,代码行数:26,代码来源:loader.php

示例10: test_bp_core_get_directory_pages_pages_settings_update

 public function test_bp_core_get_directory_pages_pages_settings_update()
 {
     // Set the cache
     $pages = bp_core_get_directory_pages();
     // Mess with it but put it back
     $v = bp_get_option('bp-pages');
     bp_update_option('bp-pages', 'foo');
     $this->assertFalse(wp_cache_get('directory_pages', 'bp'));
     bp_update_option('bp-pages', $v);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:10,代码来源:bpCoreGetDirectoryPageIds.php

示例11: bp_docs_upgrade_1_2

function bp_docs_upgrade_1_2($udata = array())
{
    global $wpdb;
    $url_base = admin_url(add_query_arg(array('post_type' => bp_docs_get_post_type_name(), 'page' => 'bp-docs-upgrade'), 'edit.php'));
    if (empty($udata['total'])) {
        $udata['total'] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = %s", bp_docs_get_post_type_name()));
    }
    if (!isset($udata['done'])) {
        $udata['done'] = 0;
    }
    if (empty($udata['group_terms_migrated'])) {
        $tn = bp_docs_get_associated_item_tax_name();
        // Get the group parent term
        $group_parent_term = term_exists('group', $tn);
        // Get all the group terms
        if ($group_parent_term) {
            // Delete the cached children terms, for good measure
            delete_option($tn . '_children');
            $group_terms = get_terms($tn, array('parent' => intval($group_parent_term['term_id'])));
            foreach ($group_terms as $group_term) {
                // Concatenate new term slugs
                $new_desc = sprintf(__('Docs associated with the group %s', 'bp-docs'), $group_term->description);
                $new_slug = 'bp_docs_associated_group_' . $group_term->name;
                $new_name = $group_term->description;
                wp_update_term($group_term->term_id, $tn, array('description' => $new_desc, 'slug' => $new_slug, 'name' => $new_name, 'parent' => 0));
            }
        }
        // Store that we're done
        $udata['group_terms_migrated'] = 1;
        $udata['message'] = __('Group terms migrated. Now migrating Doc access terms....', 'bp-docs');
        $udata['refresh_url'] = add_query_arg(array('do_upgrade' => '1', '_wpnonce' => wp_create_nonce('bp-docs-upgrade')), $url_base);
        $udata['total'] = 0;
    } else {
        if (intval($udata['done']) < intval($udata['total'])) {
            $counter = 0;
            while ($counter < 5) {
                $next_doc_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND ID > %d LIMIT 1", bp_docs_get_post_type_name(), intval($udata['last'])));
                if (!$next_doc_id) {
                    $udata['done'] = $udata['total'];
                    $all_done = true;
                    break;
                }
                // Set the 'read' setting to a taxonomy
                $doc_settings = get_post_meta($next_doc_id, 'bp_docs_settings', true);
                if (isset($doc_settings['read'])) {
                    $read_setting = $doc_settings['read'];
                } else {
                    $group = groups_get_group('group_id=' . bp_docs_get_associated_group_id($next_doc_id));
                    if (!empty($group->status) && 'public' != $group->status) {
                        $read_setting = 'group-members';
                        // Sanitize settings as well
                        foreach ($doc_settings as $doc_settings_key => $doc_settings_value) {
                            if (in_array($doc_settings_value, array('anyone', 'loggedin'))) {
                                $doc_settings[$doc_settings_key] = 'group-members';
                            }
                        }
                        $doc_settings['read'] = 'group-members';
                        update_post_meta($next_doc_id, 'bp_docs_settings', $doc_settings);
                    } else {
                        $read_setting = 'anyone';
                    }
                }
                bp_docs_update_doc_access($next_doc_id, $read_setting);
                // Count the total number of edits
                $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = 'revision' AND post_status = 'inherit' AND post_parent = %d", $next_doc_id));
                update_post_meta($next_doc_id, 'bp_docs_revision_count', $count + 1);
                $counter++;
                $udata['done']++;
                $udata['last'] = $next_doc_id;
                $udata['message'] = sprintf(__('Migrated %s of %s Docs. Migrating....', 'bp-docs'), $udata['done'], $udata['total']);
                $udata['refresh_url'] = add_query_arg(array('do_upgrade' => '1', '_wpnonce' => wp_create_nonce('bp-docs-upgrade')), $url_base);
            }
        } else {
            $all_done = true;
            $udata['refresh_url'] = add_query_arg(array('bp_docs_upgraded' => 1), admin_url());
        }
    }
    if (isset($all_done)) {
        bp_update_option('_bp_docs_done_upgrade_1_2', 1);
    }
    return $udata;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:82,代码来源:upgrade.php

示例12: xprofile_admin_manage_field

/**
 * Handles the adding or editing of profile field data for a user.
 */
function xprofile_admin_manage_field($group_id, $field_id = null)
{
    global $bp, $wpdb, $message, $groups;
    $field = new BP_XProfile_Field($field_id);
    $field->group_id = $group_id;
    if (isset($_POST['saveField'])) {
        if (BP_XProfile_Field::admin_validate()) {
            $field->name = wp_filter_kses($_POST['title']);
            $field->description = !empty($_POST['description']) ? wp_filter_kses($_POST['description']) : '';
            $field->is_required = wp_filter_kses($_POST['required']);
            $field->type = wp_filter_kses($_POST['fieldtype']);
            if (!empty($_POST["sort_order_{$field->type}"])) {
                $field->order_by = wp_filter_kses($_POST["sort_order_{$field->type}"]);
            }
            $field->field_order = $wpdb->get_var($wpdb->prepare("SELECT field_order FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id));
            if (!$field->field_order) {
                $field->field_order = (int) $wpdb->get_var($wpdb->prepare("SELECT max(field_order) FROM {$bp->profile->table_name_fields} WHERE group_id = %d", $group_id));
                $field->field_order++;
            }
            // For new profile fields, set the $field_id. For existing profile fields,
            // this will overwrite $field_id with the same value.
            $field_id = $field->save();
            if (!$field_id) {
                $message = __('There was an error saving the field. Please try again', 'buddypress');
                $type = 'error';
                unset($_GET['mode']);
                xprofile_admin($message, $type);
            } else {
                $message = __('The field was saved successfully.', 'buddypress');
                $type = 'success';
                if (1 == $field_id) {
                    bp_update_option('bp-xprofile-fullname-field-name', $field->name);
                }
                if (!empty($_POST['default-visibility'])) {
                    bp_xprofile_update_field_meta($field_id, 'default_visibility', $_POST['default-visibility']);
                }
                if (!empty($_POST['allow-custom-visibility'])) {
                    bp_xprofile_update_field_meta($field_id, 'allow_custom_visibility', $_POST['allow-custom-visibility']);
                }
                unset($_GET['mode']);
                do_action('xprofile_fields_saved_field', $field);
                $groups = bp_xprofile_get_groups();
                xprofile_admin($message, $type);
            }
        } else {
            $field->render_admin_form($message);
        }
    } else {
        $field->render_admin_form();
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:54,代码来源:bp-xprofile-admin.php

示例13: bp_core_admin_settings_save

/**
 * Save our settings.
 *
 * @since 1.6.0
 */
function bp_core_admin_settings_save()
{
    global $wp_settings_fields;
    if (isset($_GET['page']) && 'bp-settings' == $_GET['page'] && !empty($_POST['submit'])) {
        check_admin_referer('buddypress-options');
        // Because many settings are saved with checkboxes, and thus will have no values
        // in the $_POST array when unchecked, we loop through the registered settings.
        if (isset($wp_settings_fields['buddypress'])) {
            foreach ((array) $wp_settings_fields['buddypress'] as $section => $settings) {
                foreach ($settings as $setting_name => $setting) {
                    $value = isset($_POST[$setting_name]) ? $_POST[$setting_name] : '';
                    bp_update_option($setting_name, $value);
                }
            }
        }
        // Some legacy options are not registered with the Settings API, or are reversed in the UI.
        $legacy_options = array('bp-disable-account-deletion', 'bp-disable-avatar-uploads', 'bp-disable-cover-image-uploads', 'bp-disable-group-avatar-uploads', 'bp-disable-group-cover-image-uploads', 'bp_disable_blogforum_comments', 'bp-disable-profile-sync', 'bp_restrict_group_creation', 'hide-loggedout-adminbar');
        foreach ($legacy_options as $legacy_option) {
            // Note: Each of these options is represented by its opposite in the UI
            // Ie, the Profile Syncing option reads "Enable Sync", so when it's checked,
            // the corresponding option should be unset.
            $value = isset($_POST[$legacy_option]) ? '' : 1;
            bp_update_option($legacy_option, $value);
        }
        bp_core_redirect(add_query_arg(array('page' => 'bp-settings', 'updated' => 'true'), bp_get_admin_url('admin.php')));
    }
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:32,代码来源:bp-core-admin-settings.php

示例14: cfbgr_set_xprofile_member_types_field

/**
 * Save the profile field that will hold the member types
 *
 * @param  BP_XProfile_Field $field
 */
function cfbgr_set_xprofile_member_types_field($field = null)
{
    if (empty($field->id)) {
        return;
    }
    $saved_option = (int) bp_get_option('cfbgr_xfield_id', 0);
    if (!empty($saved_option) && $saved_option !== (int) $field->id) {
        return;
    }
    if (!empty($saved_option) && $saved_option === (int) $field->id) {
        if ('member_type' !== $field->type) {
            bp_delete_option('cfbgr_xfield_id');
        }
    }
    // First time
    if (empty($saved_option) && 'member_type' === $field->type) {
        bp_update_option('cfbgr_xfield_id', (int) $field->id);
    }
}
开发者ID:WeFoster,项目名称:buddypress-group-restrictions,代码行数:24,代码来源:functions.php

示例15: bp_version_updater

/**
 * BuddyPress's version updater looks at what the current database version is,
 * and runs whatever other code is needed.
 *
 * This is most-often used when the data schema changes, but should also be used
 * to correct issues with BuddyPress metadata silently on software update.
 *
 * @since BuddyPress (1.7)
 */
function bp_version_updater()
{
    // Get the raw database version
    $raw_db_version = (int) bp_get_db_version_raw();
    $default_components = apply_filters('bp_new_install_default_components', array('activity' => 1, 'members' => 1, 'xprofile' => 1));
    require_once BP_PLUGIN_DIR . '/bp-core/admin/bp-core-schema.php';
    // Install BP schema and activate only Activity and XProfile
    if (bp_is_install()) {
        // Apply schema and set Activity and XProfile components as active
        bp_core_install($default_components);
        bp_update_option('bp-active-components', $default_components);
        bp_core_add_page_mappings($default_components, 'delete');
        // Upgrades
    } else {
        // Run the schema install to update tables
        bp_core_install();
        // 1.5
        if ($raw_db_version < 1801) {
            bp_update_to_1_5();
            bp_core_add_page_mappings($default_components, 'delete');
        }
        // 1.6
        if ($raw_db_version < 6067) {
            bp_update_to_1_6();
        }
    }
    /** All done! *************************************************************/
    // Bump the version
    bp_version_bump();
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:39,代码来源:bp-core-update.php


注:本文中的bp_update_option函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。