Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter jan4971

    (@jan4971)

    function my_media_uploader_filter() {
      return false;
    }
    add_filter('wpua_is_author_or_above', 'my_media_uploader_filter');

    Working for me ??

    EDIT: I added:

    if ( $post->post_name == 'put your postname here' ) {
    			return false;
    	}

    to restrict this to a specific page.

    For me it looks like this in the end:

    function my_media_uploader_filter() {
    
    	if ( $post->post_name == 'put your postname here' ) {
    			return false;
    	}
    }
    add_filter('wpua_is_author_or_above', 'my_media_uploader_filter');
    Thread Starter jan4971

    (@jan4971)

    What other plugins do you have active?

    I already tried it with all other plugins disabled.

    The Media Uploader shows for Authors, Editors, and Administrators because they all have upload_files capability

    Yup. Removing it gets the simple uploader, but i cant upload files in posts or pages. But it works for uploading avatars.

    If you’re getting an http error with the Media Uploader after trying to upload a file, I can’t say for sure what it would be

    Me neither, in the backend it works for all uesrs btw. In the frontend it does not work.

    So my question is, if there is a way to force the simple http uploader for the shortcode for everyone.

    Thread Starter jan4971

    (@jan4971)

    I kinda solved it:

    I just added some custom fields to the registration form and used this nice little thing thing to set the display name as “last_name first_name”.

    So i keep sorting by display name which is now “last_name first_name”.

    I know, it’s not perfect, but it’s doing the job.

    Thread Starter jan4971

    (@jan4971)

    Thank you very much for your help @bcworkz.

    I mark it as resolved.

    I will report if i found an solution for the last_name sorting problem.

    Thread Starter jan4971

    (@jan4971)

    In other words, try this line:
    $content .= “<p class=’author-description’>{$user->user_email}</p>”;

    That’s the full working code for everyone who’s interested in making something similar.

    function my_authors_list_shortcode( $atts = array() ) {
        global $wpdb;
    $users = $wpdb->get_results( "SELECT * FROM {$wpdb->users}" );
    $user_info = get_userdata($user->ID);
    
        $content = "<ul class='authors-list'>";
        foreach( $users as $user ) {
            $content .= "<li>";
            $content .= get_avatar( $user->ID, 70 );
            $content .= "<h3>" . get_user_meta( $user->ID, 'last_name', true ) . "";
            $content .= " " . get_user_meta( $user->ID, 'first_name', true ) . "</h3>";
    		$content .= "<p class='author-description'>{$user->user_email}</p>";
            $content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'phone', true ) . "</p>";
            $content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'mobil', true ) . "</p>";
    		$content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'street', true ) . "</p>";
    		$content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'livingplace', true ) . "</p>";
    		$content .= "</li>";
        }
        $content .= "</ul>";
        return $content;
    }

    That’s fantastic! Thanks for helping me out !

    Is there a way to sort the output ascending with the last name to make a List from A-Z ?

    EDIT: I almost figured it out by myself:

    $users = $wpdb->get_results( "SELECT * FROM {$wpdb->users} ORDER BY display_name" );

    I still cant sort by last_name…
    Could you please give me a last push ? ??

    Thread Starter jan4971

    (@jan4971)

    Your code is currently only getting user ID and display_name from the DB

    Now I came up with this:

    add_shortcode('authors-list', 'my_authors_list_shortcode');
    function my_authors_list_shortcode( $atts = array() ) {
        global $wpdb;
    $users = $wpdb->get_results( "SELECT * FROM {$wpdb->users}" );
    
        $content = "<ul class='authors-list'>";
        foreach( $users as $user ) {
            $content .= "<li>";
            $content .= get_avatar( $user->ID, 70 );
            $content .= "<h3>" . $user->display_name . "</h3>";
            $content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'user_mail', true ) . "</p>";
            $content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'phone', true ) . "</p>";
            $content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'mobil', true ) . "</p>";
    		$content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'street', true ) . "</p>";
    		$content .= "<p class='author-description'>" . get_user_meta( $user->ID, 'livingplace', true ) . "</p>";
    		$content .= "</li>";
        }
        $content .= "</ul>";
        return $content;
    }

    Everything is getting put out, except for mail.

    Thread Starter jan4971

    (@jan4971)

    thanks for helping me. ??
    I tried to output mail adresses like this:

    $content .= "<p class='author-description'>" . $current_user->user_email . "</p>";

    But it didnt work.
    I just want some details and not everthing.

    EDIT:

    $users = $wpdb->get_results( "SELECT ID, display_name FROM {$wpdb->users}" );

    I will try to change this line to:

    $users = $wpdb->get_results( "SELECT * FROM {$wpdb->users}" );

    Will report if it works.

Viewing 7 replies - 1 through 7 (of 7 total)