Skip to:
Content

bbPress.org


Ignore:
Timestamp:
02/26/2017 07:12:34 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Engagements: First pass at:

  • User profile section
  • Template parts changes
  • Rewrite rules support
  • Repair & upgrade tools
  • BuddyPress support
  • engagement slug setting

See #3068.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/includes/users/template.php

    r6319 r6320  
    10371037            $paged = (bool) bbpress()->forum_query->in_the_loop;
    10381038        }
    1039        
     1039
    10401040        // Pretty permalinks
    10411041        if ( bbp_use_pretty_urls() ) {
     
    14781478 *
    14791479 * @param int $user_id Optional. User id
    1480  * @uses bbp_get_favorites_permalink() To get the favorites permalink
     1480 * @uses bbp_get_user_topics_created_url() To get the favorites permalink
    14811481 */
    14821482function bbp_user_topics_created_url( $user_id = 0 ) {
     
    14901490     * @param int $user_id Optional. User id
    14911491     * @uses bbp_get_user_profile_url() To get the user profile url
    1492      * @uses apply_filters() Calls 'bbp_get_favorites_permalink' with the
     1492     * @uses apply_filters() Calls 'bbp_get_user_topics_created_url' with the
    14931493     *                        user profile url and user id
    14941494     * @return string Permanent link to user profile page
     
    15261526    }
    15271527
    1528 /** Topics Created ************************************************************/
     1528/** Replies Created ************************************************************/
    15291529
    15301530/**
     
    15341534 *
    15351535 * @param int $user_id Optional. User id
    1536  * @uses bbp_get_favorites_permalink() To get the favorites permalink
     1536 * @uses bbp_get_user_replies_created_url() To get the favorites permalink
    15371537 */
    15381538function bbp_user_replies_created_url( $user_id = 0 ) {
     
    15461546     * @param int $user_id Optional. User id
    15471547     * @uses bbp_get_user_profile_url() To get the user profile url
    1548      * @uses apply_filters() Calls 'bbp_get_favorites_permalink' with the
     1548     * @uses apply_filters() Calls 'bbp_get_user_replies_created_url' with the
    15491549     *                        user profile url and user id
    15501550     * @return string Permanent link to user profile page
     
    15801580
    15811581        return apply_filters( 'bbp_get_user_replies_created_url', $url, $user_id );
     1582    }
     1583
     1584/** Engagements ***************************************************************/
     1585
     1586/**
     1587 * Output the link to the user's engagements
     1588 *
     1589 * @since 2.6.0 bbPress (r6320)
     1590 *
     1591 * @param int $user_id Optional. User id
     1592 * @uses bbp_get_user_engagements_url() To get the engagements permalink
     1593 */
     1594function bbp_user_engagements_url( $user_id = 0 ) {
     1595    echo esc_url( bbp_get_user_engagements_url( $user_id ) );
     1596}
     1597    /**
     1598     * Return the link to the user's engagements
     1599     *
     1600     * @since 2.6.0 bbPress (r6320)
     1601     *
     1602     * @param int $user_id Optional. User id
     1603     * @uses bbp_get_user_profile_url() To get the user profile url
     1604     * @uses apply_filters() Calls 'bbp_get_user_engagements_url' with the
     1605     *                        user profile url and user id
     1606     * @return string Permanent link to user profile page
     1607     */
     1608    function bbp_get_user_engagements_url( $user_id = 0 ) {
     1609
     1610        // Use displayed user ID if there is one, and one isn't requested
     1611        $user_id = bbp_get_user_id( $user_id );
     1612        if ( empty( $user_id ) ) {
     1613            return false;
     1614        }
     1615
     1616        // Allow early overriding of the profile URL to cut down on processing
     1617        $early_url = apply_filters( 'bbp_pre_get_user_engagements_url', $user_id );
     1618        if ( is_string( $early_url ) ) {
     1619            return $early_url;
     1620        }
     1621
     1622        // Get user profile URL
     1623        $profile_url = bbp_get_user_profile_url( $user_id );
     1624
     1625        // Pretty permalinks
     1626        if ( bbp_use_pretty_urls() ) {
     1627            $url = trailingslashit( $profile_url ) . bbp_get_user_engagements_slug();
     1628            $url = user_trailingslashit( $url );
     1629
     1630        // Unpretty permalinks
     1631        } else {
     1632            $url = add_query_arg( array(
     1633                bbp_get_user_engagements_rewrite_id() => '1',
     1634            ), $profile_url );
     1635        }
     1636
     1637        return apply_filters( 'bbp_get_user_engagements_url', $url, $user_id );
    15821638    }
    15831639
Note: See TracChangeset for help on using the changeset viewer.