• Resolved kkriss

    (@kkriss)


    Hello.
    I’m trying to use your plugin for my needs but something is not working for me. What I’m trying to reach is quite normal but probably I am making some big settings mistakes:
    1) New registered users can submit custom posts (recipes) through a frontend form (done):
    2) Clicking on each user in the UM members page, I want to reach the single user profile (done);
    3) In the user profile, tab Posts, I would display the post list of recipes added by the single author.
    4) All the users (registered or not) could see a single author profile.
    5) The posts list should include both WP posts and CPT.
    6) The list should be created through an Elementor Pro archive template.
    Actually I only can see WP posts list that only one author posted , the other authors post only CPT.
    How to get points 3-4-5-6?
    Thanks

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kkriss

    4. The profile should be set to public by default.

    3 & 5 . You can use this filter hook to modify the query of the posts in Post Tab to include another CPT. It already returns the Profile Owner’s post.
    um_profile_query_make_posts

    e.g.

    add_filter("um_profile_query_make_posts","um_custom_profile_query_make_posts");
    function um_custom_profile_query_make_posts( $args ){
       
       $args['post_type'] = array(
            'post',
            'recipe'
       );
       return $args;
    
    }

    6. We are not sure how this will be implemented. Hopefully, someone in the forum has done something similar and share their solution.

    Regards,

    Thread Starter kkriss

    (@kkriss)

    Hi, thanks for your prompt answer.
    4. done

    3 & 5. Yep! Works like a charm! Thanx. As UM already recognizes other CPTs inside the same site for restricting content, could be very useful if it was a feature for querying WP posts and/or other CPTs, same method as for restricting (checkboxes). What about? ??

    6. Searched everywhere but no luck. Could you suggest where could I find something? This is very important for me. My authors will have so many “recipes” to show, so I have to show a nice layout for a good UX. Should be very happy if you could add a premium add-on for applying Elementor Pro templates to UM authors’ pages, and many other users should be, as Elementor is very popular.
    Thank you

    Plugin Support Towhid

    (@cryptex_vinci)

    Hi @kkriss

    You follow doc to customize UM Profile post templates:
    https://docs.ultimatemember.com/article/1516-templates-map

    Thanks

    Thread Starter kkriss

    (@kkriss)

    @cryptex_vinci
    Thank you but I’m not able to modify php templates.
    @champsupertramp
    I changed some css and that’s what I reached Not too bad not so good. I’m asking only what CSS rules more I have to add to reach the layout you can see in the screenshot at the bottom of the same page. I mean 3 posts per row, the featured image should be 4:3 ratio (all my images will have that ratio) and the title should fit the box width and go to the next row if longer. Could you help me for this?
    Thank you so much.

    @kkriss
    I also encountered this problem. I wanted to use Elementor to make a beautiful enough post archive page for users. But in the process of trying, it became two problems:

    1. When a logged-in user accesses his profile, his profile and posted posts will be displayed.
    2. When the logged-in user accesses other users, the profiles and posts of other users are displayed.

    Then, I successfully implemented the first problem, But my implementation method may not apply to you. Because you have to show the CPT list. Just for your reference.image1image2
    I used the UM shortcode and Elementor Pro’s post list widget on this page, and created the following Elementor custom query in functions.php:

    add_action( ‘elementor/query/my_custom_filter_1’, function( $query ) {
    global $current_user;
    $query->set( ‘post_type’, [ ‘work’] );
    $query->set( ‘author’, $current_user->id );
    } );

    But this method is not a good idea. And I can’t solve the second problem.

    Because using the above method, only the posts of the currently logged-in user can be retrieved. When visiting other people, the posts of the author you want to query cannot be displayed.

    I tried another method, instead of redirecting the author to archive to the user profile, but using Elementor’s archive template to create it, at this time, although the posts of the user I want to query can be listed correctly, the profile displayed by the UM shortcode It is always the currently logged in user.

    I think the best way is to customize a template.
    If you have a better plan, please let me know, thank you very much

    • This reply was modified 4 years, 3 months ago by sqkkyzx.
    • This reply was modified 4 years, 3 months ago by sqkkyzx.
    • This reply was modified 4 years, 3 months ago by sqkkyzx.
    • This reply was modified 4 years, 3 months ago by sqkkyzx.

    @champsupertramp

    Hello!

    I have very little knowledge of code. So I must turn to you for help.
    I want to know this query:

    add_action( ‘elementor/query/my_custom_filter_1’, function( $query ) {
    global $current_user;
    $query->set( ‘post_type’, [ ‘work’] );
    $query->set( ‘author’, $current_user->id );
    } );

    Is it possible to directly call the result of the UM queryer? For example, nesting is another method that allows me to use the UM query tool to query user posts, which may allow me to fix the unresolved problem raised by my last reply.

    • This reply was modified 4 years, 3 months ago by sqkkyzx.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sqkkyzx

    Have you tried using this method to retrieve the current profile’s ID?

    um_profile_id()

    add_action( ‘elementor/query/my_custom_filter_1’, function( $query ) {
       global $current_user;
       $query->set( ‘post_type’, [ ‘work’] );
       $query->set( ‘author’, um_profile_id() );
    } );

    Regards,

    Thread Starter kkriss

    (@kkriss)

    @sqkkyzx
    Unfortunately I can’t code, so I can’t help you.
    Actually I can reach an user profile page with his posts (WP+CPT) starting from the members page, where all users names and images and page links are present, using Ultimate Member plugin for all, but the layout is messy, I changed many things, it is becoming quite good but now I’m stuck and can’t reach a nice grid, and I asked for help because I think it’s not so difficult to adjust but I don’t have the skills to do it.

    It could be enough for me temporarily, as without it I can’t publish my site, but it will be the best thing for me and for all the other Elementor users if the author will create a premium add-on that allows to use an Elementor template to display a single author posts lists including multiple CPTs (both WP and other CPTs).

    @champsupertramp
    1) could you please help me with some CSS rules to realize my user single page like I sent before?

    2) could you plan this feature or premium add-on to integrate UM with Elementor using an Elementor template?
    Thank you

    • This reply was modified 4 years, 3 months ago by kkriss.
    • This reply was modified 4 years, 3 months ago by kkriss.
    • This reply was modified 4 years, 3 months ago by kkriss.

    @champsupertramp
    Thank you so much!
    It achieved the effect I needed very well. Successfully inquired about the posts of the current users, and had a beautiful grid layout.

    @kkriss
    If you can use the query function to query Post and CPT, in theory, you can also use Elementor custom query. If you can, then I think my method is also suitable for you.

    About the use of Elementor custom queryer, you can find it in Elementor’s documentation. For example, The code that Champ Camba helped me change,”my_custom_filter_1″ is a unique name that can be set freely. It can be used to locate this query in the post list widget of the elementor Pro editor.”work” is my custom post type.um_profile_id() to help me locate the current author.

    You can have a try.

    @kkriss

    Frankly speaking, due to the differences in regional languages, I use the translated UM, so I don’t quite understand what CPT is.
    I checked your page, and I think my method should be feasible to improve your current page layout, that is, a user avatar display and a list of posts.
    Use a shortcode widget on a page, load the shortcode of the UM profile, and use a Post list widget to list the content with Elementor custom queries.

    • This reply was modified 4 years, 3 months ago by sqkkyzx.
    Thread Starter kkriss

    (@kkriss)

    @sqkkyzx
    Not sure if I understand what you mean. Actually I can query both WP and my CPT (recipes) after having added the code that @champsupertramp suggested me, but I hope that both this multiple choice and the Elementor template choice should b possible as soon as possible directly from the UM plugin settings.

    Thread Starter kkriss

    (@kkriss)

    @sqkkyzx
    “Use a shortcode widget on a page, load the shortcode of the UM profile, and use a Post list widget to list the content with Elementor custom queries.”
    That’s the first thing I did when I start, but Elementor doesn’t allow 2 or more kinds of CPTs (= custom post type), and I need to query WP posts and my CPT Recipes. If it’s possible and I’m wrong, could you show me the right settings?
    Thanks

    • This reply was modified 4 years, 3 months ago by kkriss.

    @kkriss

    If you want to query multiple post types,
    You should probably use

    add_action( ‘elementor/query/my_custom_filter_1’, function( $query ) {
    global $current_user;
    $query->set( ‘post_type’, [ ‘post’, ‘recipe’] );
    $query->set( ‘author’, um_profile_id() );
    } );

    • This reply was modified 4 years, 3 months ago by sqkkyzx.
    • This reply was modified 4 years, 3 months ago by sqkkyzx.

    @kkriss

    I will try to make the UM profile menu available by modifying the UM template file, so that the posts can be sorted by different tags on the menu. If it succeeds, I will tell you.

    @kkriss

    I may not have explained it just now.I mean like this

    You need to customize an Elementor query function. It’s the code I just posted and put it in the theme’s function.php

    Then remember the name “my_custom_filter_1”, there is a custom filter in the query settings of the Post list widget, and fill in the name. This is where you need to fill in the name Sorry that my editor does not display English, but I think I can guess where to fill in the name based on the position on the picture.

    This way you get a list of posts that lists both types of post and recipe at the same time

    • This reply was modified 4 years, 3 months ago by sqkkyzx.
Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Single profile layout’ is closed to new replies.