Completely hide user info

This is dependant on your theme/plugins so it’s impossible to answer, as s_ha_dum mentioned. For example some themes output the author name in the body as a class like <body class=”author-keanu”> or maybe they just use the author id like <body class=”archive author-22″> and then you can check the author by going to www.example.com/?author=22 and … Read more

Reapproval for edits and deletion after post is published

Let us solve this by going with your second option. So you want to restrict users from editing published posts, this can be done by adding this to your theme’s functions.php file (please read the comments that is added): function restrict_editing_old_posts( $allcaps, $cap, $args ) { // Restrict users from editing post based on the … Read more

Show different badge based upon the user role

You can use get_queried_object to get data in the current author page: <?php $author = get_queried_object(); // uncomment next line to see all author data // print_r( $author ); if( in_array( ‘author’, $author->roles ) ) : echo “author”; elseif( in_array( ‘subscriber’, $author->roles ) ) : echo “subscriber”; endif;

Get how many days since last post of the current user

You can use a modified version of this answer by @s_ha_dum. Where instead of an option you can setup a user meta (even if meta query is slower than option query) add_action(‘save_post’, ‘user_last_update’, 10, 2); function user_last_update($id, $p) { if ( (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) || (defined(‘DOING_AJAX’) && DOING_AJAX) || ($p->post_status !== ‘publish’) ) { return; … Read more

Extra User Profile Field Upload File / Image

PHP CODE /* * Load style & scripts */ function itclanbd_admin_load_scripts( $hook ) { $allowed = [‘profile.php’, ‘user-new.php’, ‘user-edit.php’]; if ( ! in_array( $hook, $allowed ) ) { return; } wp_enqueue_media(); wp_enqueue_style(‘finance2sell’, plugins_url(‘css/style.css’, __FILE__), array(), null); wp_enqueue_script(‘finance2sell’, plugins_url(‘js/scripts.js’, __FILE__), array(), ‘1.3’, true); } add_action( ‘admin_enqueue_scripts’, ‘itclanbd_admin_load_scripts’ ); /** * Create custom fields * @param $user … Read more

How to check that if current user (ID) has posts or not

Notice that your redirection must happen before the HTTP headers are sent out. You can try the following, where we place our logic inside the template_redirect hook callback (PHP 5.4+): /** * Redirect logged-in users to the admin dashboard * if the have written ‘student_form’ posts * else display [wpuf_form id=”414″] */ add_action( ‘template_redirect’, function() … Read more

wp_insert_user is not working for me?

The problem is from wp_insert_user and the fact that your value for user_pass is empty. You should update your code as so $random_password = wp_generate_password(8,false); $user_data = array( ‘user_login’ => $first_name, ‘user_pass’ => $random_password, ‘user_email’ => $trainer_email, ‘first_name’ => $first_name, ‘last_name’ => $last_name, ‘role’ => ‘trainer’ ); And remove this line wp_set_password($random_password, $user_id); You should … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)