Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,351 through 4,375 (of 32,481 total)
  • Author
    Search Results
  • #191346
    mar6co
    Participant

    Hi bbpress friends,

    I want to combine the shortcode with a href html command. At the moment iam doing this:

    <td>
    
    [caption id="attachment_238" align="aligncenter" width="150"]<a href=[bbp-topic-form forum_id=659]><img class="wp-image-238 size-thumbnail" src="http://hilf-mir-aus.de/wp-content/uploads/2018/03/internet.png" alt="" width="150" height="150" /></a> Internet & Technik[/caption]
    </td>

    Any guesses, its not working…

    #191274
    tvirtual
    Participant

    I am looking to do just what the original poster was looking for:
    When a user creates a new topic, the menu assigned to this new topic should be the same menu as the forum. It is currently using the default WordPress menu. Can someone point me to the right code and where to add it to automatically assign the right menu to new topics? I appreciate your help.

    #191251
    hanza3
    Participant

    I’m looking to do something relatively simple – move the tags in a single topic post up under the title, rather than under the search bar – their default position.

    I’ve been going through to files to try and figure out where this code would be but since there are so many files in default > bbpress I was hoping to get some direction on where to find the relevant code.

    Thanks!

    #191244
    Cars10
    Participant

    When you enter a forum, a list of Topics is shown, but the table header says “Forum” instead of “Topics”. I have checked the source code and _e(“Forum”, “bbPress”) is used, and probably elsewhere as well.
    There does not seem to be a way to properly rename each label in bbPress.

    1. I think the label is wrong as we list Topics and not Fora
    2. Could bbPress not facilitate to rename more labels? Our customer even wants the label to be CATEGORIES rather than even Topics.

    I know, I could add a JS per page plugin and do a jQuery to renbame, but that ius of course the LAST resort – bad design.

    Thanks for any hints to achieve or a fix on bbPress (e.g. adding a filter for certain such areas)

    Carsten

    #191192
    Robin W
    Moderator

    The message in the .po is

    ‘This user…’

    but in your example it is

    ‘you are…’

    The code should be translated

    but you can just put this in your functions file

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'You are not currently subscribed to any forums' ) {
    	$translated_text = 'new text';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    and change ‘new text’ to whatever it should say

    #191160
    erich199
    Participant

    Hi @robin-w,

    I managed to get this to work with this code
    I needed a custom role and I also needed to reorder it in my legend. This code made it work

    //BBpress Custom Roles // 
    function add_role_caps_filter( $caps, $role )
    {
        /* Only filter for roles we are interested in! */
        if( $role == 'bbp_lead' )
            $caps = custom_capabilities( $role );
     
        return $caps;
    }
     
    add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 );
     
    function custom_capabilities( $role )
    {
        switch ( $role )
        {
     
            /* Capabilities for 'tutor' role */
            case 'bbp_lead':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => true,
                    'throttle'              => false,
                    'view_trash'            => false,
     
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => true,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => true,
                    'delete_topics'         => true,
                    'delete_others_topics'  => true,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => true,
                    'delete_replies'        => true,
                    'delete_others_replies' => true,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }
    // End BBpress Custom Roles //
    
    //BBpress Rename Roles //
    add_filter( 'bbp_get_dynamic_roles', 'ntwb_bbpress_custom_role_names' );
    function ntwb_bbpress_custom_role_names() {
        return array(
    		// Keymaster
    		bbp_get_keymaster_role() => array(
    		'name' => 'Administrator',
    		'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
    		),
    		'bbp_lead' => array(
            'name' => 'Community Lead',
            'capabilities' => custom_capabilities( 'bbp_lead' )
            ),
    		// Moderator
    		bbp_get_moderator_role() => array(
    		'name' => 'Moderator',
    		'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
    		),
    		// Participant
    		bbp_get_participant_role() => array(
    		'name' => 'Member',
    		'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
    		),
    		// Spectator
    		bbp_get_spectator_role() => array(
    		'name' => 'Spectator',
    		'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() )
    		),
    		// Blocked
    		bbp_get_blocked_role() => array(
    		'name' => 'Blocked',
    		'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() )
    		)
    	);
    }
    //BBpress Rename Roles End //
    Robin W
    Moderator

    This code will limit the topic title to 80 or whatever number you set $length to

    Put it in your child theme functions.php file

    add_filter ('bbp_new_topic_pre_title' , 'rew_limit_topic_length' ) ;
    add_filter ('bbp_edit_topic_pre_title' , 'rew_limit_topic_length' ) ;
    
    function rew_limit_topic_length  ($topic_title) {
    	$length = 80 ;
    	if (strlen($topic_title) > $length) {
    		$topic_title = substr($topic_title, 0, $length);
    	}
    return $topic_title ;
    }
    Robin W
    Moderator

    The only solution I found was 8 years old

    may well still be valid – link to this please

    #191143
    Robin W
    Moderator

    can you say which shortcode(s) you are using on that page

    #191141
    Robin W
    Moderator

    The 2nd function assumes that you only have the default roles.

    Put this first and it should work ie

    //BBpress Rename Roles //
         /* BBPress Renaming Roles */
        add_filter( 'bbp_get_dynamic_roles', 'ntwb_bbpress_custom_role_names' , 1);
        function ntwb_bbpress_custom_role_names() {
        return array(
        // Keymaster
        bbp_get_keymaster_role() => array(
        'name' => 'Administrator',
        'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
        ),
        // Moderator
        bbp_get_moderator_role() => array(
        'name' => 'Moderator',
        'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
        ),
        // Participant
        bbp_get_participant_role() => array(
        'name' => 'Member',
        'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
        ),
        // Spectator
        bbp_get_spectator_role() => array(
        'name' => 'Spectator',
        'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() )
        ),
        // Blocked
        bbp_get_blocked_role() => array(
        'name' => 'Blocked',
        'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() )
        ));}
    //BBpress Rename Roles End //
    
    //BBpress Custom Roles // 
    function add_new_roles( $bbp_roles )
    {
        /* Add a role called tutor */
        $bbp_roles['bbp_lead'] = array(
            'name' => 'Community Lead',
            'capabilities' => custom_capabilities( 'bbp_lead' )
            );
     
        return $bbp_roles;
    }
     
    add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 );
     
    function add_role_caps_filter( $caps, $role )
    {
        /* Only filter for roles we are interested in! */
        if( $role == 'bbp_lead' )
            $caps = custom_capabilities( $role );
     
        return $caps;
    }
     
    add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 );
     
    function custom_capabilities( $role )
    {
        switch ( $role )
        {
     
            /* Capabilities for 'tutor' role */
            case 'bbp_lead':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => true,
                    'throttle'              => false,
                    'view_trash'            => false,
     
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => true,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => true,
                    'delete_topics'         => true,
                    'delete_others_topics'  => true,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => true,
                    'delete_replies'        => true,
                    'delete_others_replies' => true,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }
    // End BBpress Custom Roles //
    Robin W
    Moderator

    yes, it makes a gravity post and a topic post.

    You could code to remove the latter as part of this function by adding further code, but in all honesty I wouldn’t worry, you’d need to be creating thousands of topics a month to make an impact on performance

    erich199
    Participant

    @robin-w ,
    Thanks so much for the follow up. I looked over the docs last night and saw that. This is really awesome.

    I do have one question.

    When I’m posting a topic from Gravity Forms, for some odd reason it is making duplicate post. Does this happen when you use the code?

    #191096
    nazharukky
    Participant

    You can use Yoast plugin to display breadcrumb !

    wp-dashboard –> Yoast –> search appearance –> breadcrumbs and then aticate it.

    later on you will have to add a code to header.php

    Full tutorial from here. if you have any question please don’t hesitate to ask me.

    Robin W
    Moderator

    to only have it for a specified form, you add the form id

    eg

    add_action( 'gform_after_submission_5', 'set_post_content', 10, 2 );

    will make it fire only for gravity form ID 5

    #191087
    Robin W
    Moderator

    try this in your custom css

    .container {
    	width: 100%;
    }
    
    .et_pb_widget {
    word-wrap : normal ;
    }
    
    #sidebar .bbp-login-form label {
    	width: auto;
    }
    #191078
    semperaye
    Participant

    Shouldn’t there be some functions code in there somewhere? I’m using the php code snippets plugin so I don’t really know how to code these things i’m just copying and pasting into that…

    #191077
    semperaye
    Participant

    I’m still getting “page not found” with abufrank’s code.

    #191074

    In reply to: Creating Custom Search

    Adolfo Augusto
    Participant

    It was necessary create file bbpress.php, copy the files for folder(in my theme) bbpress: content-search, loop-search and pagination-search.

    how this post

    Getting Started in Modifying the Main bbPress Template

    for tamplate customized.

    #191059
    Robin W
    Moderator

    It could be coded, but it would be an hours work and several calls. A plugin that relies on bbpress should check that when loaded, but whilst I know most of mine do, I couldn’t swear that they all do !!

    #191057
    erich199
    Participant

    Hello,
    I’m trying to rename the current roles as well as ADD new roles. When I add the filter to change the current role name, it doesn’t add the new user role I’ve added. If I remove that code, then the new user role shows up.

    This is the code I’m using.

    //BBpress Custom Roles // 
    function add_new_roles( $bbp_roles )
    {
        /* Add a role called tutor */
        $bbp_roles['bbp_lead'] = array(
            'name' => 'Community Lead',
            'capabilities' => custom_capabilities( 'bbp_lead' )
            );
     
        return $bbp_roles;
    }
     
    add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 );
     
    function add_role_caps_filter( $caps, $role )
    {
        /* Only filter for roles we are interested in! */
        if( $role == 'bbp_lead' )
            $caps = custom_capabilities( $role );
     
        return $caps;
    }
     
    add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 );
     
    function custom_capabilities( $role )
    {
        switch ( $role )
        {
     
            /* Capabilities for 'tutor' role */
            case 'bbp_lead':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => true,
                    'throttle'              => false,
                    'view_trash'            => false,
     
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => true,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => true,
                    'delete_topics'         => true,
                    'delete_others_topics'  => true,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => true,
                    'delete_replies'        => true,
                    'delete_others_replies' => true,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }
    // End BBpress Custom Roles //
    
    //BBpress Rename Roles //
         /* BBPress Renaming Roles */
        add_filter( 'bbp_get_dynamic_roles', 'ntwb_bbpress_custom_role_names' );
        function ntwb_bbpress_custom_role_names() {
        return array(
        // Keymaster
        bbp_get_keymaster_role() => array(
        'name' => 'Administrator',
        'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
        ),
        // Moderator
        bbp_get_moderator_role() => array(
        'name' => 'Moderator',
        'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
        ),
        // Participant
        bbp_get_participant_role() => array(
        'name' => 'Member',
        'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() )
        ),
        // Spectator
        bbp_get_spectator_role() => array(
        'name' => 'Spectator',
        'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() )
        ),
        // Blocked
        bbp_get_blocked_role() => array(
        'name' => 'Blocked',
        'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() )
        ));}
    //BBpress Rename Roles End //
    #191054

    In reply to: list of all functions

    Nate Zander
    Participant

    Bump. Would love an actually complete codex to help guide theme development.
    https://codex.bbpress.org/developer/ 🙁

    #191016
    Robin W
    Moderator

    ok, so

    1. Save the attached code to your pc, as a new file called reply.js
    2. Create a directory on your theme called ‘js’, and copy the renamed file reply.js to it, so that you end up with wp-content/themes/%my-theme%/js/reply.js

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

    Let me know if this works

    addReply = {
    	moveForm : function(replyId, parentId, respondId, postId) {
    		var t = this, div, reply = t.I(replyId), respond = t.I(respondId), cancel = t.I('bbp-cancel-reply-to-link'), parent = t.I('bbp_reply_to'), post = t.I('bbp_topic_id');
    
    		if ( ! reply || ! respond || ! cancel || ! parent )
    			return;
    
    		t.respondId = respondId;
    		postId = postId || false;
    
    		if ( ! t.I('bbp-temp-form-div') ) {
    			div = document.createElement('div');
    			div.id = 'bbp-temp-form-div';
    			div.style.display = 'none';
    			respond.parentNode.insertBefore(div, respond);
    		}
    
    		reply.parentNode.insertBefore(respond, reply);
    		if ( post && postId )
    			post.value = postId;
    		parent.value = parentId;
    		cancel.style.display = '';
    
    		cancel.onclick = function() {
    			var t = addReply, temp = t.I('bbp-temp-form-div'), respond = t.I(t.respondId);
    
    			if ( ! temp || ! respond )
    				return;
    
    			t.I('bbp_reply_to').value = '0';
    			temp.parentNode.insertBefore(respond, temp);
    			temp.parentNode.removeChild(temp);
    			this.style.display = 'none';
    			this.onclick = null;
    			return false;
    		}
    				
    		try { t.I('bbp_reply_content').focus(); }
    		catch(e) {
    			
    
    			
    			
    		}
    		
    		
    
    		return false;
    	},
    
    	I : function(e) {
    		tinymce.execCommand('mceFocus',false,'bbp_reply_content');
    	}
    	
    	
    	
    }
    #191015
    Robin W
    Moderator

    ok, so

    1. Save the attached code to your pc, as a new file called reply.js
    2. Create a directory on your theme called ‘js’, and copy the renamed file reply.js to it, so that you end up with wp-content/themes/%my-theme%/js/reply.js

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

    Let me know if this works

    addReply = {
    	moveForm : function(replyId, parentId, respondId, postId) {
    		var t = this, div, reply = t.I(replyId), respond = t.I(respondId), cancel = t.I('bbp-cancel-reply-to-link'), parent = t.I('bbp_reply_to'), post = t.I('bbp_topic_id');
    
    		if ( ! reply || ! respond || ! cancel || ! parent )
    			return;
    
    		t.respondId = respondId;
    		postId = postId || false;
    
    		if ( ! t.I('bbp-temp-form-div') ) {
    			div = document.createElement('div');
    			div.id = 'bbp-temp-form-div';
    			div.style.display = 'none';
    			respond.parentNode.insertBefore(div, respond);
    		}
    
    		reply.parentNode.insertBefore(respond, reply);
    		if ( post && postId )
    			post.value = postId;
    		parent.value = parentId;
    		cancel.style.display = '';
    
    		cancel.onclick = function() {
    			var t = addReply, temp = t.I('bbp-temp-form-div'), respond = t.I(t.respondId);
    
    			if ( ! temp || ! respond )
    				return;
    
    			t.I('bbp_reply_to').value = '0';
    			temp.parentNode.insertBefore(respond, temp);
    			temp.parentNode.removeChild(temp);
    			this.style.display = 'none';
    			this.onclick = null;
    			return false;
    		}
    				
    		try { t.I('bbp_reply_content').focus(); }
    		catch(e) {
    			
    
    			
    			
    		}
    		
    		
    
    		return false;
    	},
    
    	I : function(e) {
    		tinymce.execCommand('mceFocus',false,'bbp_reply_content');
    	}
    	
    	
    	
    }
    #191011
    Robin W
    Moderator

    yes add this to your child theme function file

    add_filter ('bbp_get_do_not_reply_address', 'rew_no_reply') ;
    function rew_no_reply () {
    Return 'xxx@yyy.com' ;
    }

    changing xxx@yyy.com to wehatever address you want

    #190997
    discusspf
    Blocked

    Hi, I am using bbPress 2.5 here: https://discusspf.com/community/

    My problem is occurring as follows: I have the forum set up so it displays the recent topics as a shortcode on a page for the forum. This works fine for me (keymaster) and displays a create topic box at the bottom of the forum. However, for normal users it displays that they cannot create topics on the forum index, but when they navigate to a particular forum area they are able to create topics then. What is causing this issue and how might I fix it?

    Thanks in advance.

Viewing 25 results - 4,351 through 4,375 (of 32,481 total)
Skip to toolbar