Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,051 through 1,075 (of 32,458 total)
  • Author
    Search Results
  • Robin W
    Moderator

    just loaded that code to my test site, and it runs fine.

    suggest you delete and try it again

    rinh
    Participant

    Hi!
    I tried a snippet from this page: https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#24-show-status-labels-for-bbpress-topics
    to get a label or icon for sticky topics.

    function rk_sticky_topics() {
     
       if ( bbp_is_topic_sticky() && !bbp_is_topic_closed() )
          echo '<span class="sticky">[Sticky]</span>';
    }
     
    add_action( 'bbp_theme_before_topic_title', 'rk_sticky_topics' );

    I get a fatal error with syntax error unexpected ‘;’ on the line starting with if.

    Thank you in advance

    #230409
    cathyskach
    Participant

    I tested this on our staging site. Switching out for the Twenty Twenty theme, the dates populated, so I presume the problem to be the theme. What advice do you have for a fix?

    PS: I tried taking out the short code on the member-only (parent) page to allow you access to the forum but it seems to still want a password.

    Cathy

    #230408
    coopersita
    Participant

    I haven’t made much progress. I tried adding a rewrite rule and changing from ‘users’ from ‘members’ to avoid rules clashing:

    function bbp_custom_author_rewrite(){
        add_rewrite_rule(
            "^forums/members/([^/]*)$",
            'index.php?bbp_user=$matches[1]',
            "top"
        );
    }
    add_action( 'init', 'bbp_custom_author_rewrite', 10);

    But I think I’m missing the part where the template uses the query var to load the correct content because I keep getting 404 errors.

    #230405
    chenryahts
    Participant

    BBpress keeps loading the empty index.php in the TwentyTwentyTwo Child theme I’m working on, which loads a WSOD.

    I can’t get any of the template filters to use one of the html files, so temporarily have it working with the index.php file as:

    wp_head();
    block_header_area();
    block_template_part( 'page-inner' );
    wp_footer();
    block_footer_area();

    And… its almost all working? But, this can’t be the right way to get it to use the new default page template in the block theme.

    Thoughts? Ideas? How can I get it to use the new theme templates?

    Thanks!

    #230370
    Robin W
    Moderator

    ok, so to restrict :

    dashboard>forums>all forums>edit the forum you want>right hand side you will find a box called ‘Forum Moderators’ add his name

    Then make him a participant.

    see thsi for role fresponsibilities

    bbPress User Roles and Capabilities

    I’m not sure that this wil let him create forums – but I suppose I would ask if he is that dangerous, maybe that’s something he should be asking you to do 🙂

    gtatar
    Participant

    Robin, I applied your code change. Will report results once I have them.

    #230348
    Robin W
    Moderator

    just taken a look, that theme is a ‘block theme’ the new way that themes are written.

    If you want to use it. come back and I’ll give you some code to try

    #230340
    Robin W
    Moderator

    ok, so page is now ok, but suspect from

    https://middleagedwitch.com/Forums/forum/general-discussion/

    that you have a capital F somewhere

    so either your permalink is ‘Forums’ or in

    dashboard>settings>forums>root forum slug you have ‘Forums’

    it needs to be lower case ‘forums’

    #230339
    Robin W
    Moderator

    ok, so I’m guessing you have a page called ‘Forum’ in which you have put the shortcode

    [bbp-forum-index]

    If so change the permalink on this page from ‘forum’ to ‘forums’ and it should all work

    ppoirier1995
    Participant

    Hi there,

    I’m trying to find a solution to the problem of participants being able to remove single topic tags by simply removing them from the “Tags” input field on the reply-to form.

    I’ve found this thread that clearly explains the issue

    Topic tags deleted by other participants


    and offers a solution that is unfortunately not working on my end.

    My form-reply.php currently has this line:
    <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() )) : ?>
    which I tried to replace with:
    <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) && current_user_can('moderate') ) : ?>
    to no avail.

    Has anyone solved this issue? Would love some guidance here! 🙂

    #230304
    coopersita
    Participant

    Is there a way to redirect all profile page links so they use the user id, instead of user login/nicename? Some users have their email as their username, so we want to hide it.

    So to go from
    /forums/users/{login}

    to
    /forums/users/{id}

    I was able to change the URLs so they point to the right place:

    function bbp_custom_author_link(  $url,  $user_id,  $user_nicename){
                $url = site_url()."/forums/users/".$user_id;
    	   return $url;
        }
        add_filter( 'bbp_get_user_profile_url', 'bbp_custom_author_link', 10, 3);

    But once you click on the link, you end up in a 404.

    janecarole
    Participant

    Thank you, Robin, that worked. So grateful for you! Please provide me the link you gave me before (on a different topic) so I can thank you meaningfully ($) for your research/coding for me!

    I ended up creating a link on my “Member Profile” page to the new “profile” page you had me create. (I did this so the user would still see WP-Members “Member Profile” page with its unique information.) I used Code Snippets to add your code.

    Not that you need to know this, but: Right after making this change, I had to restore my site because a plugin update (WP-Crontrol) broke the site, and it wouldn’t load. The restore fixed that problem, but caused a problem with my Wordfence connection which messed up my site log-in. It took a while to figure that one out, but after disconnecting and reconnecting Wordfence, I am back to normal (except for needing to make your change again 🙁 …). Plan to do that later.

    Robin W
    Moderator

    or might not – I’m trying to look at this in limited free time and trying not to get sucked into too deeper a code dive 🙂

    #230292
    rinh
    Participant

    Sorry for double post, but I got the toggle button back by adding wp_adv, as well as the image button. Full code below if anyone needs it too

    function bbp_enable_visual_editor( $args = array() ) {
      
        $args['tinymce'] = array('toolbar1' => 'formatselect, bold, italic, underline, bullist, numlist, blockquote, alignleft, aligncenter, alignright, link, image, wp_adv');
        $args['quicktags'] = false;
        $args['teeny'] = false;
    
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    For toolbar 2 I hid the unwanted buttons with CSS. I’m happy with the results 🙂 Still curious though if toolbar 2 can be customised, but it’s nothing necessary.

    #230290
    rinh
    Participant

    Hi,
    I’m trying to customise the toolbar in TinyMCE.

    Initially I just enabled the advanced one:

    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        $args['teeny'] = false;
        $args['quicktags'] = false;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    I thought of adding a button for underline and it led to trying to get only what I needed in one toolbar:

    function bbp_enable_visual_editor( $args = array() ) {
      
        $args['tinymce'] = array('toolbar1' => 'formatselect, bold, italic, underline, bullist, numlist, blockquote, alignleft, aligncenter, alignright, link, strikethrough, forecolor, outdent, indent, undo, redo');
        $args['quicktags'] = false;
        $args['teeny'] = true;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    This is causing it to repeat some things in toolbar 2 (as well as the ability to toggle toolbar 2 on and off). I tried adding toolbar 2 to the code above, but then it goes back to default. I could stop there though and just add underline and the tools that’s in toolbar 1 by default, but I’m curious if I can customise things further.

    To my question:
    Is there a way to add everything in one toolbar and then disable toolbar 2?
    Or is there a way to get the toogle for toolbar 2 back when I’ve customised toolbar 1?

    I also tried enabling teeny which would’ve worked best, but then I lose the forecolor toolbar box so I’d need a way to add it back.

    Thanks in advance

    Robin W
    Moderator

    maybe it’s the if function, try

    add_action ('bbp_new_topic_post_extras', 'rew_spam_update_last_active', 10 ,1 ) ;
    
    function rew_spam_update_last_active ($topic_id) {
    	//this function tests if a new topic has been marked as spam by Akismet.  If so then the last active date will be wrong
    	//So we use topic walker to recalculate it
    	bbp_update_topic_walker ($topic_id,  '', 0, 0, true) ;
    	}

    It’s not the answer, but might help get to the solution problem

    Robin W
    Moderator

    So there is some code in bbpress that can fix the link (I am guessing by changing something in the database?).

    yes it is the function ‘bbp_update_topic_walker ‘ called in my code 🙂 🙂

    I’ll look further at why it isn’t recalculating based in that info

    gtatar
    Participant

    Still the same result with the new code.

    But I noticed that emptying the spam folder causes “Last Post” link to change to the correct value. So there is some code in bbpress that can fix the link (I am guessing by changing something in the database?).

    Robin W
    Moderator

    ‘It looks like if the fix was inside bbp_topic_freshness_link() it would be much easier to test, ;’

    agree but it just wouldn’t work there, that is not where or when the issue is occurring.

    Try

    add_action ('bbp_new_topic_post_extras', 'rew_spam_update_last_active', 10 ,1 ) ;
    
    function rew_spam_update_last_active ($topic_id) {
    	//this function tests if a new topic has been marked as spam by Akismet.  If so then the last active date will be wrong
    	//So we use topic walker to recalculate it
    	if (!empty (get_post_meta( $topic_id, '_bbp_akismet_user_result' ))) {
    	bbp_update_topic_walker ($topic_id,  '', 0, 0, true) ;
    	}
    }
    
    Robin W
    Moderator

    ok,

    1. create a page called ‘profile’, it needs no content, but make sure the permalink is ‘profile’
    2. in dashboard>settings>wp members>pages>profile select the profile page

    then use this code

    add_action( 'template_redirect' ,'rew_profile' ) ;
    
    function rew_profile () {
    	update_option ('rewurl' , $_SERVER['REQUEST_URI']  ) ;
    	if ($_SERVER['REQUEST_URI']   ==  '/profile/') {
    	$user_id =get_current_user_id() ;
    	$url = bbp_get_user_profile_url( $user_id ) ;
    	exit( wp_redirect( $url ) );
    		}
    }

    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

    gtatar
    Participant

    Thank you, Robin. I added the snipped, and it partially worked. The anchor text “time ago” now reflects the time of the latest good post. However the URL is for the latest spam post.

    I started digging a bit through bbpress code. It looks like if the fix was inside bbp_topic_freshness_link() it would be much easier to test, as we would not need to wait for a new spam post to test the fix. And perhaps make decisions based on the wp_post status having the value “publish”. This way the solution would not be specific to Akismet. But I am really too new to WordPress coding and bbPress to be making this kind of changes myself.

    Robin W
    Moderator

    if it works for a topic, then I’ll do the code for a reply, which is basically changing mthe word topic to reply 🙂

    Robin W
    Moderator

    ok, give this a try – it may or may not do the trick !!

    add_action ('bbp_new_topic_post_extras', 'rew_spam_update_last_active', 10 ,1 ) ;
    
    function rew_spam_update_last_active ($topic_id) {
    	//this function tests if a new topic has been marked as spam by Akismet.  If so then the last active date will be wrong
    	//So we use topic walker to recalculate it
    	if (!empty (get_post_meta( $topic_id, '_bbp_akismet_user_result' ))) {
    	bbp_update_topic_walker ($topic_id) ;
    	}
    }

    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

    Robin W
    Moderator

    yes it does (and does so on here as well!).

    I’m just a helper here, not a bbpress author.

    I don’t run akismet on my test site. Are you able to replicate the problem so that we can check a fix if I am able to work up some code?

Viewing 25 results - 1,051 through 1,075 (of 32,458 total)
Skip to toolbar