BuddyDev

Search

[Resolved] Insert callback location

  • Participant
    Level: Yogi
    Posts: 1112
    calu on #29773

    Hi there, I want to insert this callback, but I’m uncertain which file I should use

    remove `// remove the action
    remove_action( ‘bp_messages_bulk_management_dropdown’, ‘action_bp_messages_bulk_management_dropdown’, 10, 0 ); `

    In http://hookr.io/, the action is defined in the following location.

    /bp-messages/bp-messages-template.php
    do_action( ‘bp_messages_bulk_management_dropdown’ );

    Can I create this thread > bp-messages/bp-messages-template.php, in my child theme, or can I insert it in

    bp-templates>bp-legacy>buddypress>members>single>messages>messages-loop.php

    or

    bp-templates>bp-legacy>buddypress>members>single>messages.php ?

    Thanks

    Regards
    Carsten

  • Keymaster
    (BuddyDev Team)
    Posts: 24599
    Brajesh Singh on #29779

    Hi Carsten,
    It will be nice if you can tell me what are you trying to achieve? removing the bulk action box?

    I can help better in that case.

    regards
    Brajesh

  • Participant
    Level: Yogi
    Posts: 1112
    calu on #29782

    Hi Brajesh, sorry for not being clear enough, my goal is to remove certain elements like the message select drop down and message star options. I can hide it with css, but would prefer to remove it instead.

    https://imgur.com/rYIJXaz

  • Keymaster
    (BuddyDev Team)
    Posts: 24599
    Brajesh Singh on #29783

    Hi Carsten,
    No issues.
    In that case, My suggestion will be to do the template override.

    you can copy the template from plugins/buddypress/bp-templates/bp-legacy/buddypress/members/single/messages to yourtheme/buddypress/members/single/messages and modify them as you please.

    Regards
    Brajesh

  • Participant
    Level: Yogi
    Posts: 1112
    calu on #29788

    Hi Brajesh, no issues, I was not sure which file I should overwrite.

    Just to clarify, then you never or can not?, overwrite

    buddypress, bp-messages, eg. bp-messages-star.php,

    but always via template, bp-templates eg. bp-legacy, buddypress, members, single, messages.php – or single, messages, message.php or messages-loop.php?

    When you overwrite a file to your child theme, like messages.php, it does not get overwritten, but that means also, that it does not get updated neither?

    Regards
    Carsten

  • Keymaster
    (BuddyDev Team)
    Posts: 24599
    Brajesh Singh on #29790

    Hi Carsten,
    You can override templates but not the core files of a plugin.

    For BuddyPress, things inside the bp-templates are part of template and can be overridden(with the template pack acting as root).

    For your case, the dropdown is in messages-loop.php

    
    	<div class="messages-options-nav">
    			<?php bp_messages_bulk_management_dropdown(); ?>
    		</div><!-- .messages-options-nav -->
    
    

    Regards
    Brajesh

  • Participant
    Level: Yogi
    Posts: 1112
    calu on #29793

    Hi Brajesh, thank you very much for the clarification and help on the subject, it’s working great.

    I want to overwrite other objects in the templates eg. the thread star, what is the easiest way to look up the corresponding template to an object, are these listed somewhere, or do I just have to look them up?

    Regards
    Carsten

  • Participant
    Level: Yogi
    Posts: 1112
    calu on #29794

    Hmm, ran into an issue, the dropdown is gone, but there must be a syntax error some were, or I positioned the remove action wrong, because it breaks the messages module?

    
    <div class="messages-options-nav">
    			<?php // remove the action 
    remove_action( 'bp_messages_bulk_management_dropdown', 'action_bp_messages_bulk_management_dropdown', 10, 0 );
    ?>
    		</div><!-- .messages-options-nav -->
    
    		<?php wp_nonce_field( 'messages_bulk_nonce', 'messages_bulk_nonce' ); ?>
    	</form>
    
    	<?php
    
    • This reply was modified 4 years, 6 months ago by calu.
  • Keymaster
    (BuddyDev Team)
    Posts: 24599
    Brajesh Singh on #29816

    Hi Carsten.
    Why are you putting remove action.

    If template override works, you do not need the remove actions.

    Add/remove actions are suitable when you can not modify the code directly. The allow you to hook/unhook in that case.

    Regards
    Brajesh

  • Participant
    Level: Yogi
    Posts: 1112
    calu on #29822

    Hi Brajesh, what you are suggesting makes good sense, thank you.

    Regards
    Carsten

The topic ‘ [Resolved] Insert callback location’ is closed to new replies.

This topic is: resolved