Code correction – Hide a profile from visitors with a specific role
Code correction – Hide a profile from visitors with a specific role
Code correction – Hide a profile from visitors with a specific role
Is there a reason why you don’t just want to make the “author archive” a page and list them all on the page with a shortcode ? If that’s an option, simply put your single author template in author.php Author templates – Template hierarchy If not, you could take your current template (that you’ve put … Read more
You should look at the add_user_meta function to capture the info from the user. Then you can lookup the value using get_user_meta. Use this link for more info: https://developer.wordpress.org/reference/functions/add_user_meta/
How can i add user display name drop down menu in frontend?
You should use append paginate_comments_links() into $output like so: add_shortcode ( ‘show_recent_comments’, ‘show_recent_comments_handler’ ); function show_recent_comments_handler( $atts, $content = null ) { extract( shortcode_atts( array( “count” => 20, “pretty_permalink” => 0 ), $atts )); $output=””; // this holds the output if ( is_user_logged_in() ) { global $current_user; get_currentuserinfo(); $args = array( ‘user_id’ => $current_user->ID, ‘number’ … Read more
Nested if/else/elseifs are usually too complex for me to figure out. I’d change your code to use SWITCH/CASE to determine proper input and to change the password if all is OK. And to sanitize $_POST (and $_GET) inputs, I just put this in my functions file: $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); Then … Read more
I managed to come up with the answer 😀 Thanks to @Jos function ht1_change_avatar($args, $id_or_email) { $gender = get_user_meta($id_or_email, ‘user_gender’, true); if($gender==’Male’){ $myavatar=”http://localhost:81/matrimony/wp-content/uploads/2020/04/groom.png”; }else{ $myavatar=”http://localhost:81/matrimony/wp-content/uploads/2020/04/bride.png”; } $args[‘url’] = $myavatar; return $args; } add_filter(‘get_avatar_data’, ‘ht1_change_avatar’, 100, 2);
Try this to get you started. This creates a shortcode [alldevelopers] that displays a list of all developers. Pretty basic but can be heavily extended and duplicted. (Not tested) add_shortcode( ‘alldevelopers’, ‘show_all_developers’ ); function show_all_developers(){ $users = get_users( [ ‘role__in’ => [ ‘developers’ ] ] ); foreach ( $users as $user ) { echo $user->first_name … Read more
You said that KingComposer will accept PHP blocks. This will generate a link to the current logged-in user’s author page: <?php $author_page = is_user_logged_in() ? get_author_posts_url( get_current_user_id() ) : NULL; $acc_pay_page = $author_page ? add_query_arg( ‘screen’, ‘acc_pay’, $author_page ) : NULL; if ( $acc_pay_page) { echo ‘<a href=”‘ . esc_url( $acc_pay_page ) .'”><img src=”account_page_page.png” /></a>’; … Read more
How to display extra fields for user