Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,851 through 1,875 (of 32,481 total)
  • Author
    Search Results
  • #218782

    In reply to: Setting up pagination

    Robin W
    Moderator

    hmm, can’t say why it isn’t working – it is code that I put together from a number of sources.

    If I can find time, I’ll look through the code, but no promises

    #218772
    Robin W
    Moderator
    #218754

    In reply to: a link on the picture

    frenchlemans
    Participant

    Thanks Robin,

    I just added the “title” line because it came out with an error.
    Otherwise it works very well.

    $title = bbp_get_forum_last_reply_title( $topic_id );
    I think this function can be useful to other people.

    Have a good day.

    #218752
    thodoris7
    Participant

    Hi,
    The code with 404 error is this <a href="<?php bbp_user_topics_created_url($tessera_user_ID); ?>"><?php esc_html_e( 'Topics Started', 'tessera' ); ?></a>
    The only function that works is <a href="<?php bbp_user_profile_url($tessera_user_ID); ?>"><?php esc_html_e( 'Profile', 'tessera' ); ?></a>

    Do i have create any pages for the topics as for the forum;

    #218747
    vincenzon617
    Participant

    Hi there,

    Is it possible to use the forum title rather than the forum id when using shortcode to display the forum? In my website I am using a plugin which has virtual pages and I would like the user to search for the title of the forum they want and then it to be displayed – by means of shortcode.

    Just in case, I would like to add that duplicate naming of the fourms would not be an issue in my website (it is not possible for the user to create a fourm with the same name).

    Also, is there a way in which I am able to query the forum index? If so, am I able to check if a forum with this name (used in the query) already exists? If it doesn’t I would like the user to be able to start it, is this also possible?

    WordPress version 5.6.2
    bbPress version 2.6.6

    Thanks in advance!

    #218739
    Robin W
    Moderator

    hmmm…

    try using

    Code Snippets

    The code works fine in my functions file

    #218732
    Robin W
    Moderator

    so can you give us the code surrounding this use please

    #218731

    In reply to: a link on the picture

    Robin W
    Moderator

    might have been too complicated, maybe just try

    add_action( 'bbp_theme_after_topic_freshness_author', 'rew_freshness_display_reply');
    
    function rew_freshness_display_reply ($topic_id = 0) {
    		$topic_id   = bbp_get_topic_id( $topic_id );
    		$link_url   = bbp_get_topic_last_reply_url( $topic_id );
    		
    		$anchor = '<a class="rew_freshness_display_image" href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '"><img class="plato" style="width: 29px; height: 20px;" src="https://webershoot.com/mesimages/transplato.png">' . '</a>';
    	
    echo '<p class="platopost">'.$anchor.'</p>';
    }
    #218729
    hamza21
    Participant

    It shows nonce_failure error when I add the above code in my theme function.php file.

    #218718
    Robin W
    Moderator

    try

    function rew_change_text( $translated_text, $text, $domain ) {
    	if ( $text == '<strong>Error</strong>: Your reply cannot be created at this time.') {
    	$translated_text = '<strong>Error</strong>: New moderation message';
    	}
    	return $translated_text;
    }
    
    add_filter( 'gettext', 'rew_change_text', 20, 3 );
    #218711
    purityboy83
    Participant

    Hi

    If add a link to “topic and reply”, the embed function does not work.

    ref img
    https://ibb.co/qxXG125

    site.com is an example for screenshots.
    I entered the actual URL

    error error embed
    Oops! That embed can’t be found

    ref img
    https://ibb.co/grXr9dV

    It was a site that has been without problems for months.
    I just discovered it by accident.

    The same is happening at the internal test site.

    I installed the “Health Check & Troubleshooting” plug-in from the test site
    and activated the Troubleshooting mode.

    and only 2 plugin activate
    – bbPress
    – bbPress Permalinks with ID

    The problem still occurs.
    It’s a well-used feature, site, but suddenly a problem arises and I’m confused.

    I must need to help

    wordpress 5.5.3
    PHP-7.4

    Thanks

    Best Regards,
    Hyunho

    #218693

    In reply to: a link on the picture

    Robin W
    Moderator

    Try

    add_action( 'bbp_theme_after_topic_freshness_author', 'rew_freshness_display_reply');
    function rew_freshness_display_reply ($forum_id = 0) {
    	// Verify forum and get last active meta
    	$forum_id  = bbp_get_forum_id( $forum_id );
    		$active_id = bbp_get_forum_last_active_id( $forum_id );
    		$link_url  = $title = '';
    
    		if ( empty( $active_id ) )
    			$active_id = bbp_get_forum_last_reply_id( $forum_id );
    
    		if ( empty( $active_id ) )
    			$active_id = bbp_get_forum_last_topic_id( $forum_id );
    
    		if ( bbp_is_topic( $active_id ) ) {
    			//then reset forum_id to the forum of the active topic in case it is a sub forum
    			//$forum_id = bbp_get_topic_forum_id($active_id);
    			$link_url = bbp_get_forum_last_topic_permalink( $forum_id );
    			$title    = bbp_get_forum_last_topic_title( $forum_id );
    		} elseif ( bbp_is_reply( $active_id ) ) {
    			//then reset forum_id to the forum of the active topic in case it is a sub forum
    			//$forum_id = bbp_get_reply_forum_id($active_id);
    			$link_url = bbp_get_forum_last_reply_url( $forum_id );
    			$title    = bbp_get_forum_last_reply_title( $forum_id );
    		}
    		
    		$anchor = '<a class="rew_freshness_display_image" href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '"><img class="plato" style="width: 29px; height: 20px;" src="https://webershoot.com/mesimages/transplato.png">' . '</a>';
    	
    echo '<p class="platopost">'.$anchor.'</p>';
    }
    #218689

    In reply to: a link on the picture

    frenchlemans
    Participant

    Hello Robin,

    I tried to adapt the code you provided me for the same function but from forums and not topics. I tried a lot of possibilities inside but each time it brings me back to the last forum and not to the last post of each topic.
    I searched through the documentation and archives but couldn’t find anything.
    So the code used is below, it fits the image well but not the last post of the subject in which it is:

    add_action( 'bbp_theme_after_topic_freshness_author', 'rew_freshness_display_reply');
    function rew_freshness_display_reply ($forum_id = 0) {
    	// Verify forum and get last active meta
    	$forum_id  = bbp_get_forum_id( $forum_id );
    		$active_id = bbp_get_forum_last_active_id( $forum_id );
    		$link_url  = $title = '';
    
    		if ( empty( $active_id ) )
    			$active_id = bbp_get_forum_last_reply_id( $forum_id );
    
    		if ( empty( $active_id ) )
    			$active_id = bbp_get_forum_last_topic_id( $forum_id );
    
    		if ( bbp_is_topic( $active_id ) ) {
    			//then reset forum_id to the forum of the active topic in case it is a sub forum
    			$forum_id = bbp_get_topic_forum_id($active_id);
    			$link_url = bbp_get_forum_last_topic_permalink( $forum_id );
    			$title    = bbp_get_forum_last_topic_title( $forum_id );
    		} elseif ( bbp_is_reply( $active_id ) ) {
    			//then reset forum_id to the forum of the active topic in case it is a sub forum
    			$forum_id = bbp_get_reply_forum_id($active_id);
    			$link_url = bbp_get_forum_last_reply_url( $forum_id );
    			$title    = bbp_get_forum_last_reply_title( $forum_id );
    		}
    		
    		$anchor = '<a class="rew_freshness_display_image" href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '"><img class="plato" style="width: 29px; height: 20px;" src="https://webershoot.com/mesimages/transplato.png">' . '</a>';
    	
    echo '<p class="platopost">'.$anchor.'</p>';
    }

    Regards.

    #218660

    In reply to: a link on the picture

    Robin W
    Moderator

    what is your existing code?

    #218637
    st11
    Participant

    It worked if I set capabilities when creating custom role.

    function add_wp_custom_roles() {
        add_role(
            "bbp_member",
            "Member",
            [
    		"read"=>true,
    
    		"spectate"=>true,
    		"participate"=>true,
    		"read_private_forums"=>true,
    		"publish_replies"=>true,
    		"edit_replies"=>true,
    	    ]);
    }
    add_action("init", "add_wp_custom_roles");
    
    #218634
    Robin W
    Moderator

    you seems to have an inline style which is overwriting any other styling eg

    style="height: auto !important;"> and <p style="height: auto !important;"

    from this code.

    <div class="bbp-reply-content" style="height: auto !important;">
    
    		
    		-ad-client="ca-pub-8895339382096709" data-adsbygoogle-status="done"><ins<p><strong>1. The Profession of Faith—The Shahada</strong></p>
    <p>&nbsp;</p>
    <p style="height: auto !important;">The Profession of Faith, the shahada, is the most fundamental expression of Islamic<br>

    It may be related to where you are importing the text from

    #218629
    Robin W
    Moderator

    the one above should work – I changed

    $forum_id = '12345'
    to
    $forum_id == '12345'

    #218626
    Robin W
    Moderator

    oops sorry should read

    $forum_id = bbp_get_topic_forum_id()
            if((!bee_catch_image() == '') && $forum_id == '12345'){

    == being compare

    #218625
    purityboy83
    Participant

    Hi @robin-w

    echo (bbp_topic_permalink().'">

    Is there a way to set forum_id here?

    Thanks for always help

    #218624
    purityboy83
    Participant

    Hi @robin-w

    You who always help are probably an angel.

    I followed your advice and modified the code
    However, thumbnails are displayed on all forums topic….

    Thanks~

    #218623
    Robin W
    Moderator

    probably

    $forum_id = bbp_get_topic_forum_id()
            if((!bee_catch_image() == '') && $forum_id = '12345'){
    #218622
    purityboy83
    Participant

    Hi

    I want the thumbnail to appear on the topic
    Search results found a plugin similar to the function I’m hoping for

    bbpress-topic-thumbnails
    https://wordpress.org/plugins/bbpress-topic-thumbnails/

    I want to add one more feature in this plugin.
    With this plugin, thumbnails of all forum topics are displayed

    I only want to use this feature for 1 specific forum
    reason for write topic is because the plugin has not been updated for a long time.

    So I ask for help here

    code is

    
    /*Hooks into the loop-topic.php output to print image*/
    add_action( 'bbp_theme_before_topic_title', 'bee_insert_thumbnail' );
    function bee_insert_thumbnail() {
    
            if((!bee_catch_image() == '')){
            echo('<a href="'); 
        echo(bbp_topic_permalink() . '"><img class="bbp-topic-thumbnail"  width="100%" style="max-width: ' . get_option('thumbnail_size_w') . 'px; max-height: ' . get_option('thumbnail_size_h'). 'px; vertical-align:middle;" src="' . bee_catch_image() . '"/>' .'</a>');
            }
    }
    
    /*Function that retrieves the first image associated with the topic*/
    function bee_catch_image() {
      global $post, $posts;
      $first_img = '';
      ob_start();
      ob_end_clean();
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      $first_img = $matches [1] [0];
      return $first_img;
    }
    

    Anyone can help?
    Thanks

    #218620
    Robin W
    Moderator

    for ‘Follow this link to join the discussion’ – you are welcome to style it as a button if you wish

    go to

    dashbaoard>settings>discussion and change

    Follow this link to join the discussion

    to

    <div class="myButton">Follow this link to join the discussion</div>

    you can then style a button, if you don’t know how go to

    https://www.bestcssbuttongenerator.com/

    #218600
    st11
    Participant

    I am trying to create a custom role that can only reply to existing topics.

    I followed this to create new role. At first, the role did appear in dropdown list in admin edit user screen, but after saving, it went back to “— No role for these forums —”.

    I found this thread, so.. I created custom WordPress role in the same name. This made the bbPress role to be “saved” but it doesn’t seem to add capabilities. The user with this role can’t see forum or topics.

    How can I get this custom bbPress user role to have custom capability?

    WordPress 5.5, bbPress 2.6.6

    #218557
    xprojectsx
    Participant

    I know this is an old thread but it is about the most useful on this issue but unfortunately did not solve my problem. (I got zero results returned in the TMP table) I wanted to point out however in case it is useful for anyone else, that in step 3 of @giobby post above there seems to be some extraneous text in there.

    these three lines:

    wp_posts.post_excerpt, 
    pescasubac, 
    wp_posts.quea.wp_posts.post_status, 

    I believe should be:

    wp_posts.post_excerpt, 
    wp_posts.post_status, 

    pescasubac doesn’t seem to refer to anything and “wp_posts.quea” also is not a thing. All of the other fields in wp_posts are accounted for without those two items.

Viewing 25 results - 1,851 through 1,875 (of 32,481 total)
Skip to toolbar