Sign up
Login
New paste
Home
Archive
English
English
Sign up
Login
New Paste
Browse
// ROJO'S CUSTOM CODES // Add custom user profile fields add_action( 'show_user_profile', 'extra_user_profile_fields' ); add_action( 'edit_user_profile', 'extra_user_profile_fields' ); function extra_user_profile_fields( $user ) { if ( current_user_can( 'administrator' ) ) { ?> <br><br> <h3><?php _e("Client Report - Dashboard", "blank"); ?></h3> <span class="description"><?php _e("Luke, put the <b><u>specific HTML code</u></b> for this <b><u>specific client</u></B> below: <br>"); ?></span> <br> <textarea rows="10" name="client-report" id="client-report" class="regular-text"><?php echo esc_textarea( get_the_author_meta( 'client-report', $user->ID ) ); ?></textarea> <br> <span class="description"><?php _e("Custom code for <u><b>Stay Social</b></u> by Rojo"); ?></span> <br><br> <?php } } // Save custom user profile fields add_action( 'personal_options_update', 'save_extra_user_profile_fields' ); add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' ); function save_extra_user_profile_fields( $user_id ) { if ( !current_user_can( 'edit_user', $user_id ) ) { return false; } if ( isset( $_POST['client-report'] ) ) { update_user_meta( $user_id, 'client-report', $_POST['client-report'] ); } } // Add the custom field to the REST API response add_action( 'rest_api_init', function() { register_rest_field( 'user', 'client-report', array( 'get_callback' => function( $user, $field_name, $request ) { return get_user_meta( $user['id'], $field_name, true ); }, 'update_callback' => null, 'schema' => array( 'description' => __( 'Client Report HTML' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), )); }); // SHORTCODE = [client_report] function display_client_report_html( $atts ) { $user_id = get_current_user_id(); // Or get the ID of the user whose field you want to display $client_report_html = get_user_meta( $user_id, 'client-report', true ); return $client_report_html; } add_shortcode( 'client_report', 'display_client_report_html' ); // Redirect to /Dashboard page after signing in function redirect_login_page() { $login_page = home_url( '/login/' ); $page_viewed = basename($_SERVER['REQUEST_URI']); if( $page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') { wp_redirect($login_page); exit; } } add_action('init','redirect_login_page'); function login_redirect( $redirect_to, $request, $user ){ //is there a user to check? if (isset($user->roles) && is_array($user->roles)) { //check for admins if (in_array('administrator', $user->roles)) { //Redirect them to the default place return admin_url(); } else { return home_url( '/dashboard/'); } } else { return $redirect_to; } } add_filter('login_redirect', 'login_redirect', 10, 3); // Redirect /signin to /login function custom_redirect_signin_to_login() { if ( strpos( $_SERVER['REQUEST_URI'], 'signin' ) !== false ) { wp_redirect( home_url( '/login' ) ); exit; } } add_action( 'init', 'custom_redirect_signin_to_login' ); // Redirect /signup to /register function custom_redirect_signup_to_register() { if ( strpos( $_SERVER['REQUEST_URI'], 'signup' ) !== false ) { wp_redirect( home_url( '/register' ) ); exit; } } add_action( 'init', 'custom_redirect_signup_to_register' ); // Redirect users to the base URL after logging out function custom_logout_redirect() { wp_redirect( home_url() ); exit(); } add_action( 'wp_logout', 'custom_logout_redirect' );
Paste Settings
Paste Title :
Paste Folder :
[Optional]
Select
Syntax Highlighting :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
HTML
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
Paste Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Encrypt Paste
(
?
)
Create New Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English