Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,701 through 1,725 (of 32,466 total)
  • Author
    Search Results
  • #220218
    Robin W
    Moderator

    ‘Private’ is a wordpress/bbpress conflict – and it is annoying !!

    either

    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

    add_filter('private_title_format', 'ntwb_remove_private_title');
    function ntwb_remove_private_title($title) {
    	return '%s';
    }

    or use

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Forum Display

    #220217
    Robin W
    Moderator

    some code from one of my plugins (bbp-style-pack) that plays with this area might help

    add_action ('bbp_new_topic_post_extras' , 'bsp_topic_tags_process' ) ;
    	add_action ('bbp_edit_topic_post_extras' , 'bsp_topic_tags_process' ) ;
    	add_action( 'bbp_new_reply_post_extras', 'bsp_reply_tags_process' );
    	add_action( 'bbp_edit_reply_post_extras', 'bsp_reply_tags_process' );
    
    //handle topic tags
    
    function bsp_topic_tags_process ($topic_id) {
    	if ( bbp_allow_topic_tags() && ! empty( $_POST['bbp_topic_tags'] ) ) {
    		
    		$terms = $_POST['bbp_topic_tags'] ;
    		
    		// Add topic tag ID as main key
    		$terms = array( bbp_get_topic_tag_tax_id() => $terms );
    		
    		$topic_data = array(
    		'ID'           => $topic_id,
    		'tax_input'    => $terms,
    		) ;
    		$topic_id = wp_update_post( $topic_data );
    		
    		
    	}
    }
    
    function bsp_reply_tags_process ($reply_id) {
    	if ( bbp_allow_topic_tags() && ! empty( $_POST['bbp_topic_tags'] ) ) {
    		$topic_id = bbp_get_reply_topic_id ($reply_id) ;
    		
    		$terms = $_POST['bbp_topic_tags'] ;
    		
    		// Add topic tag ID as main key
    		$terms = array( bbp_get_topic_tag_tax_id() => $terms );
    		
    		$topic_data = array(
    		'ID'           => $topic_id,
    		'tax_input'    => $terms,
    		) ;
    		$topic_id = wp_update_post( $topic_data );
    	}
    }
    #220212
    Back to Front
    Participant

    Hi! I’m trying to allow users to assign their topics to custom taxonomies from the front end bbpress topic form. I thought it would be cool to be allow users to sort topics in multiple ways, and not just the anarchy that comes with unhierarchical ‘tags’.

    With a lot of searching on forums, I’ve managed to register the taxonomies, display them, include topics in the archives, and added inputs to the form to allow uses to select the relevant ones.

    But I’m totally stuck with saving the value from the checkboxes. You can tick the box, but nothing is saved. I’m guessing I need to use wp_set_object_terms()? and hook into bbp_new_topic() to save the terms? But I have no idea how to save the value from the checkboxes in there.

    Any ideas, tips, scorn, alternative suggestions are welcome. Do i need to learn more js and use AJAX to accomplish this? Or is this achievable with php and am I even close?

    // Add custom taxonomies to topic form
    
    add_action ( 'bbp_theme_after_topic_form_content', 'bbp_extra_fields');
    
    function bbp_extra_fields() {
    
    $value = get_post_meta( bbp_get_topic_id(), 'issue', true);
    	echo '<div id="custom-meta">';
    	echo'<fieldset>
            <legend>Issues</legend>';
    	$issues = get_terms('issue', array('hide_empty' => 0));
    	foreach ($issues as $issue) {
    	echo '<span><input type="checkbox" class="issue" for="issue" value="'.$issue->slug.'"></input><label>'.$issue->name.'</label></span>';
    	};
    	echo '</fieldset>';
    
    $value = get_post_meta( bbp_get_topic_id(), 'region', true);
    global $region;
    $region = get_terms('region', array('hide_empty' => 0));
    echo'<fieldset>
            <legend>Region</legend>';
    $regions = get_terms('region', array('hide_empty' => 0));
    foreach ($regions as $region) {
    echo '<span><input type="checkbox" class="issue" for="issue"value="'.$region->slug.'"><label>'.$region->name.'</label></span>';
    };
    echo '</fieldset></div>';
    };
    
    // Save the terms from the form
    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) {
    
      $post_id = get_the_ID();
      $category_id = $region->id;
      $taxonomy = 'region';
      wp_set_object_terms( $post_id, intval( $category_id ), $taxonomy );
    };
    
    #220209
    Back to Front
    Participant

    I was having a bunch of trouble with this too, 8 years later!

    I tried
    bbp_topic_excerpt('200')
    and
    wp_trim_words( bbp_topic_excerpt(), 200, '...' );
    But they wouldn’t actually change the excerpt length.

    Anyway I found this other function in bbpress files, that does the job.
    bbp_get_topic_excerpt($topic_id = 0, $length=200)

    #220207
    Steve Keller
    Participant

    Hey Robin,

    I tried to standardize the 79ers Forum page, per the Codex doc you referred me to, and it seems it helped. I followed all the settings instructions, and since the only people we want accessing the Forum page are registered users, I made each forum private. A couple of questions arose at that point. If I don’t hide the title of the page, why does the “Private:” appear twice before the page title? And second, how should the Forum Restriction be set, or where would I find info on what the settings, blocked, unblocked and hidden, actually do?

    Thanks,
    Steve

    #220201
    Robin W
    Moderator

    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

    add_filter ('bbp_reply_admin_links', 'rew_remove_reply') ;
    add_filter ('bbp_topic_admin_links', 'rew_remove_reply') ;
    
    function rew_remove_reply ($links) {
    	unset ($links['reply']) ;
    return $links ;	
    }
    #220187
    owebonada
    Participant

    Hello!

    I did everything that was indicated to me and the code did not work.

    #220180
    Robin W
    Moderator

    not sure, but try this (untested)

    add_filter ('bbp_get_user_edit_profile_url' , 'rew_remove_edit' ) ;
    
    function rew_remove_edit () {
    return ;
    }

    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

    #220177
    ViNOJ
    Participant

    Hey this doesn’t seems to work for me.
    Currently I am using following plugins.
    * bbPress
    * BuddyPress
    * Ultimate Member

    For all bbPress widgets and shortcode I am unable to force BuddyPress user profile pic.
    Can anyone please guide me what am I missing?

    #220175
    Robin W
    Moderator

    At a guess you might want to start by looking at

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

    and particularly items 3 & 5

    r083r7
    Participant

    I would like to edit the wording of some of the bbPress prompts and messages. As I understand this can be done using a language file as described here.
    https://codex.bbpress.org/getting-started/bbpress-in-your-language/

    I’m a little confused though since I am not actually changing from English to another language. Since I’m not changing languages what does the process look like? I went here to download the English version but there’s English (Canadian, UK, Australian, or South African versions) Which further ads to the confusion as to which language file I should download and edit 🙁

    Any idea on how to go about editing the bbPress prompts and messages in the same language I am using?

    https://translate.wordpress.org/projects/wp-plugins/bbpress/

    #220158
    owebonada
    Participant

    Hello. I would like to remove the Edit Profile option from the user menu. I am already using a plugin for editing user fields. I already removed it by CSS:

    .bbp-user-edit-link {
    display: none!important;
    }

    But for security, I need to completely remove this option.

    Is there a code for this?

    Thanks for your time.

    #220137

    In reply to: Username box different

    Robin W
    Moderator

    try adding this to the custom css part of your theme

    #bbpress-forums fieldset.bbp-form input[type="text"] {
    	height: inherit;
    }
    #220127
    Robin W
    Moderator

    you either want

    dashboard>settings>forums>anonymous if you want anyone to be able to post

    or add registration – bbpress uses wordpress registration, so anyone of then methods here will work.

    https://www.wpbeginner.com/beginners-guide/how-to-allow-user-registration-on-your-wordpress-site/

    there is also a bbpress registration login which includes registration and bbpress shortcodes

    [bbp-login] – Display the login screen.
    [bbp-register] – Display the register screen.
    [bbp-lost-pass] – Display the lost password screen.

    #220116

    In reply to: Shortcodes Forum

    dnfoz45
    Participant

    In the forum session, I can’t add shortcodes to the forum I created, and I can not edit it with Elementor

    blob:https://imgur.com/174e53bb-262d-4fde-8fed-528c34072e20

    #220087
    jeppot
    Participant

    Hello, I have installed BB press but my WP theme makes the font size very small.
    Is there any way to cutomize the BB press Fourm? With another plug in? I know nothing about CSS but I know where to paste custom CSS codes…

    This is how it looks:

    screen shot

    #220084

    In reply to: Update Topic On Reply

    Robin W
    Moderator

    ok, I now understand what 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

    add_action ('bbp_new_reply_post_extras' , 'rew_update_topic') ;
    add_action ('bbp_edit_reply_post_extras' , 'rew_update_topic') ;
    
    function rew_update_topic ($reply_id) {
    	$topic_id = bbp_get_reply_topic_id( $reply_id );
    	$topic_data = apply_filters( 'rew_update_topic', array(
    		'ID'           => $topic_id,
    	) );
    
    $topic_id = wp_update_post( $topic_data );
    }
    #220064

    Topic: Shortcodes Forum

    in forum Installation
    dnfoz45
    Participant

    I know I can add ShortCodes to the pages, but can I add them in the forums section? I add and nothing happens

    #220055
    acb93
    Participant

    About the “hidding stuff” the point is the [bbp-topic-index] not have the same header than the [bsp-display-topic-index] shortcode.

    [bbp-topic-index] have the “estandar bbpres header”

    [bsp-display-topic-index] have the image you are using in the page for the header (which is better)

    Regards.

    Adrià Calendario.

    #220053
    Robin W
    Moderator

    ok, that is part of the issue.

    I’m still looking, but whilst I think [bbp-topic-index] will protect against users seeing posts they shouldn’t, you might just want to check for your site.

    I added an extra filter on [bsp-display-topic-index] that does a double check, and this is causing the issue.

    I don’t actually think that filter is needed, but I am doing some extra checks to make sure, so just make sure [bbp-topic-index] is hiding stuff it should until I confirm.

    haddlyapis
    Participant

    great @robin-w , this is very useful.
    Unfortunately, I just copied and pasted your code into my functions.php file and it didn’t work.
    Took me 3 hours to figure out that the variable is spelled incorrectly within the bbp_get_spectator() function. Once I corrected this, it works!!
    Thx for your prompt help. All the best. This topic is now closed.

    #220041
    Robin W
    Moderator

    hmmm…interesting..

    the shortcode [bsp-display-topic-index] is from my stylepack plugin, whereas [bbp-topic-index] is from bbpress.

    If this was working ok, I’ll need to work out what has changed to make it not work 🙂

    #220040
    acb93
    Participant

    OK, I found the solution…

    Normally I use this shortcode:

    [bsp-display-topic-index]

    It fixes with this shortcode:

    [bbp-topic-index]

    So.. OK i found a solution but I really want to know what was the problem, I am just curious right now… If somebody finds an explanation, please post it!

    Regards.

    Adrià Calendario.

    #220032
    cristofayre
    Participant

    I set up my forums with the help of “bbp style pack”, but unfortunately had to deactivate it as it kept causing fatal errors stopping me from logging in, and sometimes throwing errors in admin panel. But now something weird has happened to the layout. It seems to be “double spacing” lines. I have removed bbpress and bbp style pack from the plugin area, and then reinstalled the plugins … but the same error persists.

    I have looked at the code, and there doesn’t seem to be any clues; all entries are still within their

    <ul id="bbp-forum-447" ...
    </ul>
    <p><!-- #bbp-forum-447 --></p>

    So no clues there. Anyone any ideas?

    double spacing error on page

    Robin W
    Moderator

    Sorry, I’m being brain dead this afternoon.

    Spectate is a capability shared by many roles, so the code above is rubbish !

    Try this

    function forum_user_is_spectator(){
    if ( is_bbpress() && is_user_logged_in() ) {
        $user_ID = get_current_user_id() ;
        $role = bbp_get_user_role( $user_id );
        if ($role == bbp_get_spectator_role()){
           wp_enqueue_script( 'spectator-js', get_template_directory_uri() . '/js/spectator.js', array(), false, true);
           }
        }
    }
Viewing 25 results - 1,701 through 1,725 (of 32,466 total)
Skip to toolbar