Search Results for 'code'
-
AuthorSearch Results
-
July 29, 2020 at 9:06 pm #213283
In reply to: Topics and Replies not showing after import
malinky
ParticipantThanks 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:19273I ran the code twice (removing it and following the same process again), but the result was the same.
July 29, 2020 at 3:56 am #213276In reply to: Topics and Replies not showing after import
Robin W
Moderatorok, 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 plugin3. 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.July 28, 2020 at 7:10 pm #213266In reply to: Topics and Replies not showing after import
malinky
ParticipantI 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.
July 28, 2020 at 2:33 pm #213263In reply to: 404 error on css and js files
lonelydime
ParticipantIt’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?
July 28, 2020 at 4:54 am #213246In reply to: Topics and Replies not showing after import
Robin W
Moderatorok, that should have worked for replies as well – let me take another look at the code
July 27, 2020 at 1:54 pm #213228In reply to: Topics and Replies not showing after import
Robin W
ModeratorI 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
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 submityour topics and replies should now be fixed.
July 24, 2020 at 1:10 pm #213186In reply to: 404 error on css and js files
Robin W
Moderatoryou 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
July 24, 2020 at 1:06 pm #213185In reply to: Login Leads Users To URL For Admin Login
Robin W
Moderatorok, 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
July 24, 2020 at 10:23 am #213181Topic: 404 error on css and js files
in forum Troubleshootinglonelydime
ParticipantHello,
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);July 24, 2020 at 3:54 am #213177In reply to: best way to add translations?
haddlyapis
ParticipantHey 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; } }();July 23, 2020 at 7:39 am #213153In reply to: Move “New Topic” element to the top of the page.
Robin W
Moderatorfind
wp-content/plugins/bbpress/templates/default/bbpress/content-single-forum.phptransfer 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%/bbpresswhere %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.phpbbPress will now use this template instead of the original, and the topic form will now appear before the forums
July 22, 2020 at 9:25 am #213123In reply to: Title “Archives: Forum” – change to read “Forums”?
Robin W
Moderatorthat is a question – you should only have it once, either in your theme function file or in code snippets not in both !
July 22, 2020 at 9:18 am #213120In reply to: Title “Archives: Forum” – change to read “Forums”?
torimc125
ParticipantHi 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?
VictoriaJuly 22, 2020 at 8:38 am #213118In reply to: How to find if um on a topic page
Robin W
ModeratorViewing a single topic
if (bbp_is_single_topic()) {...
and orCheck 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()July 21, 2020 at 12:23 pm #213103In reply to: I want to get the parent forum name/ID of any topic
Robin W
Moderatorok, 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') ;July 21, 2020 at 11:03 am #213100In reply to: I want to get the parent forum name/ID of any topic
nayanboost
ParticipantI 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.
July 21, 2020 at 10:54 am #213096In reply to: bbpress blockquote text color – how to change?
Robert
ParticipantVery 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;
}July 21, 2020 at 10:47 am #213094In reply to: I want to get the parent forum name/ID of any topic
Robin W
Moderatoryou’ll need to give me the context – ie what are you trying to do, and what code do you have so far
July 21, 2020 at 10:45 am #213093In reply to: bbpress blockquote text color – how to change?
Robin W
Moderatormy firewall software doesn’t like your site
try
#bbpress-forums blockquote { color: blue !important; }July 21, 2020 at 10:04 am #213082In reply to: bbpress blockquote text color – how to change?
Robert
ParticipantI 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.
July 21, 2020 at 6:44 am #213070In reply to: I want to get the parent forum name/ID of any topic
Robin W
Moderatorbbp_get_topic_forum_id( $topic_id) ;July 21, 2020 at 6:09 am #213068Topic: I want to get the parent forum name/ID of any topic
in forum Pluginsnayanboost
ParticipantCould 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?
July 21, 2020 at 3:17 am #213065In reply to: bbpress blockquote text color – how to change?
Robin W
Moderatorput this in the custom css part of your theme
blockquote { color: blue; }July 21, 2020 at 3:05 am #213062In reply to: Sync Woocommerce User roles with bbpress site
Robin W
Moderatorbbpress 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
or if you are into coding
How to Share Logins and Users Between Multiple WordPress Sites
July 20, 2020 at 1:39 pm #213041In reply to: Akismet — false positives, grrrr!
Robin W
Moderatorthis 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.
-
AuthorSearch Results