BuddyDev

Search

[Resolved] Buddyblog activity button

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #47662

    Kind reminder sir thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #47663

    Hi Tosin,
    May I request you to please stop reminding each 24 hours. That simply pushes your priority low.


    @ravisharma
    will look into it and assist you in next couple of days.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #47665

    Sure Brajesh I will do as instructed

    Apologies for the inconvenience

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #47666

    Thank you.
    I sincerely appreciate it.

    Regards
    Brajesh

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #47671

    Hello Tosin,

    Please try in the following way:

    
    if ( 'new_classified' == $activities_template->activity->type ) {
    		// Put your button code here.
    }
    
    

    Regards
    Ravi

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #47681

    Thanks Ravi

     add_action( 'bp_activity_entry_meta', function () {
    	global $activities_template;
    
    	if ( 'new_classified' == $activities_template->activity->type ) {
    		echo "<a href='https://www.site.com/manage-listings/' class='advert-edit-link'>Manage / Edit Ad</a>";
    	}
    } );
  • Participant
    Level: Guru
    Posts: 900
    Tosin on #47683

    Hi I just noticed the the link also appears in the activities of other members instead of only displaying in the activity of the current logged in user

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #47694

    Hi Tosin,
    you may add a condition at the top of the function like this

    
    
    if ( bp_get_activity_user_id() != get_current_user_id() ) {
    	return;
    }
    
    

    It will only shot the button to the creator of the activity.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #47826

    Thanks Brajesh

    This worked

     add_action( 'bp_activity_entry_meta', function () {
        global $activities_template;
    
        // Check if the current activity's user is the logged in user
        if ( bp_get_activity_user_id() === get_current_user_id() ) {
            // Check if the activity type is 'new_classified'
            if ( 'new_classified' === $activities_template->activity->type ) {
                echo '<a href="https://www.nigerpress.com/manage-listings/" class="advert-edit-link">Manage / Edit Ad</a>';
            }
        }
    } );
     
  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #47838

    Thank you.
    That’s good to know.

    Regards
    Brajesh

The topic ‘ [Resolved] Buddyblog activity button’ is closed to new replies.

This topic is: resolved