Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,451 through 5,475 (of 32,505 total)
  • Author
    Search Results
  • #181862
    Robin W
    Moderator

    ok, could be lots of things wrong

    try https://codex.bbpress.org/getting-started/troubleshooting/

    #181859
    benklocek
    Participant

    Here’s the list of names as set by default: http://hookr.io/functions/bbp_get_dynamic_roles/

    You should be able to use:

    $roles = bbp_get_dynamic_roles();
    $print_r( $roles );

    to see what the names of your roles are.

    #181858
    u_Oi
    Participant

    Thanks for the code @benklocek

    I created a custom role with this code:

    //Custom Role Admin
    function add_custom_role( $bbp_roles ) {
     $bbp_roles['my_custom_role1'] = array(
    'name' => 'Admin',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as admin
    
    );
    
    return $bbp_roles;
     }
     add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );

    and I can’t change the role name with @robkk code. But I did with your code. So I wonder what should I change to apply your code for all other roles, participant, moderator?

    Thanks!

    I tried couple ways but without success. Ex:

    function my_custom_roles( $role, $user_id ) {
    	if( $role == 'Participant' )
    		return 'Participante';
    
    	return $role;
    }
    
    add_filter( 'bbp_get_user_display_role', 'my_custom_roles', 10, 2 );
    #181833
    dropshot
    Participant

    Hi,

    According to codex https://codex.bbpress.org/getting-started/before-installing/bbpress-user-roles-and-capabilities/ Moderators should be able to publish and edit forums.

    This seems to be a bug cause they can’t. I’ve been reading a bunch of topics now and it seems like this has been a bug for more than FOUR YEARS. Why hasn’t codex been updated??

    I’ve seen hints pointing out that moderators can actualy publish forums on front end with shortcode [bbp-forum-form] – this works but they can still not edit forums.

    I’ve tried to edit the keymaster role and disable access to global forum settings but this didn’t work. There are a bunch of capabilities for every single action of bbpress. And then there is on huge capability for a monster amount of actions. This capability is keep_gate. When I disabled that for the keymaster role I managed to disable acces to global forum settings but acces to publish and edit forums was also disabled.

    I want to achieve a role that has ALL the keymaster capabilities except from access to admin pages bbpress (global forum settings) and bbp-repair.

    Is there anyway to do this?

    Thanks!

    #181823
    Pascal Casier
    Moderator

    Hi,
    Plugin is on https://wordpress.org/plugins/bbp-api/ but let me see to copy the code to GitHub this weekend.

    @jpvanmuijen
    on 2 of my forums it seems to give stats, but we should have that discussion at the support forum for bbp-api 🙂
    Pascal.

    #181809
    tpsr51
    Participant

    I am trying to replace all the topics in a specific forum with the new topic form whenever I press on the Create New Topic button.
    Then I tried to ajaxify it using the shortcode [bbp-topic-form], but the form didn’t showed up…

    In the functions.php I have added this:

    
    wp_enqueue_script( 'script', get_stylesheet_directory_uri() . '/js/topicButton.js', array ( 'jquery' ), 1.1, true);
    wp_localize_script( 'script', 'script', array(
    	'ajaxurl' => admin_url( 'admin-ajax.php' )
    ));
    ..
    ..
    add_action('wp_ajax_script', 'scriptfunc');
    add_action('wp_ajax_nopriv_script', 'scriptfunc');
    function scriptfunc() {
    	echo do_shortcode("[bbp-topic-form]");
    	die();
    } 

    The ajax file

    (function($) {
    	
    		function find_forum_id() {
    			var forumidval = document.getElementsByTagName("article")[0].id;
    			forumidval = forumidval.replace(/\D/g,'');
    			return parseInt( forumidval );
    		}
    	
    		$(document).on( 'click', '.bbp-new-topic-button', function( event ) {
    			event.preventDefault();
    			
    			forumid = find_forum_id();
    			
    			$.ajax({
    				url: ajaxurl,
    				type: 'post',
    				data: {
    					action: 'scriptfunc',
    					forumid: forumid
    				},
    				beforeSend: function() {
    					$('.bbp-topics').remove();
    				},
    				success: function( html ) {
    					$('article').append( html );
    				}
    			})
    		
    		});
     })(jQuery);
    #181804
    mapofemergence
    Participant

    @jpvanmuijen I started looking at how bbPress works under the hood just recently, so I’m learning these things just by looking into the code and trying to guess. I’m glad I didn’t give a wrong hint 🙂

    I’m not sure if there’s any higher-level logic wrapping this in bbPress functions, though; any experienced bbPress guy is more than welcome to expand on this: I’d be happy to know if there’s a better way.

    Hopefully, with the REST API this sort of tasks will become pretty straight forward 🙂

    #181799
    mapofemergence
    Participant

    @jpvanmuijen
    Assuming $single_item[‘id’] contains the id of the reply, this should do what you want:
    $topic_id = get_post( $single_item[‘id’] )->post_parent;

    #181797
    mapofemergence
    Participant

    Hi everybody,
    I was actually starting a topic about this, a few days ago, but my post contains a bunch of links (more than 3) to help contextualize the discussion and it’s still pending approval.
    If moderators can help with that, the link to the topic is:
    https://bbpress.org/?post_type=topic&p=181440
    (I hope it’s not a problem to link it here; in case, feel free to delete or edit this reply)

    I was trying to start writing a first version of a REST API too, as I missed the latest posts by Pascal. Also, I looked for existing code here:
    https://github.com/ePascalC/bbp-API
    but found only empty files. Am I missing something?

    Anyway, I downladed the plugin and checked the code there.
    Mine differs a bit as I was using BP-REST as a starter: I saw they had an extensive discussion about how to frame the whole work and structure it for the longer term, so I thought it was a good idea to take that into consideration.

    If you think we might join efforts on this, let me know; I have limited time to invest on this but I’d be pleased to give my contribution whenever I can.

    Cheers,
    s t e

    #181796
    Fuskeduske
    Participant

    Hi RotiSoft,

    The code that i supplied in a pastebin, should hopefully solve the issue.

    If not, the problem could rely in another plugin, and i may therefore ask you to disable them all, and enable them one after one. 🙂

    -Fuske

    #181786
    Robin W
    Moderator

    ok, it could be several places

    lets start with

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

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

    can you look in that file for lines of code that start with

    add_action
    
    

    and list any that you see here

    #181780
    Robin W
    Moderator

    sorry, missed that you were using wp tweaks which adds this sidebar. This plugin has no support, and doesn’t work with several themes by the look of it.

    suggest you try

    https://en-gb.wordpress.org/plugins/widget-logic/

    the logic for forum pages is

    is_bbpress()

    for a widget to only show on forum pages

    and to exclude from forum pages is

    !is_bbpress()

    #181772
    dropshot
    Participant

    @JohnJamesJacoby

    The problem is if you create a page with the same slug as your forum index and insert the forum index shortcode, this page will just be a page that happens to contain bbpress content. It isn’t a real bbpress page.

    If you would like your index page (mysite.com) as your forum index how can you make that a real forum page? NOT just a page that contains bbpress content.

    You can’t set your forum root index to nothing cause this will make default value (forums) to reappear. Of course you can 301 redirect /forums to index page. But as mentioned, this will display a page with forum content. NOT a real forum page.

    Appreciate any kind of suggestions.

    #181766
    jpvanmuijen
    Participant

    Hi, this topic has been very helpful in getting the latest replies, thanks Barry & Robin!
    I’m trying to get the topic of the last five replies and later on construct the URL using the topic URL and reply # (kinda like Robin’s shortcode plugin does), but I can’t figure out how to do this.
    I changed $author_id = get_post( $single_item[‘id’] )->post_author to $topic_id = get_post( $single_item[‘id’] )->topic hoping it would return the topic ID, but no luck. Is there a way to retrieve how to target this field?
    Thanks again!

    #181755
    phil49
    Participant

    Hello Robin,

    Thanks for the reply again.

    I pasted the code in the additional Custom CSS section in WordPress, indeed I immediately noticed that page width was wider by about 1/5.

    However, the “bbpress.php” template was… not affected ! 🙁

    I tried copying the code in the style.css in the child theme previously created, but same thing no wide page again !

    As I noticed since the beginning, ALL the site pages, I mean the one managed by this epoymous section in WordPress ARE affected by any additional CSS code, BUT NO page in the forum section with the “bbpress.page” Template are concerned by any modification !

    It’s as if so long as there’s no modification on the bbpress.php code or it’s CSS, nothing could happen !

    Yet, as mentioned earlier, in the child theme I’ve created, I added as explained in this forum : http://www.designbombs.com/master-twenty-seventeen-wordpress-theme/ , the following files :

    1 style.css file
    1 page-full-width.php
    1 function.php

    Was there any other operation I should have done ?

    For instance, should I try something with the Bbpress-style-pack I’ve installed a few weeks ago for another purpose but that includes a CSS section ?

    I don’t really understand what I’m supposed to do, the explanation is not quite clear to me !

    It’s explained that it will create a “bspstyle.css” file but what will be the impact on the whole site as I just want to alter page width ONLY on the forum pages, the other pages have the adequate width !

    Kind regards,

    Philippe

    #181748
    Robin W
    Moderator

    ok, put this in the custom css

    .single-post:not(.has-sidebar) #primary, 
    .page.page-one-column:not(.twentyseventeen-front-page) #primary, 
    .archive.page-one-column:not(.has-sidebar) .page-header,
     .archive.page-one-column:not(.has-sidebar) #primary {
      max-width: 100% !important;
    }
    

    you may need to play with it if it affects other parts of your site.

    if you don’t know how to do this – come back

    #181703
    Fuskeduske
    Participant

    Hi RotiSoft,

    You can change bbp_get_forum_last_reply_title to bbp_get_forum_last_topic_title, to get rid of the reply-to tag. However this will still make problems, while for example deleting or trashing a topic.

    Robin gave me the following code, it should show the latest title without “reply-to” tag: http://pastebin.com/raw/jY5hSPPp

    This should be used together with:

    <?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?>
    <?php bbp_forum_freshness_link(); ?>
    <?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?>

    However you might need to adjust a little due to the way of your theme setup.

    -Fuske

    #181699
    Tamas Rottenbacher
    Participant

    Hi @fuskeren!

    I don’t use bbPress style pack plugin.
    The theme use that code for call the last active topic display:
    <a rel="internal" href="<?php bbp_forum_last_reply_url(); ?>" title="Legutóbbi aktív téma: <?php bbp_forum_last_topic_title(); ?>"><?php bbp_forum_last_topic_title(); ?></a>
    and under that: (the second line, the time and user)

    <?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?>
    <?php bbp_forum_freshness_link(); ?>
    <?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?>

    I’m tried add that code:

        <?php
        	$forum_id  = bbp_get_forum_id( $forum_id );
    		$active_id = bbp_get_forum_last_active_id( $forum_id );
    	?>
        <?php echo bbp_get_forum_last_reply_url( $forum_id ); ?><br />
    	<?php echo bbp_get_forum_last_reply_title( $forum_id ); ?>

    But that add “Comment:” or “Reply:” because that is the reply title, not the last active topic.

    #181668
    Fuskeduske
    Participant

    Hi Crew,

    I have just tried running the code on my own test invironment, and i can see, that the code, does not seems to work.

    I do however not have enough knowhow to help you further.

    I am glad to see, that you got your functions file to work atleast.

    #181658
    Fuskeduske
    Participant

    Hi Crewockeez,

    1. Line of Robins code appears to be broken, can you try replacing it with:

    add_filter ('bbp_filter_anonymous_post_data' , 'rew_filter_anonymous_post_data' 10, 2);

    #181648
    Fuskeduske
    Participant

    Hi RotiSoft,

    Could you provide me with a description of how you’re displaying the titles?

    I’ve just recently had a longer correspondence with RobW, about what i think is the same issue.

    He told me as follows:

    Basically a category holds the last active ID of its sub forums, and each sub forum also holds its last active ID. But deleting a sub forum topic seems to get the category last active ID wrong.

    I see that he just updated he’s bbpress style pack plugin, with a hotfix for this issue,
    while he gave me the snippet of the code used for the fix, it does not work if your tweak is done if you’re using code as in this: https://bbpress.org/forums/topic/freshness-link/

    I don’t think Robin would mind me sharing the code snippet, as he implemented it in he’s free plugin, but as requested i would like to know how you’re displaying it.

    -Fuske

    #181647
    Robin W
    Moderator

    lots of shortcodes available for putting into pages and posts

    Shortcodes

    and I have additional shortcodes in my style pack plugin

    https://wordpress.org/plugins/bbp-style-pack/

    #181637
    crewockeez
    Participant

    i try insert new code. not work.

    #181623
    Robin W
    Moderator

    this – it has some parts changed !!

    add_filter ('bbp_filter_anonymous_post_data' , 'rew__filter_anonymous_post_data' 10, 2) ;
    
    function rew_filter_anonymous_post_data( $retval, $r  ) {
    	// Filter variables and add errors if necessary
    	$r['bbp_anonymous_name'] = apply_filters( 'bbp_pre_anonymous_post_author_name',  $r['bbp_anonymous_name']  );
    	if ( empty( $r['bbp_anonymous_name'] ) )
    		bbp_add_error( 'bbp_anonymous_name',  __( '<strong>ERROR</strong>: Invalid author name submitted!',   'bbpress' ) );
    
    	// Website is optional
    	$r['bbp_anonymous_website'] = apply_filters( 'bbp_pre_anonymous_post_author_website', $r['bbp_anonymous_website'] );
    
    	// Return false if we have any errors
    	$retval = bbp_has_errors() ? false : $r;
    
    	// Finally, return sanitized data or false
    	return apply_filters( 'rew_filter_anonymous_post_data', $retval, $r );
    }
    #181613
    crewockeez
    Participant

    i insert code on functions.php on my team

    add_filter ('bbp_filter_anonymous_post_data' , 'rew__filter_anonymous_post_data' 10, 2) ;
    
    function rew_filter_anonymous_post_data( $retval, $r  ) {
    	// Filter variables and add errors if necessary
    	$r['bbp_anonymous_name'] = apply_filters( 'bbp_pre_anonymous_post_author_name',  $r['bbp_anonymous_name']  );
    	if ( empty( $r['bbp_anonymous_name'] ) )
    		bbp_add_error( 'bbp_anonymous_name',  __( '<strong>ERROR</strong>: Invalid author name submitted!',   'bbpress' ) );
    
    	// Website is optional
    	$r['bbp_anonymous_website'] = apply_filters( 'bbp_pre_anonymous_post_author_website', $r['bbp_anonymous_website'] );
    
    	// Return false if we have any errors
    	$retval = bbp_has_errors() ? false : $r;
    
    	// Finally, return sanitized data or false
    	return apply_filters( 'bbp_filter_anonymous_post_data', $retval, $r );

    upload file functions.php on server. open site error.

Viewing 25 results - 5,451 through 5,475 (of 32,505 total)
Skip to toolbar