Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 31 through 45 (of 174 total)
  • Author
    Posts
  • in reply to: How to show relationships in same order as set in backend? #46111
    EddyPiVEddyPiV
    Participant

    Peter, this is the code for the page.

    {% set args1 = { post_type: 'repetitie-avond', posts_per_page: -1, orderby: 'date', order: 'asc' } %}
    {% set posts = mb.get_posts( args1 ) %}
    
    {% for post in posts %}
        <h2><strong>{{ post.title }}</strong></h2>
        <p>{{ post.content }}</p>
        {% set args2 = {post_type: 'muziek', nopaging: true, orderby:'none', relationship: {id: 'muziek-op-repetitie-avond', from: post.ID}} %}
        {% set muzieknummers = mb.get_posts( args2 ) %}
    
        {% set counter = 0 %}
        {% for muziek in muzieknummers %}
            {% set counter = counter +1 %}
            {% set post2 = mb.get_post( muziek.ID ) %}
            <p><a href="{{ post2.url }}">{{ post2.post_title }}</a></p>
        {% endfor %}
    
        {% if  counter == 0 %}
            Er is nog geen muziek voor deze avond vastgelegd. - no music yet - 
        {% endif %}
    <hr />
    {% endfor %}

    Here is a short video of all settings involved: https://drive.google.com/file/d/1Ok9HploeRIkomw7uukIa7cuikxAFH1gN/view?usp=drive_link

    Regards,
    Eddy

    in reply to: Viewing relationships - how to get it showing?? #46093
    EddyPiVEddyPiV
    Participant

    Thanks Peter, you pointed me in the right direction. It's working now.

    in reply to: Viewing relationships - how to get it showing?? #46086
    EddyPiVEddyPiV
    Participant

    Thanks Peter.

    I noticed that in the first attempt I had set the post type to courses, instead of course. That was it.

    I expanded the code to show thumbnail and post title. That worked nicely.
    Then I added the condition to show only for coursecategory = training, that's where I step into a critical error.

    {% set args = {post_type: 'course', nopaging: true, relationship: {id: 'student-results', from: user.ID}} %}
    {% set courses = mb.get_posts( args ) %}
    
    <div class="completed_courses">
    {% for course in courses %}
        {% set coursecategory = mb.get_the_term_list( result.ID, 'coursecategory', '', ', ' ) %}
        {% if  coursecategory  is  'training' %}
       	<div class="course">
            {% set post = mb.get_post( result.ID ) %}
            {{ mb.get_the_post_thumbnail( result.ID, 'thumbnail' ) }}
            <p style="text-align: center;"><strong>{{ post.post_title }}</strong></p>
    	</div>
        {% endif %}
    {% endfor %}
    </div>

    Hopefully you can help me here?
    Thanks!

    EddyPiVEddyPiV
    Participant

    Thanks Peter for sharing this link re the first point.

    Re point 2: No, there are no <p> and </p>'s. I know that this will result in proper showing, but the users are 'simple minds' and I don't want to bother with adding this to their text. So they just enter the text in the (classic) Visual editor.
    But now it shows as a concatenation of words, all on 1-2 lines.

    For this case I'll fall back to the display-posts plugin that handles it out of the box and also respects <!--more-->.

    Thanks for your help.

    EddyPiVEddyPiV
    Participant

    I had set up the custom fields in a way that they were only visible in admin area to the Admin role, and let users edit in the frontend. But perhaps that's a conflicting idea?

    I did many tests, and probably confused myself when I said the user could edit in admin area and not in frontend.
    Anyway, I have now removed the setting that fields are only visible for the Admin role.
    Now visible to the user and user can edit in the frontend.

    So consider it solved.

    Thanks Peter

    in reply to: Twig condition on cloned group field #45987
    EddyPiVEddyPiV
    Participant

    Thanks Peter. Fully makes sense, I just didn't think of it myself.

    in reply to: List of all users with custom field = '123' #45813
    EddyPiVEddyPiV
    Participant

    I found it already, and expanded the code to my liking.

    EddyPiVEddyPiV
    Participant

    Peter, the audio was file type URL.
    I tried various scenarios, and with File Input it works properly. That file type fits perfectly, as all music is already in the media library.

    So thanks for your help.

    in reply to: 504 Gateway Time out on every update action on a cpt #44010
    EddyPiVEddyPiV
    Participant

    Peter, it happens only with 1 specific cpt, all other post types are working properly.
    But you're actually right, it's caused by another plugin. Deactivating it solved it.
    I'll contact them to act on the errors in the debug.log.

    Thanks.

    in reply to: How to get a post by it's slug #43994
    EddyPiVEddyPiV
    Participant

    Thanks Peter, all fine now.

    in reply to: How to get a post by it's slug #43980
    EddyPiVEddyPiV
    Participant

    Hi Peter, thanks, that almost works.
    It just, if post.fan_profile is empty, then the value of the most recent occurrence is returned.
    How to avoid that?

    in reply to: How to get a post by it's slug #43967
    EddyPiVEddyPiV
    Participant

    Just to add, to demonstrate that {{ spending_post.amount }} is correct: I tested by taking out name: '{{ post.fan_profile }}', and the amount was shown for each fan.

    in reply to: The relationship in View thru Shortcode doesn't get shown #43952
    EddyPiVEddyPiV
    Participant

    Hi Peter,

    With your help I managed to get it working.

    Thanks a lot, regards.

    in reply to: How to show the number of published posts of a post type? #43765
    EddyPiVEddyPiV
    Participant

    Thanks a ton, Peter.
    Works nicely!

    in reply to: Where did all the MB field options go? #43734
    EddyPiVEddyPiV
    Participant
Viewing 15 posts - 31 through 45 (of 174 total)