BuddyDev

Search

[Resolved] Mediapress / link when clik o n notification

  • Participant
    Level: Initiated
    Posts: 16
    carasse on #44086

    Hello

    When a user recevives a notification after he was tagged on a post with a picture from an other user, if he clicks on the notification, he is linked to the gallery. I would prefer he is linked automatically to the post on the activity sitewide, not on the gallery.

    Is it possible ?

    Thanks a lot for your help !

    Fabien

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #44093

    Hello Fabien,

    Welcome to the BuddyDev Forums. Please let me what you are referring to with the term tag. Is it BuddyPress mentioning feature i.e. ‘@username’ or something else?. With BuddyPress, I have checked it with the mention and it is working correctly i.e. redirecting to activity instead of gallery.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 16
    carasse on #44106

    Hello Ravi

    I refer to the notifications tab of the user profile page :
    1 – a user is tagged with @username on a picture so he receives a notification
    2 – the user clicks on the notifiction
    3 – he is linked to the gallery and not to the activity

    Do you undestand what i am referring to ?

    Thanks for your help.

    BR

    Fabien

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #44112

    Hello Fabien,

    Thank you for the acknowledgement. I will recheck it and get back to you soon.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 16
    carasse on #44114

    Thanks Ravi.
    BR
    Fabien

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #44119

    Hello Fabien,

    I have checked this again with MediaPress and BuddyPress and it is working fine for me. Please check the following screenshot with Mention and Media.

    https://www.awesomescreenshot.com/image/24694414?key=f65516f0a9c6b350a02e6d42a2b7c93e

    Please guide me to the steps so that I can recreate the issue on my local server.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 16
    carasse on #44128

    Hello ravi

    We did not speak about the same issue. Screenshots are better than words 🙂

    Here is the link in the notification tab that i was speaking about : https://www.awesomescreenshot.com/image/24721101?key=6418bf0fd3249268a53913dd529543e4

    Here is the tab gallery where i am linked after i clicked on the notification : https://www.awesomescreenshot.com/image/24721102?key=5df409c0fba0d73db184355e24e1d468

    I would prefer to be linked on the activity widesite to the post concerned by the notification.

    I hope we may undersatnd each other now 🙂

    Thanks a lot for your nice support.

    Fabien

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #44139

    Hello Fabien,

    Thank you for sharing the screenshots. Please try the following code:

    
    add_filter( 'bp_activity_get_permalink', function( $link, $activity ) {
    
    	if ( ! bp_is_user_notifications() ) {
    		return $link;
    	}
    
    	$parent_activity = '';
    
    	// Get parent activity id.
    	if ( 'activity_comment' === $activity->type ) {
    		$parent_activity = new BP_Activity_Activity( $activity->item_id );
    	}
    
    	if ( $parent_activity && 'mpp_media_upload' == $parent_activity->type ) {
    		$link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $parent_activity->id;
    	}
    
    	return $link;
    }, 15, 2 );
    
    

    Please let me know if it helps or not.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 16
    carasse on #44140

    Hello ravi

    I have to paste it in the bp-custom ?

    If yes, can you tell me where i have to paste it. I’m better in screenshoots than in writing php code 🙂

    Thanks a lot.

    Fabien

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #44141

    Hello Fabien,

    You can place this code anywhere in the “bp-custom.php” file. Please check.

    Regards
    Ravi

The topic ‘ [Resolved] Mediapress / link when clik o n notification’ is closed to new replies.

This topic is: resolved