wp_ajax_save_wporg_username() – Ajax handler for saving the user’s WordPress.org username.

You appear to be a bot. Output may be restricted

Description

Ajax handler for saving the user's WordPress.org username.

Usage

wp_ajax_save_wporg_username();

Parameters

Returns

void

Source

File name: wordpress/wp-admin/includes/ajax-actions.php
Lines:

1 to 15 of 15
function wp_ajax_save_wporg_username() {
  if ( ! current_user_can( 'install_themes' ) && ! current_user_can( 'install_plugins' ) ) {
    wp_send_json_error();
  }

  check_ajax_referer( 'save_wporg_username_' . get_current_user_id() );

  $username = isset( $_REQUEST['username'] ) ? wp_unslash( $_REQUEST['username'] ) : false;

  if ( ! $username ) {
    wp_send_json_error();
  }

  wp_send_json_success( update_user_meta( get_current_user_id(), 'wporg_favorites', $username ) );
}
 

 View on GitHub View on Trac