• Resolved kostritsaalex

    (@kostritsaalex)


    Hi guys,

    I am trying to make some adjustments toward permalink structure, so it uses {users}{first_name-last_name} instead of {users}{nicename}. I think I found the right filter to adjust and here is my code:

    // Add this function to your theme's functions.php file or your plugin file.
    function custom_bbp_get_user_profile_url( $url, $user_id, $user_nicename ) {
    // Get the user data
    $user_info = get_userdata( $user_id );

    // Check if user info is available
    if ( $user_info ) {
    // Get first name and last name
    $first_name = isset( $user_info->first_name ) ? $user_info->first_name : '';
    $last_name = isset( $user_info->last_name ) ? $user_info->last_name : '';

    // Create custom user_nicename as "First Last"
    $custom_nicename = trim( $first_name . ' ' . $last_name );

    // Return the URL with updated user_nicename
    return str_replace( $user_nicename, sanitize_title($custom_nicename), $url );
    }

    // If user info is not available, return the original URL
    return $url;
    }

    // Hook the function into the filter
    add_filter( 'bbp_get_user_profile_url', 'custom_bbp_get_user_profile_url', 10, 3 );

    The structure of the URL got changed as expected, however I am getting 404 not found. I’ve re-saved permalinks to refresh the cache, but it didn’t help. Any ideas where to look?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support SpiderThemes Support

    (@spiderthemes247)

    Hello,

    Thank you for providing the details of your issue. The problem you’re encountering is related to the bbPress plugin. While your code successfully updates the URL structure, it seems that bbPress may not be properly recognizing the new permalink format, which is likely causing the 404 error.

    To resolve this, I recommend reaching out to the bbPress support forums or their official support team. They should be able to offer specific guidance on how to adjust bbPress to handle the custom URL structure.

    Please feel free to reach out if you need further assistance.

    Thread Starter kostritsaalex

    (@kostritsaalex)

    Ok, I was thinking this is their official support 🙂
    Can you please point out me where to find their official support?

    Thanks!

    Plugin Support SpiderThemes Support

    (@spiderthemes247)

    Hello,

    Apologies for the confusion! You can find the official bbPress support forums at this link: https://bbpress.org/forums/. There, you’ll be able to post your issue and get help from the bbPress community and their support team.

    Let me know if you need any further assistance.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘permalinks structure’ is closed to new replies.