Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,526 through 2,550 (of 32,492 total)
  • Author
    Search Results
  • #213283
    malinky
    Participant

    Thanks for this Robin but unfortunately it didn’t work.

    After I ran the code the message was…
    Topics fixed…
    Replies fixed…
    All done…
    Total topics:2530
    Topics with no post_parent:33
    Total replies: 19274
    Replies with no post_parent:19273

    I ran the code twice (removing it and following the same process again), but the result was the same.

    #213276
    Robin W
    Moderator

    ok, I’ve re-written a bit just in case

    can you

    BEFORE DLOING THIS backup your site or have the ability to go back to a previous version

    1.deactivate and delete the existing plugin
    2. download this plugin

    fix forum import post parent

    3. install and activate
    4. create a page called whatever you like, and put the shortcode
    [fix-import]
    in it
    5. view the page – you should be able to see how many topics have blank post_parent before running.
    6. If you are happy – run this.

    #213266
    malinky
    Participant

    I ran that but it didn’t fix the issue.

    Strangely, the Replies page in the admin says there are over 19,000 replies but only two are showing up now. The others are no longer visible.

    Is it possible to run the code again but just for the replies? Maybe it was a memory limit issue. I’ve just upped the max_memory_limit to 256M.

    #213263
    lonelydime
    Participant

    It’s been about 10 years since I’ve attempted anything WordPress or PHP for that matter, but while this works it feels like it’s going to break in an update.

    add_filter( 'bbp_default_styles', 'rew_dequeue_bbpress_css' );
    
    function rew_dequeue_bbpress_css ($defaults ){
    	fixed_bbp_enqueue_style("bbp-default", "css/bbpress.css", array(), bbp_get_version());
    	unset ($defaults['bbp-default']) ;
    	return $defaults ;
    }
    
    function fixed_bbp_enqueue_style( $handle = '', $file = '', $deps = array(), $ver = false, $media = 'all' ) {
            // Attempt to locate an enqueueable
            $located = bbp_locate_enqueueable( $file );
    	$located = str_replace('/bitnami/wordpress', '', $located);
    		
            // Enqueue if located
            if ( ! empty( $located ) ) {
    
                    // Make sure there is always a version
                    if ( empty( $ver ) ) {
                            $ver = bbp_get_version();
                    }
    
                    // Make path to file relative to site URL
                    $located = bbp_urlize_enqueueable( $located );
    
                    // Register the style
                    wp_register_style( $handle, $located, $deps, $ver, $media );
    
                    // Enqueue the style
                    wp_enqueue_style( $handle );
            }
    
            return $located;
    }

    From what I can tell your snippet does, it just clears out the default css object so the loop to bbp_enqueue_style skips including it and then I can inject my own function. The scripts function seem more complicated because there are many more includes than one file and they’re based on pages from what I can tell. Is what I’ve done what you were referring to?

    #213246
    Robin W
    Moderator

    ok, that should have worked for replies as well – let me take another look at the code

    #213228
    Robin W
    Moderator

    I think I might know the issue.

    can you

    1. backup your site or have the ability to go back to a previous version
    2. download this plugin

    Fix forum


    3. install and activate
    4. create a page called whatever you like, and put the shortcode
    [fix-topics]
    in it
    5. view the page, select ‘run’ and click submit

    your topics and replies should now be fixed.

    #213186
    Robin W
    Moderator

    you can dequeue from bbpress and then reload as you wish

    so for styles

    add_filter( 'bbp_default_styles', 'rew_dequeue_bbpress_css' ) ;
    
    function rew_dequeue_bbpress_css ($defaults ){
    unset ($defaults['bbp-default']) ;
    return $defaults ;
    }

    and re-enqueue it using your own function

    #213185
    Robin W
    Moderator

    ok, thanks, but sorry I can’t really help further.

    I will state again that WordPress handles both registration and login, and as long as you don’t use the login widgets or shortcodes then bbpress should not be involved.

    I hope you get a resolution

    #213181
    lonelydime
    Participant

    Hello,

    I’m running a fresh install of WordPress from the bitnami helm chart using persistent storage on an NFS share. The path used by the containers is /bitnami/wordpress/wp-content/ to pull in plugins/etc. When I install bbPress, all of the css files and js files use the wrong path to include the assets.

    Here’s an example:

    <link rel='stylesheet' id='bbp-default-css' href='https://example.com/bitnami/wordpress/wp-content/plugins/bbpress/templates/default/css/bbpress.min.css'>
    
    <script type='text/javascript' src='https://example.com/bitnami/wordpress/wp-content/plugins/bbpress/templates/default/js/editor.min.js?ver=2.6.5'>

    I haven’t had any issues with other plugins thus far, but for some reason bbPress is wanting to use the full installation path instead of the web root. Is there a way of fixing this with some WP constant that I’m not setting? The installation of wordpress is in /opt/bitnami/wordpress and wp-content/ and wp-config.php are symlink’d to /bitnami/wordpress/wp-content and /bitnami/wordpress/wp-config.php.

    I have a temporary fix right now which will be wiped out when bbPress updates.

    File: wp-content/plugins/bbpress/includes/core/template-functions.php

    function bbp_enqueue_style( $handle = '', $file = '', $deps = array(), $ver = false, $media = 'all' ) {
            // Attempt to locate an enqueueable
            $located = bbp_locate_enqueueable( $file );
            //Ghetto fix
            $located = str_replace('/bitnami/wordpress', '', $located);
    function bbp_enqueue_script( $handle = '', $file = '', $deps = array(), $ver = false, $in_footer = false ) {
            // Attempt to locate an enqueueable
            $located = bbp_locate_enqueueable( $file );
            //Ghetto fix
            $located = str_replace('/bitnami/wordpress', '', $located);
    #213177
    haddlyapis
    Participant

    Hey there, I tried using the translation part of the bbp style pack plugin, while assuming, that once I was able to fix the translations I would then fix the CSS styling issues I have mentioned above (this would just take a little work on my behalf). Anyway, even though it says you have to play around with it to get it right (e.g. add the full stop if there is one etc.), I was not able to implement the translations. I am sure it has something to do with the way my site is set up and not the plugin itself, but alas, I had to find a different option.
    So, here is my frontend Javascript solution. I noticed that I have to put e.g. “weeks” before “week” in the object for it to work (i.e. plural before singular). For anyone who wants to know, the word “aktualisiert” refers to the English word “updated”, (as the verb goes to the end of the sentence in German it is slightly tricky to just translate “this was last updated…..”).
    I am not sure if anyone needs this, but as I require help with my website from time to time from people like those at bbpress (thx btw), if I can be of any help, I would like to. This is an IIFE btw:

    
    /* WB- translate some dodgy sentences (part English/ part German) */
    var translate = function () {
        //check if the page is a forum page. If not, return function
        var isForum = document.querySelector("#bbpress-forums");
        if (!isForum) return;
    
        // find if either forum or topic description (topic is one level lower in the forum where people can answer individual posts. forum is where all the sub-topics are listed
        var forum = document.querySelector(".bbp-forum-description");
        var description = document.querySelector(".bbp-topic-description");
    
        //If not on either the forum description page or the forum topic page, return
        if (!forum && !description) return;
    
        //set a variable to add the innerHTML to 
        var d_text;
    
        if (forum) {
            // if forum has no topics make no tranlation changes and hide the "Oh bother.... div"
            if (forum.innerText === "Dieses Forum ist leer."){ 
            var oh_both_text = document.querySelectorAll(".bbp-template-notice");
            oh_both_text[1].style.display = "none";
            return;
        }
            d_text = forum.innerHTML;
        }
        if (description) {
            d_text = description.innerHTML;
        }
    
        // create object with list to translate (name: = English, value = Deutsch)
        var d_obj = {
            "This forum has": "Dieses Forum hat",
            "This topic has": "Dieses Thema hat",
            "This category has":"Diese Kategorie hat",
            "This topic is empty":"Dieses Thema ist leer",
            "hidden":"verdeckt",
            "and was last updated": "und wurde zuletzt",
            "seconds": "Sekunden",
            "minutes": "Minuten",
            "hours": "Stunden",
            "days":"Tagen",
            "day": "Tag",
            "weeks":"Wochen",
            "week": "Woche",
            "months": "Monaten",
            "month": "Monat",
            "years":"Jahren",
            "year":"Jahr",
            "by": "von"
        }
    
        // use Replace method to run through innerHTML and replace English text with German
        d_text = d_text.replace(/This forum has|This topic has|This category has|This topic is empty|hidden|and was last updated|seconds|minutes|hours|days|day|weeks|week|months|month|years|year|by/gi, function (matched) { return d_obj[matched]; });
    
        //add "aktualisiert" to end of sentence
        if (d_text.indexOf("und wurde zuletzt") > -1) {
        d_text = d_text.slice(0,-1).concat(" aktualisiert.");    }
    
        //update the innerHTML of either the forum or the topic page 
        if (forum) { forum.innerHTML = d_text; }
        if (description) { description.innerHTML = d_text; }
    }();
    
    #213153
    Robin W
    Moderator

    find
    wp-content/plugins/bbpress/templates/default/bbpress/content-single-forum.php

    transfer this to your pc and edit

    you’ll see

    		<?php if ( ! bbp_is_forum_category() && bbp_has_topics() ) : ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php elseif ( ! bbp_is_forum_category() ) : ?>
    
    			<?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>

    change this to

    <?php if ( ! bbp_is_forum_category() && bbp_has_topics() ) : ?>
    		
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    			
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			
    
    		<?php elseif ( ! bbp_is_forum_category() ) : ?>
    		
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    			<?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>

    and save

    then create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

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

    Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/content-single-forum.php

    bbPress will now use this template instead of the original, and the topic form will now appear before the forums

    Robin W
    Moderator

    that is a question – you should only have it once, either in your theme function file or in code snippets not in both !

    torimc125
    Participant

    Hi Robin: Thank you again for your reply.  I copied the code you provided and pasted it into Code Snippets. Now I get this error message: 

    “The snippet has been deactivated due to an error on line 3:
    Cannot redeclare function to_archive_title_remove_prefix.

    Any other suggestions?
    Victoria

    #213118
    Robin W
    Moderator

    Viewing a single topic
    if (bbp_is_single_topic()) {...
    and or

    Check if current page is a bbPress topic
    bbp_is_topic()

    and also
    Check if we are viewing a topic archive.
    bbp_is_topic_archive()

    and
    Check if current page is a topic edit page
    bbp_is_topic_edit()

    #213103
    Robin W
    Moderator

    ok, without getting heavily involved in coding a solution for you (which is my paid day job 🙂 ) I guess that you have hooked to ‘template redirect’ which fires on everypage, so when WordPress displays the test-page it looks again for a value of topic_id, which on the test page does not exist, so returns zero.

    if your code is working in that it redirects to test page, then you could try appending the topic id and picking that up in $_REQUEST

    eg (untested)

    wp_redirect('/test-page/?topic_id='.bbp_get_topic_id());

    and then on test page use the code

    if (isset($_REQUEST['topic_id'])) $topic_id = $_REQUEST('topic_id') ;

    #213100
    nayanboost
    Participant

    I am writing this code in functions.php and when I am trying to dump data using
    print_r (bbp_get_topic_id());

    It is returning 0.

    When the above mentioned condition is met I will redirect to another page.

    function test_rdr (){
        if (bbp_get_topic_forum_id(bbp_get_topic_id()) == ‘ID of the Parent forum’){
            wp_redirect('/test-page');
            exit;
        }
    }
    add_action('template_redirect', 'test_rdr')

    Please help me to get over with it.

    #213096
    Robert
    Participant

    Very strange… so I tried adding the code you suggested in the css section of my word press theme, and it didn’t work.

    So I made a change to the css code in SiteOrigin css and added “!important” and that worked, see code below…

    blockquote p {
    color: blue !important;
    border-width: 1px;
    border-style: solid;
    border-color: #e6e6e6;
    background-color: #000000;
    }

    #213094
    Robin W
    Moderator

    you’ll need to give me the context – ie what are you trying to do, and what code do you have so far

    #213093
    Robin W
    Moderator

    my firewall software doesn’t like your site

    try

    #bbpress-forums blockquote {
    	color: blue !important;
    }
    #213082
    Robert
    Participant

    I even installed the plugin SiteOrigin CSS to try and change the blockquote, but still no luck, see code below…

    blockquote p {
    color: blue;
    border-width: 1px;
    border-style: solid;
    border-color: #e6e6e6;
    background-color: #000000;
    }

    It seems the code for the blockquote is being over ridden somewhere.

    #213070
    Robin W
    Moderator

    bbp_get_topic_forum_id( $topic_id) ;

    #213068
    nayanboost
    Participant

    Could you please tell me how I can get the parent forum name/ID of current topic/any topic? I need code implementation. How to get so by code?

    #213065
    Robin W
    Moderator

    put this in the custom css part of your theme

    blockquote {
    	color: blue;
    }
    #213062
    Robin W
    Moderator

    bbpress just uses WordPress login, so you just need a plugin or code that does that for WordPress

    there are several and I have not tried any, but

    Home

    or if you are into coding

    How to Share Logins and Users Between Multiple WordPress Sites

    #213041
    Robin W
    Moderator

    this is one of the good and bad things about WordPress plugins.

    It is good that they warn you that plugins have not been updated for a long period.

    It is bad that it puts people off using perfectly good plugins because the author has had the goodness to release for free useful code to the world, but does not have the time or wish to be involved in supporting it.

    But a well written plugin rarely needs changing if it does all that is required.

    And since moderation tools hooks to bbpress functions that are long standing and stable, there are no issues I know with this plugin and I suspect it will work for years to come. If it breaks though minor issues, I’d clone it and re-issue.

    You can sort of consider the warning a bit like a warranty. You don’t stop using the dishwasher because the year long warranty has run out, you just accept that maybe one day in the future it will stop working. When it does, then you may need to stop using it, but you do not go back to hand washing your dishes just because the warranty has run out on the dishwasher 🙂

    If moderation tools stops working, you are no worse off than now. so if you use it for a while and it makes life easier, then that is a bonus.

Viewing 25 results - 2,526 through 2,550 (of 32,492 total)
Skip to toolbar