BuddyDev

Search

[Resolved] BuddyPress Moderation Tools Report Button – Modal Pop-up Window

Tagged: ,

  • Participant
    Level: Enlightened
    Posts: 56
    John B on #26084

    Is it possible to insert the Report button on a modal pop-up window instead of it appearing next to every post?

    On my Activity Stream in BuddyPress I have a menu button that appears to the right on every post. When a user clicks on that button, a modal window appears. This is where I place items that I don’t want to appear directly on the Activity Stream.

    I found another article that referenced the following code.

    
    if ( bpmts_user_can_report() ) {
    			echo bpmts_get_report_button( array(
    				'item_id'    => get_the_ID(),
    				'item_type'  => $post_type,
    				'context'    => $post_type,
    				'context_id' => get_the_ID(),
    			) );
    		}
    
    

    Would this apply to my situation? If so, can you please provide a working example of what the item_id and item_type would look like for the following examples?

    Report a Post from the Activity Stream
    Report a User from the Members Page

    I have a custom menu on each members profile page. That menu only appears when clicked on and displays Unfriend, Block and hopefully someday Report. The solution I’m looking for would be PHP code that I could insert just about anywhere to display the correct type of Report button. If the code above would work for me, I just need to know how to target posts from post comments, users, groups etc.

    Thanks as always..

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #26085

    Hi John,
    Thank you for using Moderation tools.

    You can place the button anywhere.

    Using the function

    
     echo bpmts_get_report_button( $args );
    

    is the way to go.

    You need to pass this function 4 arguments.

    item_id, item_type are used to identify items. Context helps us understand where the action took place.

    To see how we are adding the button, please check src/reportable-types/ directory.
    There, you will see a directory for each component we support.

    Look for that directory/handler/class-prefix-ui-helper.php

    For example, for user, It is reportable-types/user/handlers/class-user-ui-helper.php
    For activity it is reportable-types/buddypress/activity/handlers/class-activity-ui-helper.php

    You will find there what we are using to generate the button in various contexts.

    Please try using them.

    Hope this helps.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 56
    John B on #26121

    A million times thank you. That worked.. You’re the best!!

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #26129

    You are welcome.

The topic ‘ [Resolved] BuddyPress Moderation Tools Report Button – Modal Pop-up Window’ is closed to new replies.

This topic is: resolved