• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_current_user_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: tearDown

 public function tearDown()
 {
     if (get_current_user_id() != $this->current_user) {
         wp_delete_user(get_current_user_id());
     }
     wp_set_current_user($this->current_user);
 }
开发者ID:stevenslack,项目名称:wordpress-fieldmanager,代码行数:7,代码来源:test-fieldmanager-term-meta.php


示例2: user_menu

 /**
  * 
  *  Woo User Menu
  */
 function user_menu()
 {
     $_Twoot_Woo = new Twoot_Woo();
     $url = $_Twoot_Woo->shop_urls();
     $user_data = get_userdata(get_current_user_id());
     $avatar = get_option('show_avatars') ? '<span class="avatar">' . get_avatar(get_current_user_id(), 20) . '</span>' : '';
     $tag = get_option('permalink_structure') == false ? '&' : '?';
     $html = '<nav id="woo-user-menu">';
     $html .= '<ul class="sf-menu clearfix">';
     if (is_user_logged_in()) {
         $html .= '<li class="my-account"><a href="' . $url['account_overview'] . '">' . $avatar . esc_attr__('Howdy, ', 'Twoot') . $user_data->display_name . '</a>';
         $html .= '<ul>';
         $html .= '<li class="account-change-pw"><a href="' . $url['account_change_pw'] . '">' . esc_attr__('Change Password', 'Twoot') . '</a></li>';
         $html .= '<li class="account-edit-adress"><a href="' . $url['account_edit_adress'] . '">' . esc_attr__('Edit Address', 'Twoot') . '</a></li>';
         $html .= '<li class="account-view-order"><a href="' . $url['account_view_order'] . '">' . esc_attr__('View Order', 'Twoot') . '</a></li>';
         $html .= '<li class="cart"><a href="' . $url['cart'] . '">' . esc_attr__('Shopping Cart', 'Twoot') . '</a></li>';
         $html .= '<li class="checkout"><a href="' . $url['checkout'] . '">' . esc_attr__('Checkout', 'Twoot') . '</a></li>';
         $html .= '</ul>';
         $html .= '</li>';
         $html .= '<li class="logout last"><a href="' . $url['logout'] . '">' . esc_attr__('Sign Out', 'Twoot') . '</a></li>';
     } else {
         if (get_option('users_can_register') && get_option('woocommerce_enable_myaccount_registration') == 'yes') {
             $html .= '<li class="register"><a href="' . $url['register'] . $tag . 'user_account=register">' . esc_attr__('Create Account', 'Twoot') . '</a></li>';
         }
         $html .= '<li class="login last"><a href="' . $url['account_overview'] . $tag . 'user_account=login">' . esc_attr__('Sign In', 'Twoot') . '</a></li>';
     }
     $html .= '</ul>';
     $html .= '</nav>';
     return $html;
 }
开发者ID:sniezekjp,项目名称:prod-fs,代码行数:34,代码来源:woo-generator.php


示例3: process

 /**
  *	Process the request
  *	@todo Setting for reassigning user's posts
  */
 public function process()
 {
     // Verify the security nonce and die if it fails
     if (!isset($_POST['wp_delete_user_accounts_nonce']) || !wp_verify_nonce($_POST['wp_delete_user_accounts_nonce'], 'wp_delete_user_accounts_nonce')) {
         wp_send_json(array('status' => 'fail', 'title' => __('Error!', 'wp-delete-user-accounts'), 'message' => __('Request failed security check.', 'wp-delete-user-accounts')));
     }
     // Don't permit admins to delete their own accounts
     if (current_user_can('manage_options')) {
         wp_send_json(array('status' => 'fail', 'title' => __('Error!', 'wp-delete-user-accounts'), 'message' => __('Administrators cannot delete their own accounts.', 'wp-delete-user-accounts')));
     }
     // Get the current user
     $user_id = get_current_user_id();
     // Get user meta
     $meta = get_user_meta($user_id);
     // Delete user's meta
     foreach ($meta as $key => $val) {
         delete_user_meta($user_id, $key);
     }
     // Destroy user's session
     wp_logout();
     // Delete the user's account
     $deleted = wp_delete_user($user_id);
     if ($deleted) {
         // Send success message
         wp_send_json(array('status' => 'success', 'title' => __('Success!', 'wp-delete-user-accounts'), 'message' => __('Your account was successfully deleted. Fair well.', 'wp-delete-user-accounts')));
     } else {
         wp_send_json(array('status' => 'fail', 'title' => __('Error!', 'wp-delete-user-accounts'), 'message' => __('Request failed.', 'wp-delete-user-accounts')));
     }
 }
开发者ID:EngageWP,项目名称:wp-delete-user-accounts,代码行数:33,代码来源:process-ajax.php


示例4: display

 public function display()
 {
     if (isset($_GET['form_id'])) {
         if ('new' == $_GET['form_id']) {
             $form_id = 'tmp-' . time();
         } else {
             $form_id = is_numeric($_GET['form_id']) ? absint($_GET['form_id']) : '';
         }
         /*
          * FORM BUILDER
          */
         Ninja_Forms::template('admin-menu-new-form.html.php');
         $this->_enqueue_the_things($form_id);
         delete_user_option(get_current_user_id(), 'nf_form_preview_' . $form_id);
         if (!isset($_GET['ajax'])) {
             $this->_localize_form_data($form_id);
             $this->_localize_field_type_data();
             $this->_localize_action_type_data();
             $this->_localize_form_settings();
             $this->_localize_merge_tags();
         }
     } else {
         /*
          * ALL FORMS TABLE
          */
         $this->table->prepare_items();
         Ninja_Forms::template('admin-menu-all-forms.html.php', array('table' => $this->table, 'add_new_url' => admin_url('admin.php?page=ninja-forms&form_id=new'), 'add_new_text' => __('Add New Form', 'ninja-forms')));
     }
 }
开发者ID:Rehabescapi,项目名称:GVSU-Senior-Project-Hola,代码行数:29,代码来源:Forms.php


示例5: archive

    public function archive($bolo_id)
    {
        $servername = "localhost";
        $username = "root";
        $password = "";
        $dbname = "bolo_creator";
        // Create connection
        $conn = new mysqli($servername, $username, $password, $dbname);
        // Check connection
        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }
        //mark bolo as archived
        $sql2 = <<<SQL
\t    UPDATE wp_flierform
\t    SET archive = TRUE
\t    WHERE bolo_id = "{$boloid}"
SQL;
        if (!($result = $conn->query($sql2))) {
            die('There was an error running the query [' . $db->error . ']');
        }
        //archive the bolo
        $author = get_current_user_id();
        $sql = <<<SQL
\t    INSERT INTO bolo_archive
\t    SELECT *, "{$author}" AS archive_author, CURRENT_TIMESTAMP()
\t    FROM wp_flierform\t    
\t    WHERE bolo_id = "{$boloid}"
SQL;
        if (!($result = $conn->query($sql))) {
            die('There was an error running the query [' . $db->error . ']');
        }
    }
开发者ID:rdelr011,项目名称:BOLO-Flier-Creator,代码行数:33,代码来源:archive_model.php


示例6: add_pointers

 public function add_pointers()
 {
     $pointers = $this->pointers;
     if (!$pointers || !is_array($pointers)) {
         return;
     }
     // Get dismissed pointers
     $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true));
     $valid_pointers = array();
     // Check pointers and remove dismissed ones.
     foreach ($pointers as $pointer_id => $pointer) {
         // Make sure we have pointers & check if they have been dismissed
         if (in_array($pointer_id, $dismissed) || empty($pointer) || empty($pointer_id) || empty($pointer['target']) || empty($pointer['options'])) {
             continue;
         }
         $pointer['pointer_id'] = $pointer_id;
         // Add the pointer to $valid_pointers array
         $valid_pointers['pointers'][] = $pointer;
     }
     // No valid pointers? Stop here.
     if (empty($valid_pointers)) {
         return;
     }
     $this->valid = $valid_pointers;
     wp_enqueue_style('wp-pointer');
     wp_enqueue_script('wp-pointer');
 }
开发者ID:robbuh,项目名称:CherryFramework,代码行数:27,代码来源:class.wp-help-pointers.php


示例7: show_seller_enable_message

 /**
  * Show Seller Enable Error Message
  *
  * @since 2.4
  *
  * @return void
  */
 public function show_seller_enable_message()
 {
     $user_id = get_current_user_id();
     if (!dokan_is_seller_enabled($user_id)) {
         echo dokan_seller_not_enabled_notice();
     }
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:14,代码来源:reports.php


示例8: user_role_change

 /**
  * Synchronize connected user role changes
  */
 static function user_role_change($user_id)
 {
     if (Jetpack::is_active() && Jetpack::is_user_connected($user_id)) {
         $current_user_id = get_current_user_id();
         wp_set_current_user($user_id);
         $role = Jetpack::translate_current_user_to_role();
         $signed_role = Jetpack::sign_role($role);
         wp_set_current_user($current_user_id);
         $master_token = Jetpack_Data::get_access_token(JETPACK_MASTER_USER);
         $master_user_id = absint($master_token->external_user_id);
         if (!$master_user_id) {
             return;
         }
         // this shouldn't happen
         Jetpack::xmlrpc_async_call('jetpack.updateRole', $user_id, $signed_role);
         //@todo retry on failure
         //try to choose a new master if we're demoting the current one
         if ($user_id == $master_user_id && 'administrator' != $role) {
             $query = new WP_User_Query(array('fields' => array('id'), 'role' => 'administrator', 'orderby' => 'id', 'exclude' => array($master_user_id)));
             $new_master = false;
             foreach ($query->results as $result) {
                 $uid = absint($result->id);
                 if ($uid && Jetpack::is_user_connected($uid)) {
                     $new_master = $uid;
                     break;
                 }
             }
             if ($new_master) {
                 Jetpack_Options::update_option('master_user', $new_master);
             }
             // else disconnect..?
         }
     }
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:37,代码来源:class.jetpack-sync-users.php


示例9: _admin_init

 function _admin_init()
 {
     global $post;
     $screen = get_current_screen();
     $pointers = array();
     if ($screen->base == 'post' && $screen->post_type == UBERGRID_POST_TYPE) {
         $pointers = array('#add-new-cell' => array('title' => __('Add a cell', 'uber-grid'), 'content' => __('<p>Click here to add a first cell to your grid.</p>', 'uber-grid'), 'position' => array('edge' => 'right', 'align' => 'center')), '#shortcode' => array('title' => __('Save your grid', 'uber-grid'), 'content' => sprintf(__('<p>After saving your grid, insert this code <strong>[ubergrid id=%s]</strong> into your site pages to use the grid.</p>', 'uber-grid'), $post->ID), 'position' => array('edge' => 'top')));
     }
     if ($screen->base == 'edit' && $screen->post_type == UBERGRID_POST_TYPE) {
         $pointers = array('.add-new-h2' => array('title' => __('Create a grid', 'uber-grid'), 'content' => __('<p>Please click here to create your first grid.</p>', 'uber-grid')));
     }
     $disabled = get_user_meta(get_current_user_id(), 'uber_grid_disabled_pointers', true);
     if ($disabled) {
         foreach ($disabled as $item) {
             if (isset($pointers[$item])) {
                 unset($pointers[$item]);
             }
         }
     }
     if ($pointers) {
         wp_enqueue_script("wp-pointer");
         wp_enqueue_style("wp-pointer");
         wp_enqueue_script('uber-grid-pointers', UBERGRID_URL . 'assets/js/admin-pointers.js');
         wp_localize_script('uber-grid-pointers', 'uber_grid_pointers', array($pointers));
     }
 }
开发者ID:jauregui82,项目名称:WpCaro,代码行数:26,代码来源:pointers.php


示例10: test_hide_all_for_user

 /**
  * @group get
  */
 public function test_hide_all_for_user()
 {
     $activity = $this->factory->activity->create(array('type' => 'activity_update'));
     BP_Activity_Activity::hide_all_for_user(get_current_user_id());
     $activity = BP_Activity_Activity::get(array('in' => $activity, 'show_hidden' => true));
     $this->assertEquals($activity['activities'][0]->hide_sitewide, 1);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:10,代码来源:class.BP_Activity_Activity.php


示例11: add_save

 public function add_save()
 {
     $rules = array(array('field' => 'name', 'label' => 'name', 'rules' => 'trim|required'), array('field' => 'address', 'label' => 'address', 'rules' => 'trim|required'), array('field' => 'contact_person', 'label' => 'contact person', 'rules' => 'trim|required'), array('field' => 'phone', 'label' => 'phone', 'rules' => 'trim'), array('field' => 'fax', 'label' => 'fax', 'rules' => 'trim'), array('field' => 'email', 'label' => 'email', 'rules' => 'trim|valid_email'), array('field' => 'qq', 'label' => 'QQ', 'rules' => 'trim'), array('field' => 'username', 'label' => 'user name', 'rules' => 'trim'), array('field' => 'web', 'label' => 'web', 'rules' => 'trim'));
     $this->form_validation->set_rules($rules);
     if ($this->form_validation->run() == FALSE) {
         $error = validation_errors();
         echo $this->create_json(0, $error);
         return;
     }
     // check if the provider exists ?
     if ($this->purchase_model->check_exists('purchase_provider', array('name' => $this->input->post('name')))) {
         echo $this->create_json(0, lang('provider_exists'));
         return;
     }
     $edit_user = get_current_user_id();
     $data = array('name' => trim($this->input->post('name')), 'boss' => trim($this->input->post('boss')), 'address' => trim($this->input->post('address')), 'phone' => trim($this->input->post('phone')), 'fax' => trim($this->input->post('fax')), 'email' => trim($this->input->post('email')), 'qq' => trim($this->input->post('qq')), 'web' => trim($this->input->post('web')), 'contact_person' => trim($this->input->post('contact_person')), 'mobile' => trim($this->input->post('mobile')), 'open_bank' => trim($this->input->post('open_bank')), 'bank_account' => trim($this->input->post('bank_account')), 'bank_title' => trim($this->input->post('bank_title')), 'edit_user' => $edit_user, 'remark' => trim($this->input->post('remark')));
     try {
         $provider_id = $this->purchase_model->add_a_new_provider($data);
         $user_ids = $this->input->post('permissions');
         if (!is_array($user_ids)) {
             settype($user_ids, 'array');
         }
         $user_id = $this->get_current_user_id();
         if (in_array($user_id, $user_ids) == FALSE) {
             array_push($user_ids, $user_id);
         }
         $this->purchase_model->save_purchase_permissions($provider_id, $user_ids);
         echo $this->create_json(1, lang('provider_saved'));
     } catch (Exception $e) {
         echo lang('error_msg');
         $this->ajax_failed();
     }
 }
开发者ID:ohjack,项目名称:mallerp_standard,代码行数:33,代码来源:provider.php


示例12: send_page_data_to_template

 /**
  * load data needed for board's javascript
  * @param  string $template the passed in template path
  * @return string           the same template path
  */
 static function send_page_data_to_template($template)
 {
     if (!isset(Kanban_Template::get_instance()->slug) || Kanban_Template::get_instance()->slug != self::$slug) {
         return $template;
     }
     global $wp_query;
     $wp_query->query_vars['kanban'] = (object) array();
     $wp_query->query_vars['kanban']->board = (object) array();
     // // get all data for the javascript
     $wp_query->query_vars['kanban']->board->allowed_users = Kanban_User::get_allowed_users();
     $wp_query->query_vars['kanban']->board->estimates = Kanban_Terms::terms_in_order('task', 'estimate');
     $wp_query->query_vars['kanban']->board->status_tax_key = Kanban_Utils::format_key('task', 'status');
     $wp_query->query_vars['kanban']->board->status_color_field_name = sprintf('%s_colors', $wp_query->query_vars['kanban']->board->status_tax_key);
     $wp_query->query_vars['kanban']->board->status_colors = Kanban_Settings::get_option($wp_query->query_vars['kanban']->board->status_color_field_name, null, array());
     $wp_query->query_vars['kanban']->board->statuses = Kanban_Terms::terms_in_order('task', 'status');
     foreach ($wp_query->query_vars['kanban']->board->statuses as $status) {
         if (!isset($wp_query->query_vars['kanban']->board->status_colors[$status->term_id])) {
             continue;
         }
         $status->color = $wp_query->query_vars['kanban']->board->status_colors[$status->term_id];
     }
     $wp_query->query_vars['kanban']->board->projects = Kanban_Project::get_all();
     $wp_query->query_vars['kanban']->board->tasks = Kanban_Task::get_all();
     $current_user_id = get_current_user_id();
     $wp_query->query_vars['kanban']->board->current_user = get_user_by('id', $current_user_id);
     unset($wp_query->query_vars['kanban']->board->current_user->data->user_pass);
     $wp_query->query_vars['kanban']->board->current_user->data->long_name_email = Kanban_User::format_user_name($wp_query->query_vars['kanban']->board->current_user);
     $wp_query->query_vars['kanban']->board->current_user->data->short_name = Kanban_User::format_user_name($wp_query->query_vars['kanban']->board->current_user, TRUE);
     $wp_query->query_vars['kanban']->board->current_user->data->initials = Kanban_User::get_initials($wp_query->query_vars['kanban']->board->current_user);
     $wp_query->query_vars['kanban']->board->col_percent_w = count($wp_query->query_vars['kanban']->board->statuses) > 0 ? 100 / count($wp_query->query_vars['kanban']->board->statuses) : 100;
     $wp_query->query_vars['kanban']->board->sidebar_w = count($wp_query->query_vars['kanban']->board->statuses) > 0 ? 100 / (count($wp_query->query_vars['kanban']->board->statuses) - 2) : 0;
     return $template;
 }
开发者ID:ahmadassaf,项目名称:WP-Kanban,代码行数:38,代码来源:class-board.php


示例13: display_payment_gateway_settings_form

    public function display_payment_gateway_settings_form()
    {
        $selected_gateway = (string) get_user_option('wpsc_settings_selected_payment_gateway', get_current_user_id());
        if (empty($selected_gateway) && !empty($this->active_gateways)) {
            $selected_gateway = $this->active_gateways[0];
        }
        $payment_data = $this->get_gateway_form($selected_gateway);
        if (!$payment_data) {
            $payment_data = array('name' => __('Edit Gateway Settings', 'wpsc'), 'form_fields' => __('Modify a payment gateway settings by clicking "Edit" link on the left.', 'wpsc'));
        }
        ?>
		<td id='wpsc-payment-gateway-settings-panel' class='wpsc-module-settings' rowspan='2'>
			<div class='postbox'>
			<h3 class='hndle'><?php 
        echo $payment_data['name'];
        ?>
</h3>
			<div class='inside'>
			<table class='form-table'>
				<?php 
        echo $payment_data['form_fields'];
        ?>
			</table>
			<div class='submit'>
				<input type='submit' value='<?php 
        _e('Update &raquo;', 'wpsc');
        ?>
' />
			</div>
		</div>
</td>
		<?php 
    }
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:33,代码来源:gateway.php


示例14: vote_poll

 /**
  * Poll Voting
  * @since 1.1
  * @version 1.1
  */
 public function vote_poll()
 {
     if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'polls' && is_user_logged_in()) {
         // Get Poll ID
         $poll_id = isset($_REQUEST['poll_id']) ? intval($_REQUEST['poll_id']) : 0;
         // Ensure Poll ID Is Valid
         if ($poll_id != 0) {
             // Verify Referer
             if (check_ajax_referer('poll_' . $poll_id . '-nonce', 'poll_' . $poll_id . '_nonce', false)) {
                 // Which View
                 switch ($_REQUEST['view']) {
                     case 'process':
                         $poll_aid = $_POST["poll_{$poll_id}"];
                         $poll_aid_array = array_unique(array_map('intval', explode(',', $poll_aid)));
                         if ($poll_id > 0 && !empty($poll_aid_array) && check_allowtovote()) {
                             $check_voted = check_voted($poll_id);
                             if ($check_voted == 0) {
                                 $user_id = get_current_user_id();
                                 // Make sure we are not excluded
                                 if (!$this->core->exclude_user($user_id)) {
                                     $this->core->add_creds('poll_voting', $user_id, $this->prefs['creds'], $this->prefs['log'], $poll_id, array('ref_type' => 'poll'), $this->mycred_type);
                                 }
                             }
                         }
                         break;
                 }
             }
         }
     }
 }
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:35,代码来源:mycred-hook-wp-polls.php


示例15: saveFieldset

 /**
  * Uloží fieldset
  * VOLÁ SE V HOOCE
  * 
  * @author Jan Pokorný
  * @param int $user_id
  */
 public function saveFieldset($user_id)
 {
     if (get_current_user_id() != $user_id && !current_user_can('edit_users')) {
         return;
     }
     $fieldset = $this->getFieldset();
     $form = new KT_form();
     $form->addFieldSetByObject($fieldset);
     $form->validate();
     if ($form->hasError()) {
         // TODO has error
     }
     if ($fieldset->getSerializeSave()) {
         $fieldsetData = $form->getSavableFieldsetGroupValue($fieldset);
         if (KT::arrayIssetAndNotEmpty($fieldsetData)) {
             update_user_meta($user_id, $fieldset->getName(), $fieldsetData);
         } else {
             delete_user_meta($user_id, $fieldset->getName());
         }
     } else {
         foreach ($fieldset->getFields() as $field) {
             $fieldValue = $form->getSavableFieldValue($field);
             if ($field && $fieldValue !== "") {
                 update_user_meta($user_id, $field->getName(), $fieldValue);
             } else {
                 delete_user_meta($user_id, $field->getName());
             }
         }
     }
 }
开发者ID:ktstudio,项目名称:wp-framework,代码行数:37,代码来源:kt_user_metabox.inc.php


示例16: test_menu_page_url

	function test_menu_page_url() {
		$current_user = get_current_user_id();
		wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
		update_option( 'siteurl', 'http://example.com' );

		// add some pages
		add_options_page( 'Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page' );
		add_management_page( 'Test Tools', 'Test Tools', 'manage_options', 'testtools', 'mt_tools_page' );
		add_menu_page( 'Test Toplevel', 'Test Toplevel', 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );
		add_submenu_page( 'mt-top-level-handle', 'Test Sublevel', 'Test Sublevel', 'manage_options', 'sub-page', 'mt_sublevel_page' );
		add_submenu_page( 'mt-top-level-handle', 'Test Sublevel 2', 'Test Sublevel 2', 'manage_options', 'sub-page2', 'mt_sublevel_page2' );
		add_theme_page( 'With Spaces', 'With Spaces', 'manage_options', 'With Spaces', 'mt_tools_page' );
		add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' );

		$expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings';
		$expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools';
		$expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle';
		$expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page';
		$expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2';
		$expected['not_registered'] = '';
		$expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=WithSpaces';
		$expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&#038;page=testpages';

		foreach ($expected as $name => $value) {
			$this->assertEquals( $value, menu_page_url( $name, false ) );
		}

		wp_set_current_user( $current_user );
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:29,代码来源:includesPlugin.php


示例17: the_quiz_button

 function the_quiz_button($button, $quiz_id)
 {
     global $post;
     $quiz_id = get_the_ID();
     $user_id = get_current_user_id();
     $flag = 1;
     if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $pid = get_post_meta($quiz_id, 'vibe_quiz_product', true);
         if (isset($pid) && is_numeric($pid) && get_post_type($pid) == 'product') {
             $product_taken = wc_customer_bought_product('', $user_id, $pid);
             if (!$product_taken) {
                 $pid = get_permalink($pid);
                 $check = vibe_get_option('direct_checkout');
                 $check = intval($check);
                 if (isset($check) && $check) {
                     $pid .= '?redirect';
                 }
                 $flag = 0;
                 $html = '<a href="' . $pid . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
             } else {
                 $flag = 1;
             }
         }
     }
     if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_user_logged_in()) {
         $membership_ids = vibe_sanitize(get_post_meta($quiz_id, 'vibe_quiz_membership', false));
         if (!pmpro_hasMembershipLevel($membership_ids, $user_id) && isset($membership_ids) && count($membership_ids) >= 1) {
             $membership_taken = get_user_meta($user_id, $quiz_id, true);
             if (!$membership_taken) {
                 $pmpro_levels_page_id = get_option('pmpro_levels_page_id');
                 $link = get_permalink($pmpro_levels_page_id);
                 $html = '<a href="' . $link . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
                 $flag = 0;
             } else {
                 $flag = 1;
             }
         }
     }
     if (in_array('wplms-mycred-addon/wplms-mycred-addon.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $points = get_post_meta($quiz_id, 'vibe_quiz_mycred_points', true);
         $mycred = mycred();
         $balance = $mycred->get_users_cred($user_id);
         if ($balance < $points) {
             $flag = 0;
             $html = '<a href="#"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '<span>' . __('<br/>Not enough points.', 'vibe') . '</span></a>';
         }
         if (!$mycred->has_entry('purchase_quiz', $quiz_id, $user_id)) {
             $flag = 1;
             $deduct = -1 * $points;
             $mycred->update_users_balance($user_id, $deduct);
             $mycred->add_to_log('purchase_quiz', $user_id, $deduct, __('Student subscibed to quiz', 'wplms-mycred'), $quiz_id);
         } else {
             $flag = 1;
         }
     }
     if (!$flag) {
         return $html;
     }
     return $button;
 }
开发者ID:VibeThemes,项目名称:wplms_sell_quiz,代码行数:60,代码来源:sell_quiz.php


示例18: _confirmSubmitButtonAction

 protected function _confirmSubmitButtonAction($sPressedInputName, $sSectionID, $sType = 'reset')
 {
     switch ($sType) {
         default:
         case 'reset':
             $_sFieldErrorMessage = $this->oFactory->oMsg->get('reset_options');
             $_sTransientKey = 'apf_rc_' . md5($sPressedInputName . get_current_user_id());
             break;
         case 'email':
             $_sFieldErrorMessage = $this->oFactory->oMsg->get('send_email');
             $_sTransientKey = 'apf_ec_' . md5($sPressedInputName . get_current_user_id());
             break;
     }
     $_aNameKeys = explode('|', $sPressedInputName) + array('', '', '');
     $_sFieldID = $this->getAOrB($sSectionID, $_aNameKeys[2], $_aNameKeys[1]);
     $_aErrors = array();
     if ($sSectionID && $_sFieldID) {
         $_aErrors[$sSectionID][$_sFieldID] = $_sFieldErrorMessage;
     } else {
         if ($_sFieldID) {
             $_aErrors[$_sFieldID] = $_sFieldErrorMessage;
         }
     }
     $this->oFactory->setFieldErrors($_aErrors);
     $this->setTransient($_sTransientKey, $sPressedInputName, 60 * 2);
     $this->oFactory->setSettingNotice($this->oFactory->oMsg->get('confirm_perform_task'), 'error confirmation');
     return $this->oFactory->oProp->aOptions;
 }
开发者ID:szepeviktor,项目名称:admin-page-framework,代码行数:28,代码来源:AdminPageFramework_Model__FormSubmission__Validator.php


示例19: user_info

 /**
  *
  * 	Process the infoz
  *	@since 1.0
  */
 function user_info()
 {
     if (isset($_POST['action'])) {
         // bail out if this user isnt logged in
         if (!is_user_logged_in()) {
             return;
         }
         if (!wp_verify_nonce($_POST['nonce'], 'process-user-info')) {
             return;
         }
         $user_id = get_current_user_id();
         if ($_POST['action'] == 'process_user_info') {
             $gender = isset($_POST['gender']) ? sanitize_text_field($_POST['gender']) : false;
             $age = isset($_POST['age']) ? sanitize_text_field($_POST['age']) : false;
             $education = isset($_POST['education']) ? sanitize_text_field($_POST['education']) : false;
             $employment = isset($_POST['employment']) ? sanitize_text_field($_POST['employment']) : false;
             $data = array('gender' => $gender, 'age' => $age, 'education' => $education, 'employment' => $employment);
             update_user_meta($user_id, 'user_info', $data);
             update_user_meta($user_id, 'user_info_completed', 1);
             do_action('user_info_updated', $user_id, $data);
             wp_send_json_success();
         } else {
             wp_send_json_error();
         }
     } else {
         wp_send_json_error();
     }
 }
开发者ID:bearded-avenger,项目名称:familyoutside,代码行数:33,代码来源:process.user-info.php


示例20: already_applied_message

 /**
  * Show message if already applied
  */
 public function already_applied_message()
 {
     global $post;
     if (is_user_logged_in() && user_has_applied_for_job(get_current_user_id(), $post->ID)) {
         get_job_manager_template('applied-notice.php', array(), 'wp-job-manager-applications', JOB_MANAGER_APPLICATIONS_PLUGIN_DIR . '/templates/');
     }
 }
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:10,代码来源:class-wp-job-manager-applications-post-types.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_currentuserinfo函数代码示例发布时间:2022-05-15
下一篇:
PHP get_current_user_access_groups函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap