bbp_get_topic_admin_links( array $args = array() )
Return admin links for topic.
Description
Move topic functionality is handled by the edit topic page.
Parameters
- $args
-
(Optional) This function supports these arguments: - id: Optional. Topic id - before: Before the links - after: After the links - sep: Links separator - links: Topic admin links array
Default value: array()
Return
(string) Topic admin links
Source
File: bp-forums/topics/template.php
2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 | function bbp_get_topic_admin_links( $args = array () ) { // Parse arguments against default values $r = bbp_parse_args( $args , array ( 'id' => bbp_get_topic_id(), 'before' => '<span class="bbp-admin-links">' , 'after' => '</span>' , 'sep' => ' | ' , 'links' => array () ), 'get_topic_admin_links' ); if ( empty ( $r [ 'links' ] ) ) { $r [ 'links' ] = apply_filters( 'bbp_topic_admin_links' , array ( 'edit' => bbp_get_topic_edit_link ( $r ), 'close' => bbp_get_topic_close_link( $r ), 'stick' => bbp_get_topic_stick_link( $r ), 'merge' => bbp_get_topic_merge_link( $r ), 'trash' => bbp_get_topic_trash_link( $r ), 'spam' => bbp_get_topic_spam_link ( $r ), 'reply' => bbp_get_topic_reply_link( $r ) ), $r [ 'id' ] ); } // See if links need to be unset $topic_status = bbp_get_topic_status( $r [ 'id' ] ); if ( in_array( $topic_status , array ( bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ) ) { // Close link shouldn't be visible on trashed/spammed topics unset( $r [ 'links' ][ 'close' ] ); // Spam link shouldn't be visible on trashed topics if ( bbp_get_trash_status_id() === $topic_status ) { unset( $r [ 'links' ][ 'spam' ] ); // Trash link shouldn't be visible on spam topics } elseif ( bbp_get_spam_status_id() === $topic_status ) { unset( $r [ 'links' ][ 'trash' ] ); } } // Process the admin links $links = implode( $r [ 'sep' ], array_filter ( $r [ 'links' ] ) ); $retval = $r [ 'before' ] . $links . $r [ 'after' ]; return apply_filters( 'bbp_get_topic_admin_links' , $retval , $r , $args ); } |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.