alriknijdam (@alriknijdam)

Forum Replies Created

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

  • alriknijdam
    Participant

    @alriknijdam

    @lemmonaid you’re a lifesaver! Thank you very much for sharing.


    alriknijdam
    Participant

    @alriknijdam

    As this is still not resolved I wrote a simple script to solve this issue. For those stumbeling up on this here it is.

    $topic_id		= bbp_get_topic_id();
    $reply_id		= bbp_get_reply_id();
    $position_raw	= bbp_get_reply_position($reply_id, $topic_id);
    // Remove the comma
    $position		= str_replace(',', '', $position_raw);
    // Devide by the number of posts per page, in my case 15
    // I didn't test it but I believe you can also use: get_option( 'posts_per_page' );
    $page_raw		= ceil($position / 15 );
    if ($page_raw > 1) $page = '/page/' . $page_raw;
    else $page 		= '';
    $slug			= get_post_field('post_name', get_post($topic_id));
    // Replace YOUR_WEBSITE_URL with your own or use: bloginfo('wpurl')
    // to retrieve it, but don't forget to concenate
    $correct_link	= 'YOUR_WEBSITE_URL/forums/topic/' . $slug . $page . '/#post-' . $reply_id;

    You can probably place this inside some function but I placed it inside loop-single-reply.php and placed that inside my child-theme. In that case you also have to replace this:

    <a href="<?php echo bbp_reply_url(); ?>" class="bbp-reply-permalink">#<?php echo bbp_reply_id(); ?></a>

    with:

    <a href="<?php echo $correct_link; ?>" class="bbp-reply-permalink">#<?php echo $reply_id; ?></a>

    In reply to: PM button in posts

    alriknijdam
    Participant

    @alriknijdam

    Got an error when the user no longer exists.
    Edited your code, this one doesn’t give an error and hides the PM link:

    function ntwb_bbp_bp_pm() {
    	if(function_exists('bp_send_private_message_link') && is_user_logged_in() ) {
    		global $bp;
    		if ($bp->loggedin_user->id !== bbp_get_reply_author_id()){
    			$user = get_userdata( bbp_get_reply_author_id()  );
    			
    			if ( !empty( $user->user_nicename ) ) {
    				$user_nicename = $user->user_nicename;
    				$compose = bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . $user_nicename;
    				
    				?>
    				<div class="forum-pm"><a href="<?php echo $compose ?>" title="Private Message">Private Message</a></div>
    				<?php
    			}
    		}
    	}
    }
    add_action( 'bbp_theme_after_reply_author_details', 'ntwb_bbp_bp_pm' );

    Thank you very much for your code shpitzyl.

    In reply to: Small template issues

    alriknijdam
    Participant

    @alriknijdam

    Just to let you know I found the issue 🙂
    I’ve added a not very well defined css line causing all this, removing that line fixed everything.


    alriknijdam
    Participant

    @alriknijdam

    Sorry for the late answer, I missed your last reply because I forgot the ‘notify me’ checkbox.

    I took a look in phpMyAdmin and the menu_order is non of the above, it is 2
    If you visit a topic you can also see that by looking at the $reply_position = get_post_field( 'menu_order', $reply_id ); value 🙂


    alriknijdam
    Participant

    @alriknijdam

    Alright, I tested the function you wrote but unfortunately it’s not doing anything.
    In order to try and help you some more you can now visit some topics.
    For everything you wrote above I now display the values in a table so you can see exactly what’s happening. I also made it possible to run and disable your function (although you won’t see any difference in the values)

    You can browse through the forums/topics to see the values for different topics.

    And yes, I have phpMyAdmin acces.

    Funny but strange fact:
    I’ve imported the topics via csv. The topics with recent activity show a wrong value for the last page. The topics that have not been active after the import do show the correct value (the 7th topic and any topic below that have not been active).
    If any I would have expected it to be the other way around.

    In reply to: Small template issues

    alriknijdam
    Participant

    @alriknijdam

    Lol, I already contacted my theme developer, they said I should contact BBpress support because they don’t alter it in any way. Could it be caused by the dutch translation being longer than the English version?

    Anyway I’ll contact them again, if they don’t offer a solution I will go the css way.

    Thanks

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