Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 951 through 975 (of 32,297 total)
  • Author
    Search Results
  • #229116
    Robin W
    Moderator

    All – let me just clarify that I’m just a guy sat in his kitchen who helps out here, I am not a bbpress author !!


    @craigcotner
    & @iqfy- trashing topics or replies calls a standard WordPress function which checks for comments and media on each post before trashing. This involves a database lookup to check whether anything in those tables needs deleting and it is this that seems to be taking the time and making you both time out. Topics and replies don’t have comments or media that is attached in that way, so these steps are not needed.

    Now trashing a reply is fairly easy, replies don’t hold any data that needs referencing elsewhere that we need to worry about.

    But Topics have engagements and subscriptions to be gone through.

    so if I wrote some code to allow you to delete a numbered topic, this could use a quicker method to permanently delete all the replies, and then use the proper function to delete the topic.

    And as long as the topic or reply it is not latest activity, then we can maybe skip the step that needs to recalculate what the lastest activity now needs to be.

    That should prevent timeouts I hope.

    SO 2 things here

    1. any topic/reply being got rid of should not be the ‘latest activity’ in the forum – but I’m guessing if the topic is still getting replies and therefore ‘hot’ then you would not be deleting it
    2. this would be deleting it a numbered topic at a time, so you would look up the topic and then in the dashboard there would be an option to enter that topic number to trash it.

    Does that sound as if it would work for you?


    @jimmyt53
    – not sure how easily I’d be able to fix that, but I’ll think about it as I progress. so

    1. how would you want to pick topics for deletion – by ‘older than’ presumably? and
    2. just from one forum or across all forums?
    3. again could not be a topic or reply where it is latest activity

    Feedback before I start code something that doesn’t help would be great 🙂

    and from all – are we talking about permanently deleting – ie reduce database size, or just trashing – ie stopping people seeing, but retaining the ability to restore later?

    #229104
    mrentropy
    Participant

    I realize this topic is more than six years old, but I’ve been attempting to achieve similar behavior, and adding the following code in a custom plug-in seems to work. I have a taxonomy of “ideacategory” and I’m able to create a bbPress view called “ideacat” that filters all of the topics where the category term is equal to “24-hour-market-watch.”

    function idea_register_custom_views() {
    		
    	bbp_register_view(
    		'ideacat',
    			esc_html__( 'Idea Category', 'bbpress' ),
    			apply_filters( 'bbp_register_view_ideacat', array(
    			'tax_query' => array(
    				array(
    					'taxonomy' => 'ideacategory',
    					'field' => 'slug',
    					'terms' => array( '24-hour-market-watch' )
    				)
    			),
    			'show_stickies' => false
    			)
    		) );
    
    }
    
    add_action( 'bbp_register_views', 'idea_register_custom_views' );
    #229093
    osakid8
    Participant

    I used the shortcode[bbp-search] make seachform.
    I want to change border color and size of this searchform.
    So I wrote CSS like this.

    #bbp_search {
    border-color:#0c162a important!;
    width:50%;
    }

    But the design did’t change.
    What CSS should I write?

    Steveorevo
    Participant

    Even simpler; add this one line to twenty twenty two’s index.php file; this will preserve the theme’s menus, header, etc. and tell WordPress to use 2022’s template engine:

    
    include ABSPATH . WPINC . '/template-canvas.php';
    

    Or, to prevent losing changes when/if 2022 updates; use this hook in your own functions/plugin/child:

    
    add_filter( 'template_include', function( $template ) {
        if ( false !== strpos($template, 'twentytwentytwo/index.php') ) {
    		$template = ABSPATH . WPINC . '/template-canvas.php';
        }
        return $template;
    });
    
    #229080

    In reply to: padding between topics

    Robin W
    Moderator

    try this in your custom css

    #bbpress-forums li.bbp-body ul.forum, #bbpress-forums li.bbp-body ul.topic {
    	padding: 5px 25px !important;
    }
    ‎
    Participant

    A few months ago I played around with popular SEO plugins. Unbeknownst to me, one of them created a sitemap that included over 50,000(!) individual topic reply pages, and Googlebot indexed over 20,000 of them…making my site run out of crawler quota.

    I didn’t notice the problem until Google went from instantly indexing my articles to ignoring them until manually submitted.

    Blocking the community/reply/* URL in robots.txt has little effect because it only blocks googlebot from visiting the URL format again – it doesn’t drop the existing indexed pages.

    So I added this to a custom plugin:

    add_action("wp_head", function ()
    {
    	if (substr($_SERVER['REQUEST_URI'], 0, 17) == "/community/reply/")
    	{
    		echo '<meta name="robots" content="noindex">';
    	}
    } );

    Self-explanatory – adds the noindex to the header of reply pages. If you’ve named the slugs differently, obviously edit them and the substr length count.

    Let me know if you’ve experienced the same issue and how you went about fixing it. And.. what’s the point of the reply page any way? It’s just duplicate content because the reply is already listed in the thread.

    #229057
    sruddy
    Participant

    The image uploader used to ask for size, but after installing the bbPress image loader upgrade, it no longer gives the size field. thanks for the trouble shooting thing. This twenty fourteen theme has been modified and is now using a child theme. I’m not exactly sure what that means but I see no additional settings for the child portion. Neither the wordpress page editor nor the forum page editor have any format choices either. In addition I tried to make one page full width with this code .page-id-17507 .site-inner, .page-id-17507 .site-footer {
    max-width: none !important;
    width: 95% !important;
    }
    but it had no affect either, it works on my wordpress.com webpages at https://steveruddyphotography.com/
    but not on this website.

    #229027
    Robin W
    Moderator

    portal-admin is not a default wordpress or bbpress role, so how ever you created that, you’ll need to add the appropriate bbpress capabilities to it.

    bbPress User Roles and Capabilities

    #229022
    Robin W
    Moderator

    do you mean access to the forums on the front end ?

    Step by step guide to setting up a bbPress forum – Part 1

    item 3

    You really don’t want to give access at the backend – bbpress is simply not designed to work that way !

    Steveorevo
    Participant

    Very nice work with the style pack Robin! I do have one issue with Mega Max menu compatibility. For whatever reason, it doesn’t look like shortcodes are being processed when style pack is activated (which is how MegaMax allows menus to be embedded).

    Otherwise I’d recommend your style pack for bbPress users as this “simply works” to deliver the forum styling to Twenty Twenty Two without having to painfully apply one’s own CSS rules to make it marginally pretty.

    For those willing to go that far, I found that simply adding a basic, default template page as described on WordPress.org will do the trick. Supposedly block editor doesn’t care for/use PHP template pages anymore so it’s otherwise ignored.

    For simplicity, I just replace Twenty Twenty Two’s otherwise empty index.php with the “skinny” template index.php I created here:

    https://gist.github.com/Steveorevo/96d8015bcf353221e1cf0cd6b89bb766

    #229003
    Robin W
    Moderator

    thanks, just had a look on my test site.

    The first hat image I uploaded displays as

    <img src="https://i0.wp.com/santarosaphotographicsociety.org/wp-content/uploads/hm_bbpui/2765/dccxo3aalx9pf5qhw9w5scfhksqpwcb1.jpg" alt="picture">

    so will load at the size of the web page.

    On your site it displays as

    <img src="https://i0.wp.com/santarosaphotographicsociety.org/wp-content/uploads/hm_bbpui/2765/dccxo3aalx9pf5qhw9w5scfhksqpwcb1.jpg?w=474&ssl=1" alt="Hats" width="473" height="316">

    It is uploading as full size, so something, maybe your theme or a wordpress setting is limiting it’s display.

    I’m not sure if those width details are being saved as part of the post saved in the database, or are added in displaying.

    you might also look at

    dashboard>settings>media

    #228970
    rcotwunite
    Participant

    Hello all,

    I’m working in PHP in WordPress. I’m comfortable modifying and editing code.

    I have a collection of Musical Artists and their releases. I’ve created a topic for each artist (post type) and release (post type) using bbPress Topics For Posts.

    The user then replies to the topic. I want them to be forced to choose a tag when they reply: “Buy”, “Sell”, or “Info”.

    Then I want them to be able to click a button that only shows replies tagged “Buy”, “Sell”, or “Info”.

    How do I create a button to filter replies in PHP? Thanks!

    Here’s an example of an artist page with a discussion forum below

    #228937
    Robin W
    Moderator

    also try

    .bbp-search-form input[type="submit"] {
      float: none !important;
    #228936
    Robin W
    Moderator

    maybe this is closer, not quite right order

    li.bbp-forum-info, li.bbp-topic-title {
    	float: right !important;
    	text-align: right !important ;
    
    }
    #228930
    Robin W
    Moderator

    ok, I think you have fixed the title

    For the breadcrumbs add this to your css

    .site-breadcrumbs, #top-bar-social.top-bar-right, #searchform-dropdown, .current-shop-items-dropdown {
      right: 0 !important;
      left: 0; !important
    #228927
    Robin W
    Moderator

    I doubt this can be solved as posted without custom code.

    You can import files using

    GD bbPress Attachments

    It would be possible to add some fields to the topic and or reply fields – this article explains the principals.

    https://wp-dreams.com/articles/2013/06/adding-custom-fields-bbpress-topic-form/

    Whilst it talks about the functions file, you can also use code snipetts

    Code Snippets

    so for instance if you wanted to try their code you would put all this into a single code snippet

    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
       $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field1', true);
       echo '<label for="bbp_extra_field1">Extra Field 1</label><br>';
       echo "<input type='text' name='bbp_extra_field1' value='".$value."'>";
    
       $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field2', true);
       echo '<label for="bbp_extra_field1">Extra Field 2</label><br>';
       echo "<input type='text' name='bbp_extra_field2' value='".$value."'>";
    }
    add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
    add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );
    
    function bbp_save_extra_fields($topic_id=0) {
      if (isset($_POST) && $_POST['bbp_extra_field1']!='')
        update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field1'] );
      if (isset($_POST) && $_POST['bbp_extra_field1']!='')
        update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field2'] );
    }
    add_action('bbp_template_before_replies_loop', 'bbp_show_extra_fields');
    function bbp_show_extra_fields() {
      $topic_id = bbp_get_topic_id();
      $value1 = get_post_meta( $topic_id, 'bbp_extra_field1', true);
      $value2 = get_post_meta( $topic_id, 'bbp_extra_field2', true);
      echo "Field 1: ".$value1."<br>";
      echo "Field 2: ".$value2."<br>";
    }

    There are reply equivalents, but would need you to specify what should go into topic and what reply

    #228926
    Robin W
    Moderator

    This might be the same as you are saying you don’t want – the user can press the submit, but it returns an error. As close as you’ll get without some js.

    function rew_min_length ($reply_content) {
    	if (strlen($reply_content)<500) {
    		bbp_add_error( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply must be at least 500 characters.', 'bbpress' ) );
    	}
    return $reply_content ;
    }
    
    add_filter( 'bbp_new_reply_pre_content', 'rew_min_length' );
    #228896
    Robin W
    Moderator
    #228891
    Robin W
    Moderator

    creating a link within the forum can be done with a hook to the code quite easily.

    The problem would be knowing what course sent the user to the forum, it may well be a parameter in the learndash course database (eg this course has this forum), but beyond free help to work out.

    Contact me via http://www.rewweb.co.uk/contact-me/ if you want me to look.

    #228846
    technotip
    Participant

    Thank you ..

    The issue was with SEO plugins Yoast SEO.

    If anyone else facing similar issue, you can disable breadcrumbs from Yoast SEO:
    /wp-admin/admin.php?page=wpseo_titles#top#breadcrumbs

    Thanks a lot for all the help @robin-w

    #228781
    uisneach
    Participant

    Hi,
    I’m using WordPress 5.9.3 and bbPress 2.6.9.
    I have checked the option for “Allow users to subscribe to forums and topics” in the bbPress settings. However, I don’t see the Subscribe/Unsubscribe button/link above a Forum. I do see the option to subscribe to a Topic when replying to a topic. I’ve tried viewing the forum while logged in with different user roles including Administrator but still no joy.

    I have even tried creating my own shortcodes to try and output the subscribe link but it doesn’t output anything. e.g. while in the loop, bbp_forum_subscription_link( array( ‘before’ => ”, ‘subscribe’ => ‘+’, ‘unsubscribe’ => ‘×’ ) )

    Is there something I’m missing?

    #228749
    maestromike1977
    Participant

    Hi, I’m using Buddyboss theme, and when a user creates a group with a forum, I need the forum to have by default certain topics set up, eg. ‘Rules’, ‘General Chat’ etc (so me/user doesn’t need to set these topics up every time a group is created). Not sure how to code this, any help appreciated, thanks!

    #228747
    Viswa RJ
    Participant

    Hi,

    As said earlier, I have tried installing the bbpress in a demo wordpress domain. With bbPress, I installed and activated only

    1. Advanced Editor Tools (previously TinyMCE Advanced),
    2. Classic Editor,
    3. Highlighting Code Block

    plugins. Created sample forums with few topics. Later, I have created a username and logged in as a participant and tried to post the same topic and reply (Nothing changed). Topic got posted, it never shown any error such as Duplicate topic detected or Duplicate reply detected. At the end of the slug, it has added -2 and got posted as topic-name-2.

    Please help me resolve this issue AEAP.

    #228725
    Robin W
    Moderator

    This code should do it

    add_filter ('bbp_current_user_can_access_create_topic_form' , 'rew_only_one_topic', 10 , 1) ;
    add_filter( 'gettext', 'rew_change_text', 20, 3 );
    
    function rew_only_one_topic ($retval) {
    	//first check if they have access, only amend if they have
    	if ($retval==true) {
    		$user_id = wp_get_current_user()->ID;
    		$role = bbp_get_user_role( $user_id );
    		if ($role == 'bbp_participant') {
    		$last_posted = bbp_get_user_last_posted( $user_id );
    		if (time() <($last_posted + (60*60*24*31))) $retval = false ;
    		}
    	}
    	return $retval ;
    }
    
    function rew_change_text($translated_text, $text, $domain ) {
    	if ( $text == 'You cannot create new topics.') {
    		$user_id = wp_get_current_user()->ID;
    		$role = bbp_get_user_role( $user_id );
    		if ($role == 'bbp_participant') {
    			$last_posted = bbp_get_user_last_posted( $user_id );
    			if (time() <($last_posted + (60*60*24*31))) {
    				$translated_text = 'You cannot post a new topic - you have already posted a topic in the last month';
    			}
    		}
    	}
    	return $translated_text;
    }

    The 60*60*24*31 is 60 seconds, 60 minutes, 24 hours, 31 days, so you can change this to whatever you want in both places.

    and you can change $translated_text = ‘You cannot post a new topic – you have already posted a topic in the last month’ to whatever phrase in whatever language you want.

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    #228714
    Robin W
    Moderator

    untested, but this should do it

    add_filter( 'bbp_new_topic_redirect_to', 'rew_forum_redirect_topic' , 10 ,3 ) ;
    add_filter( 'bbp_new_reply_redirect_to', 'rew_forum_redirect_reply' , 10 ,3 ) ;
    
    function rew_forum_redirect_topic ($redirect_url, $redirect_to, $topic_id ){
    	$redirect_url = 'http://mysite.fr/newsfeed' ;
    return $redirect_url ;
    
    }
    
    function rew_forum_redirect_reply ($redirect_url, $redirect_to, $reply_id ){
    	$redirect_url = 'http://mysite.fr/newsfeed';
    return $redirect_url ;
    
    }
Viewing 25 results - 951 through 975 (of 32,297 total)
Skip to toolbar