BuddyDev

Search

[Resolved] redirect the "view" tag in mediapress

  • Participant
    Level: Enlightened
    Posts: 29
    Corrado Mazzola on #34126

    Hi Brajesh

    Is it possible to change the link of the “view” choice in gallery, and make it to point directly the “edit” page ?

    How can I do that?

    Thank you so much

    Corrado

  • Keymaster
    (BuddyDev Team)
    Posts: 24433
    Brajesh Singh on #34128

    Hi Corrado,
    Thank you for the question.

    I am assuming it is for the gallery list page? You can do it by editing the gallery-loop.php template in your theme.

    If it is for any other screen, Please link me to a screenshot and outline it.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 29
    Corrado Mazzola on #34139

    Hi Brajesh
    Yes it is for the gallery list page but I’m not able to see where to change in my “loop-gallery” on the other end in the “mpp-gallery-template-tag.php” I’have this :

    $links [‘view’] = sprintf( ‘%3$s‘, mpp_get_gallery_permalink( $gallery ), esc_attr( $gallery->title ), __( ‘View’, ‘mediapress’ ) );

    it is here I’have to change something?

    Thank you so much!
    Corrado

  • Keymaster
    (BuddyDev Team)
    Posts: 24433
    Brajesh Singh on #34142

    Hi Corrado,

    Please put this in your bp-custom.php

    
    add_filter( 'mpp_gallery_actions_links', function ( $links, $links_array, $gallery ) {
    
    	if ( mpp_user_can_edit_gallery( $gallery->id, get_current_user_id() ) ) {
    		$links_array['view'] = sprintf( '<a href="%1$s" title="' . __( 'Edit', 'mediapress' ) . '">%2$s</a>', mpp_get_gallery_edit_media_url( $gallery ), __( 'edit', 'mediapress' ) );
    	}
    
    	return join( ' ', $links_array );
    }, 10, 3 );
    
    

    That will change it.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 29
    Corrado Mazzola on #34155

    Hi Brajesh

    Thank you so much for your code. I’ve tested it and it does the job of moving the “view” to “edit link as far I m in “Gallery” and as far as I copy the bp-custom.php to the plugin directory while beeing logged in. Unfortunately, once I go outn, the systems stops in such way that we cannot even access the login. It looks to me that the buddypress functions are jeopardized by the code you sent me.

    Please help me…

    Thanks
    Corrado

  • Keymaster
    (BuddyDev Team)
    Posts: 24433
    Brajesh Singh on #34166

    Hi Corrado,
    Thank you for the reply.

    I am sorry but I do not see any issue with the above code. It does not seem to have any effect on logged in/out for me.

    Can you please recheck(Please make sure you copy the code from the forum and not from the email notification).

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 29
    Corrado Mazzola on #34182

    Thank you Brajesh,

    I also cannot find any errors in your code, but it still does not work. If it can be useful information, I’ m using Buddypress with BP-NOUVEAU template together with WP-OCEAN theme.
    The code works fine so far I’m inside the gallery list page. But when I try to go somewhere else the system stops.

    It is very frustrating….

    Best regards
    Corrado

  • Participant
    Level: Enlightened
    Posts: 29
    Corrado Mazzola on #34250

    Hi Brajesh

    I solved it by putting your code directly in the php

    Thanks a lot

    Corrado

  • Keymaster
    (BuddyDev Team)
    Posts: 24433
    Brajesh Singh on #34277

    Hi Corrado,
    Thank you for the reply.

    I am glad you have been able to use it and got it working.

    Regards
    Brajesh

The topic ‘ [Resolved] redirect the "view" tag in mediapress’ is closed to new replies.

This topic is: resolved