This topic has 20 replies, 2 voices, and was last updated 9 years by creamundo.

  • Author
  • #78869
     creamundo
    Participant

    Hi,

    Have three questions:
    1) I would like to add a gallery (with Rtmedia) with the latest pictures of a member in their profile, just under the profile cover photo.
    I’m using the code provided by rtmedia in their url: http://docs.rtcamp.com/rtmedia/developers/show-last-n-images-in-header.html

    add_action( ‘bp_after_member_header’, ‘show_last_n_images’, 99 );
    function show_last_n_images() {
    $n = 5;
    if( $user_id = bp_displayed_user_id() ) {
    $model = new RTMediaModel();
    $results = $model->get( array( ‘media_type’ => ‘photo’, ‘media_author’ => $user_id ), 0, $n );
    if( $results ) {?>

    <?php
    }
    }
    }

    The problem is that when i use this code it shows the gallery INTO the cover photo, nor outside…

    2) Anothe question is: how could I link to members media gallery?, the code ##profile_link## and the code ##member_name## dont work here.

    3) how could i change the media tab name? I can’t change the “multimedia” name in the tab even with the buddypress code for doing this. I can change other tab names but not media tab name.

    ¿could you please help me?

    #78878
     creamundo
    Participant

    Hi,

    Question 3 is solved, I made a translate mistake and its solved already.
    Here you have an screenshot of the other problems.

    Attachments:
    You must be logged in to view attached files.
    #78955
     sharmstr
    Moderator

    1 – Try changing the action call to this

    COPY CODE
    
    if ( bp_is_user() ) {
    add_action( 'kleo_before_main_content', 'show_last_n_images', 99 );
    }
    

    2 – Doesnt work where? If you are talking about in a menu, it would be ##profile_link##/media

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #78973
     creamundo
    Participant

    hi @sharmstr ,

    now i put the code like you said, like this:

    if (bp_is_user()){
    add_action( ‘kleo_before_main_content’, ‘show_last_n_images’, 99 );}
    function show_last_n_images() {
    $n = 5;
    if( $user_id = bp_displayed_user_id() ) {
    $model = new RTMediaModel();
    $results = $model->get( array( ‘media_type’ => ‘photo’, ‘media_author’ => $user_id ), 0, $n );
    if( $results ) {?>

    <?php
    }
    }
    }

    but it wont work, if I delete the conditional “if (bp_is_user()){… and start with the add_action it shows the pictures OVER the cover profile photo but I need it UNDER the cover profile photo (I tried to change kleo_before_main_content for kleo_under_main_content but it put the pictures near the footer….)

    The problem with the profile link is just near those pictures, I whant a link to “show more pictures” that links to the media tab: <div id=”see-more-pictures”>Show more pictures</div> but it wont work, I supose that it is because it not in the menu…

    Thanks for all, you are helping me a lot.
    Sorry for my bad english…

    #78984
     sharmstr
    Moderator

    Please repost your code. Put ‘

    COPY CODE
    ' before and '

    ‘ after. Alternatively, put it in a text file and attach.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #78986
     sharmstr
    Moderator

    My code didnt show up. Please see attached for example on how to post code

    COPY CODE
    
    your code here
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    Attachments:
    You must be logged in to view attached files.
    #79029
     sharmstr
    Moderator

    Try this instead

    COPY CODE
    
    add_action('bp_init', 'add_user_images', 2);
    function add_user_images () {
        if (bp_is_user()){
            add_action('kleo_before_main_content', 'show_last_n_images', 99);
        }
    
    }
    

    BP has built in functions to get the path to a profile. https://codex.buddypress.org/developer/template-tag-reference/ (bp_core_get_user_domain(bp_displayed_user_id()) . ‘media’)

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #79201
     creamundo
    Participant

    Hi,
    Now my code is like this:

    COPY CODE
    
    add_action('bp_init', 'add_user_images', 2);
    function add_user_images () {
        if (bp_is_user()){
            add_action('kleo_before_main_content', 'show_last_n_images', 99);
        }
    
    }
    function show_last_n_images() {
    $n = 5;
    if( $user_id = bp_displayed_user_id() ) {
    $model = new RTMediaModel();
    $results = $model->get( array( 'media_type' => 'photo', 'media_author' => $user_id ), 0, $n );
    if( $results ) {?>
    <ul>
    <?php foreach( $results as $image ) { ?>
    <li>
    <div class="rtmedia-item-thumbnail" id="foto-home-perfil">
    <a>id ); ?>" title="<?php echo $image->media_title; ?>">
    <img />id ); ?>" alt="<?php echo rtmedia_image_alt( $image->id );?>" />
    </a>
    </div>
    </li>
    <?php } ?>
    <div id="ver-mas-fotos"><a href="/media">Ver más fotos</a></div>
    </ul>
    <?php
    }
     }
    }
    

    But it still shows the gallery in the top of the cover photo, and i need it UNDER the cover photo. I attach an screenshot.

    Attachments:
    You must be logged in to view attached files.
    #79205
     sharmstr
    Moderator

    What version of kleo are you running?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #79208
     sharmstr
    Moderator

    I just tried the code and it puts it just above the buddypress profile tabs and below the cover photo. You need Kleo 3.0.9 for it to work.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    Attachments:
    You must be logged in to view attached files.
    #79236
     creamundo
    Participant

    Hi,
    Same version here…
    Do you want admin access to my test site to try the code?

    #79250
     sharmstr
    Moderator

    sure

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #79300
     creamundo
    Participant
    This reply has been set as private.
    #79315
     sharmstr
    Moderator

    I cant see the profile since the account you created for me isnt assigned to a membership level. I need admin credentials if you want me to help

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #79319
     creamundo
    Participant

    Hi, Sharmstr

    Sorry for the mistake, you have administrator credentials updated now.

    Thanks for your job.

    #79323
     sharmstr
    Moderator

    ahhhh. The difference was that I had my profile cover set to full width. There’s no way to inject it between the cover photo and the buddypress nav if you dont have “full width cover” turned on. You’ll have to edit the core buddypress profile file and remember to check for changes after every kleo/buddypress update.

    Copy /kleo/buddypress/members/single/home.php to your child theme. Put the following code starting on line 18

    COPY CODE
    
    <?php
          $n = 5;
          if( $user_id = bp_displayed_user_id() ) {
          $model = new RTMediaModel();
          $results = $model->get( array( 'media_type' => 'photo', 'media_author' => $user_id ), 0, $n );
          if( $results ) {?>
          <div class="rtmedia-item-thumbnail" id="foto-home-perfil">
              <ul>
                  <?php foreach( $results as $image ) { ?>
                      <li>
                          <a>id ); ?>" title="<?php echo $image->media_title; ?>">
                              <img />id ); ?>" alt="<?php echo rtmedia_image_alt( $image->id );?>" />
                          </a>
                      </li>
                  <?php } ?>
              </ul>
          </div>
          <div id="ver-mas-fotos" class="generic-button" ><a>">Ver más fotos</a></div>
          <?php
          }
          }
           ?>
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #79335
     creamundo
    Participant

    Hi,

    I did what you say, and it takes the correct place. The only things is that the code you pasted is not ok.
    I think there is an error in the < a > declaration and I only can see an error. I attach an screenshot.

    Attachments:
    You must be logged in to view attached files.
    #79340
     sharmstr
    Moderator

    This forum always screws up those tags. Just use the code you had before but make sure you put this before

    COPY CODE
    
    <?php
    

    and this after

    COPY CODE
    
    ?>
    

    Also, make sure you put the file in /kleo-child/buddypress/members/single/home.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #79363
     creamundo
    Participant

    yeah!!!! this is perfect!!! it’s running perfect!!!!
    only one more question (hope not abuse)… how could I link each picture with the lightbox? i prefer this than the link to the gallery image…

    #79371
     sharmstr
    Moderator

    You should ask rtCamp since you got the code from them.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #79473
     creamundo
    Participant

    you are right!
    I thought this was a Kleo funtion.

    Thanks for your good job.

Viewing 21 posts - 1 through 21 (of 21 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?