Search Results for 'code'
-
AuthorSearch Results
-
August 12, 2021 at 5:26 pm #222572
jappan
ParticipantThank you Mr.Robin!!!
I tried using PHP code to put this button in place.
↓Here is the code↓<!DOCTYPE html> <html lang="ja"> <head> <div class="login-box"> <?php if ( is_user_logged_in() ) : ?> <?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ); ?> <?php global $user_identity; echo $user_identity; ?> <a href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>">ログアウト</a> <?php else : ?> <a href="https://tokyolyric.com/wp-login-php">ログイン</a> <?php endif; ?> </a> </div> </head>but I can’t go to “user’s profile page” from “the user’s image” and “user name”.
please let me know if there is any description to add to the code!!!
August 7, 2021 at 4:39 am #222497In reply to: Tag cloud on search result page
Jan
Participantsorry for making you wait.
The better term is probably “search result page”. The header of my bbp forum comes with a search bar which allows users to enter keywords (i.e. “browser”) and then takes then to the respective search result page (example: https://webgefaehrte.de/videoassistent/suchen/browser/).
I’d like to add a tag cloud into the existing side bar (right hand side).
Meanwhile I found this suggestion which, however, I can’t get to work 😉
The threats regarding #1 und #2 is this one:
– https://bbpress.org/forums/topic/problem-with-shortcode-tag-cloud-in-sidebar-widget/
– https://bbpress.org/forums/topic/change-font-size-range-for-tag-cloud/Any advise is much appreciated.
Thanks,
JanAugust 7, 2021 at 2:56 am #222494In reply to: Forum url changes
Robin W
Moderatorok you could also use a PHP variable rather than a wordpress function
so
$current_url = $_SERVER['REQUEST_URI'];should give you the displayed URL in all cases.
you can then do an ‘if’ test to see if you are in forums using say
if (strpos($_SERVER['REQUEST_URI'], '/qaforums/') == true )…then you are in the forumsAugust 6, 2021 at 4:17 pm #222472In reply to: Forum url changes
pawanahluwalia
ParticipantI am just trying to understand how the plugin works and why the php code is not giving the correct url that matches what is visible in the browser. I have tried your suggestions but I still can’t determine why the urls being generated by either get_page_link() or get_permalink() are different to the ones being displayed in the browser address line.
August 6, 2021 at 4:08 pm #222471In reply to: Forum url changes
Robin W
Moderatorsorry, I have given you some code which addresses, which does not seem to satisfy you.
I am not quite sure why you think the plugin authors would want to make their plugin work for your exact circumstances, but if you want to post a defect then go here
August 6, 2021 at 2:57 pm #222463In reply to: Forum url changes
Robin W
Moderatorwould you like to post your current code?
August 6, 2021 at 2:12 pm #222462In reply to: Forum url changes
pawanahluwalia
ParticipantThe only trouble with this solution is, it is not permanent. You would need to the change the code each time a new forum is added.
August 6, 2021 at 12:21 pm #222459In reply to: Forum url changes
Robin W
Moderatorif get_page link returns :
mywebsite.com/forum_name3/forum_name3/
then you could just test for this eg
if (get_page_link() == 'mywebsite.com/forum_name3/forum_name3/') { get_permalink etc. } else { get_page_link() }August 6, 2021 at 12:06 pm #222458In reply to: Forum url changes
pawanahluwalia
ParticipantThanks!
However, is_bbpress() only seems to be true if you are on the root forum page.
How can I test for any forum page?
I tried
echo get_permalink();
on a forum page, but it does not display anything. It does display it on the root forum page, but it does not match the root forum page permalink. It again shows the highest Forum ID permalink instead.
Presumably the page is being created in code and is overwriting the content of the current forum page.
Any further suggestions?
August 6, 2021 at 10:58 am #222455In reply to: Forum url changes
Robin W
ModeratorI’d suspect that because each forum is not an real individual wordpress page (ie not in dashboard>pages) , then retrieving the page_link might well return a ‘virtual’ ID, and this might be the top forum – not proven, just a hunch.
My initial suggestions would be that you try get_permalink instead of get_page_link() – this retrieves the full url of the current displayed page, and should in theory get you what you want.
If you need the existing get_page_link() for your other pages, you could try wrapping it in an if… eg:
if (is_bbpress()) { get_permalink etc. } else { get_page_link() }Let us know if that helps
August 5, 2021 at 11:42 am #222427packzap
ParticipantMy server is showing this error repeatedly:
“PHP Parse error: syntax error, unexpected ‘new’ (T_NEW) in /home/…/bb-settings.php on line 188”When I look at line 186 thru 190 of bb-settings.php, it shows this statement:
// Setup the global database connection $bbdb_class = BB_DATABASE_CLASS; $bbdb =& new $bbdb_class( array( 'name' => BBDB_NAME, 'user' => BBDB_USER,I am trying to troubleshoot what it is about that line with the “new” statement that causes this parse/syntax error repeatedly by the server. Any thoughts are appreciated. Thank-you.
August 5, 2021 at 8:40 am #222425In reply to: Get Number of Favorites & Subscription to a topic
specstanza
ParticipantThank you so much @robin-w – changed the subscription to fav with
bbp_get_topic_favoriters🙂add_action('bbp_template_before_single_topic', 'show_bbp_sub'); function show_bbp_sub() { $subscriptions = bbp_get_topic_favoriters(bbp_get_topic_id()) ; $count = count($subscriptions) ; echo 'number of users subscribed: '.$count; }Now I only have to look for a way to display my topics and sorted them by numbers of favs! Thanks to you I know there was some major changes with the 2.6 version.
August 5, 2021 at 8:27 am #222424In reply to: Get Number of Favorites & Subscription to a topic
Robin W
ModeratorI’ve just taken a look – the whole way subscriptions works was changed in 2.6
this code works on my test site
add_action('bbp_template_before_single_topic', 'show_bbp_sub'); function show_bbp_sub() { $subscriptions = bbp_get_subscribers(bbp_get_topic_id()) ; $count = count($subscriptions) ; echo 'number of users subscribed: '.$count; }August 5, 2021 at 6:19 am #222416In reply to: Get Number of Favorites & Subscription to a topic
specstanza
ParticipantHi @robin-w – thanks for your answer.
Here it is – as I’m still learning PHP, I apologize if I did a terrible coding mistake.
I tried some modifications here and there (return, echoing other stuff) but nothing did the trick./* tried to hook the code in my template */ add_action('bbp_template_before_single_topic', 'show_bbp_sub'); function show_bbp_sub() { /* end of it *//* Original lines from @babblebey */ $topic = bbp_get_topic_id(); $users = get_users() ; $countsub = 0; /* I guess it's echoing only this line */ foreach ($users as $user) { $topicsub_listarray = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ; $topicsub_list = explode (',' , $topicsub_listarray) ; if (in_array ($topic , $topicsub_list)) $countsub++ ; } echo $countsub; }Thank you for your help and your patience.
August 5, 2021 at 2:57 am #222407In reply to: Get Number of Favorites & Subscription to a topic
Robin W
Moderatorcan you post the complete code
August 4, 2021 at 7:01 pm #222401In reply to: Import to bbPress from BuddyPress
r-a-y
ParticipantDocumentation is lacking. Your best bet is to dive into the code.
bbp_insert_forum()to create a forum:
https://github.com/bbpress/bbPress/blob/master/src/includes/forums/functions.php#L24bbp_insert_topic()to create a topic: https://github.com/bbpress/bbPress/blob/master/src/includes/topics/functions.php#L24For BuddyPress, look at the
wp_bp_activityDB table with thecomponentcolumn set togroups. You could useBP_Activity_Activity::get()(https://github.com/buddypress/buddypress/blob/master/src/bp-activity/classes/class-bp-activity-activity.php#L380) to fetch activity items, but probably querying the DB is faster.The rest is up to you.
August 4, 2021 at 12:01 pm #222398In reply to: Get Number of Favorites & Subscription to a topic
specstanza
ParticipantHi @babblebey & @robin-w , thank you both for your work on this matter.
I’m trying to do the same on my Bbpress install (not online yet) in order to sort topic by number of “fav mentions”.
I tried your last two codes but it returns “0” (I hooked them on
bbp_template_before_single_topicand putted them in two separatedfunctions).Does it still works for you? Did I get it all wrong?
Thank you for your answer. 🙂
August 3, 2021 at 6:47 pm #222379In reply to: Import to bbPress from BuddyPress
r-a-y
ParticipantIs it correct to say that if the BuddyPress group exists with some posts, and I set up a new bbPress forum in the backend, the existing posts will appear in the bbPress forum?
Depends what you mean by “some posts”. If the BuddyPress group was originally set up with bbPress integration as mentioned here: https://codex.buddypress.org/getting-started/installing-group-and-sitewide-forums/ (The B and C options only). And forum posts were created in those groups, then yes. You just need to disable BuddyPress and those forum posts should still be viewable.
Otherwise, no. You are probably thinking of the BuddyPress group activity stream that uses Twitter-style status updates, which is not a forum.
August 3, 2021 at 1:41 pm #222377In reply to: using the bb forums list widget
Robin W
Moderatorjust taken a quick look.
yes it looks like it will show the sub forums of a forum ID you enter, but not the parent forums as well.
I should say I’m not a bbpress author, and after a check of the code it is not an easy change to fix
August 3, 2021 at 1:15 pm #222376In reply to: Remove noreply email from notification emails
Robin W
Moderatorthe code is valid – I suspect you have a copy/paste issue – sometimes a ‘ becomes corrupted,
Can you post exactly what you have in your file
August 3, 2021 at 10:11 am #222369In reply to: Remove noreply email from notification emails
linguabuddy
ParticipantLooks like something may have changed as this code is now producing a fatal error.
I used the second snippet to edit the reply emails but while the email send has been successfully modified (and is no longer bouncing), the user now gets a white screen…
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘my_bbp_no_reply_email’ not found or invalid function name in /home/customer/www/[domain]/public_html/wp-includes/class-wp-hook.php on line 287
Has something been updated in the codex?
August 2, 2021 at 3:19 pm #222324aliforty
ParticipantI was familiar, just a brain freeze early on Monday 🙂
But please let me know what arguments I should pass that would get the outcome I am hoping for. I was wanting for “\r \n” in TinyMCE to be replaced with <br /> tags. The WordPress database was not saving those escaped characters or at the very least wasn’t displaying them back. Eerything was being shown in one line. Teeny and TinyMCE is enabled.
For the time being, I did find an alternative solution. Replaced the “\r \n” with <br /> for the posts and disabled the bbp_code_trick_reverse filter that was removing them later.
function bbp_convert_reply_breaks_to_tags($output, $args, $post_content){ $text = str_replace(array("\r\n", "\n", "\r"), "<br />", $post_content); return $text; } function bbp_convert_topic_and_forum_breaks_to_tags($post_content){ $text = str_replace(array("\r\n", "\n", "\r"), "<br />", $post_content); return $text; } add_filter('bbp_new_reply_pre_content', array($this, 'bbp_convert_reply_breaks_to_tags'), 10, 3); add_filter('bbp_new_topic_pre_content', array($this, 'bbp_convert_topic_breaks_to_tags'), 10, 1); add_filter('bbp_new_forum_pre_content', array($this, 'bbp_convert_topic_and_forum_breaks_to_tags'), 10, 1); remove_filter('bbp_get_form_reply_content', 'bbp_code_trick_reverse'); remove_filter('bbp_get_form_forum_content', 'bbp_code_trick_reverse'); remove_filter('bbp_get_form_topic_content', 'bbp_code_trick_reverse');August 2, 2021 at 5:21 am #222315Topic: Tag cloud on search result page
in forum InstallationJan
ParticipantThis is my first post in this forum, so I apologize if this may sound like a no-brainer question.
I went through a number of threats and understood that adding a topic tag cloud to a search page requires…
(1) activation of the tagging feature in the forum settings (Done)
(2) adding an HTML widget to the respective sidebar and (Done)
(3) pasting the relevant HTML code snippet into the widget. (Open)Where can I find the HTML required for step number 3?
Any advice is much appreciated.
Thanks,
JanJuly 31, 2021 at 3:12 am #222306Robin W
Moderatorapply_filters( 'bbp_get_the_content', $output, $args, $post_content );in
bbpress 2.6.6\includes\common\template.php
line 1940
should do it
July 27, 2021 at 11:13 pm #222261In reply to: Updatable Post Date
Back to Front
ParticipantYes you could use
.bbp-reply-post-date { display: none; }to hide you bbpress reply post date.
But to display the post modified date you would need to add this function in you child theme templates whereever you want to display, eg replace
bbp_topic_post_date();
with
the_modified_date();
in templates/content-single-topic-lead.php -
AuthorSearch Results