Search Results for 'code'
-
AuthorSearch Results
-
November 8, 2019 at 12:47 pm #205386
In reply to: Filter the Admin Links Content
Babblebey
ParticipantI want to be able to edit each of the Link – Let’s say for example I want to Change ‘Reply’ to ‘Respond’ and also add a fontawesome icon with the html
ielement.November 8, 2019 at 11:52 am #205381In reply to: How to avoid SMTP server blocking?
Robin W
Moderatorhmm…that’s awkward as would involve some custom code to fix, probably added to the above plugin.
I don’t have time to do this at the moment
November 8, 2019 at 11:47 am #205379In reply to: Change forum date output
Robin W
Moderatorok, the existing function is
function bbp_get_topic_post_date( $topic_id = 0, $humanize = false, $gmt = false ) { $topic_id = bbp_get_topic_id( $topic_id ); // 4 days, 4 hours ago if ( !empty( $humanize ) ) { $gmt_s = !empty( $gmt ) ? 'U' : 'G'; $date = get_post_time( $gmt_s, $gmt, $topic_id ); $time = false; // For filter below $result = bbp_get_time_since( $date ); // August 4, 2012 at 2:37 pm } else { $date = get_post_time( get_option( 'date_format' ), $gmt, $topic_id, true ); $time = get_post_time( get_option( 'time_format' ), $gmt, $topic_id, true ); $result = sprintf( _x( '%1$s at %2$s', 'date at time', 'bbpress' ), $date, $time ); } return apply_filters( 'bbp_get_topic_post_date', $result, $topic_id, $humanize, $gmt, $date, $time ); }so we can filter this as follows :
add_filter ('bbp_get_topic_post_date' , 'rew_date' , 10 , 6) ; function rew_date ($result, $topic_id, $humanize, $gmt, $date, $time) { $result = 'hello' ; return $result ; }This should then say ‘hello’ so all we want to do is change $result to read whatever you want – so what do you want it to say ?
November 8, 2019 at 11:09 am #205377In reply to: Change forum date output
Babblebey
ParticipantNot very much, I feel very lazy to read this page – https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum-part-5/
Aww
November 8, 2019 at 9:19 am #205371In reply to: Change forum date output
Babblebey
ParticipantI have been doing that from the start of the whole process of the project, I have all the bbpress templates copied over to my theme directory, I am doing an edit on exactly all the template.
But the
bbp_topic_post_date('d M, Y')doesn’t work is the thing.November 8, 2019 at 8:20 am #205362Topic: Filter the Admin Links Content
in forum InstallationBabblebey
ParticipantI would like to add Icons to the Admin Links, But I do not want use the
::beforeor::after, I would like to filter and dictate the content it outputs by adding some html element to it such like<i class="fa fa-reply"></i>I hope this is possible
November 8, 2019 at 7:15 am #205361In reply to: Change forum date output
Babblebey
ParticipantThe Plugin is kind of disturbing my function in the way I have set them up already… And it only works on the Freshness Display, it doesn’t work on the topics and reply post dates.
I want one that can work similarly like the WordPress
the_date('d M, Y')to look likebbp_topic_post_date('d M, Y')to dictate the exact date format I want for that function to return. I do not really want plugins, I’m trying to build with little to no plugins at all.November 7, 2019 at 11:36 pm #205345In reply to: Add large avatar next to topic in one forum only
demonboy
ParticipantYep, that’s great. Thanks again, Robin.
If anyone else is interested, in addition to the above code placed in functions.php, I amended loop-single-topic.php in my child theme thus:
<a class="bbp-topic-permalink" href="<?php bbp_topic_permalink(); ?>"><?php bbp_topic_title(); ?> <?php $forum_id = bbp_get_forum_id(); if (( $forum_id == 41371) ){ ?> - <?php echo bbp_get_topic_author(); ?></a> <?php } else {?> </a> <?php }?> <?php do_action( 'bbp_theme_after_topic_title' ); ?> <?php bbp_topic_pagination(); ?> <?php do_action( 'bbp_theme_before_topic_meta' ); ?> <p class="bbp-topic-meta"> <?php do_action( 'bbp_theme_before_topic_started_by' ); ?> <?php $forum_id = bbp_get_forum_id(); if (( $forum_id == 41371) ){ ?> <?php } else {?> <span class="bbp-topic-started-by"><?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '14' ) ) ); ?></span> <?php }?>This selects a specific forum and within that forum it removes the ‘started by’ meta info that normally appears under the title. Instead it places the topic author’s display name (not user name) as an extension of the topic title, separated by a hyphen. The link to the author is removed and instead becomes part of the link to the topic.
November 7, 2019 at 4:25 pm #205335In reply to: How to hide the forum and its posts from visitors
stracy2
ParticipantHi Robin,
If you instead go to Dashboard>Forums>Edit and a set “Visibility” to “Hidden”, the forum is still visible (listed) to a user with the Forum Role of “Participant” (although they cannot visit the forum).
Can you confirm? This isn’t the expected, default bbPress behavior for a “Hidden” forum according to forum visibility documentation.
By “default” I mean bbPress without “bbp Private Forums” installed. I understand you are the author (awesome job!). If “Hidden” actually hid a forum, I wouldn’t require “bbp Private Forums” and I’d skip the need to donate to you :).
November 7, 2019 at 3:12 pm #205333In reply to: Redirection using the logon shortcode
Robin W
Moderatortry this
function rew_login_redirect_url ($redirect) { //quit if it's not a redirect if (strpos($_SERVER['REQUEST_URI'], '?redirect_to=') == false ) return $redirect; $redirect = 'url' ; return $redirect ; } add_filter ('bbp_user_login_redirect_to' , 'rew_login_redirect_url', 5 , 1) ;change ‘url’ to where you want it to go
Put this in your child theme’s function file – or use
November 7, 2019 at 1:58 pm #205329In reply to: Add large avatar next to topic in one forum only
Robin W
Moderatorif that code does what you want then just use the same logic you did in
eg
function rkk_topic_av() { $thisforumid = bbp_get_forum_id(); if($thisforumid == 43135) { echo bbp_get_topic_author_link( array( 'size' => '48' , 'type' => 'avatar')); } } add_action('bbp_theme_before_topic_title','rkk_topic_av');November 7, 2019 at 1:07 pm #205324In reply to: Get Number of Favorites & Subscription to a topic
Babblebey
ParticipantCounting Topic Favorites:
<?php $topic = bbp_get_topic_id(); $users = get_users() ; $countfav = 0; foreach ($users as $user) { $topicfav_listarray = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ; $topicfav_list = explode (',' , $topicfav_listarray) ; if (in_array ($topic , $topicfav_list)) $countfav++ ; } echo $countfav; ?>;Counting Topic Subscriptions:
<?php $topic = bbp_get_topic_id(); $users = get_users() ; $countsub = 0; 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; ?>;Now those are the things that worked.
Thank you, Robin! I hope this helps someone in the future
November 7, 2019 at 12:57 pm #205323In reply to: Get Number of Favorites & Subscription to a topic
Babblebey
Participant<?php $topic = bbp_get_topic_id(); $users = get_users() ; $countsub = 0; foreach ($users as $user) { $topicsub_list = array(get_usermeta ($user->id, 'wp__bbp_subscriptions', false)) ; if (in_array ($topic , $topicsub_list)) $countsub++ ; } echo $countsub; ?>Now it’s understandable that this also didn’t work on the topic I tested it with, because the user has subscribed to multiple topics.
Oh wow!
November 7, 2019 at 12:55 pm #205322In reply to: Get Number of Favorites & Subscription to a topic
Babblebey
Participant<?php $topic = bbp_get_topic_id(); $users = get_users() ; $countfav = 0; foreach ($users as $user) { $topicfav_listarray = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ; $topicfav_list = explode (',' , $topicfav_listarray) ; if (in_array ($topic , $topicfav_list)) $countsub++ ; } echo $countfav; ?>This worked now Robin! Thank you!
November 7, 2019 at 12:48 pm #205321In reply to: Get Number of Favorites & Subscription to a topic
Babblebey
ParticipantNow I guess if Each User has already one topic in his
wp__bbp_favoritesthe topic stays favorited and counted but No counts is allowed for another topic again.So the
if (in_array ($topic , $topic_list)) $count++is being a Jealous line i.e: It Only counts a user’s favorite if the user favorites only the currents topics else it doesn’t. because there exists more than one topic inside the$topic_list = array(get_usermeta ($user->id, 'wp__bbp_favorites', false)) ;What do I do?
November 7, 2019 at 12:37 pm #205320In reply to: Get Number of Favorites & Subscription to a topic
Babblebey
ParticipantMy Code was to test it for how many User has favourited a particular topic (Like, check how many likes a post has)…

But I guess like you said, If I understand you very well, I am testing in a scenario where User has only one topic listed in the
wp__bbp_favoritesmeta area…I think that fact has returned to haunt me now Robin… The picture above shows that the Currently logged in User (Who is a keymaster) has favorited the current topic but, his Favorite doesn’t count, the displayed
1is for that of the second user who also favorites the same topic and happens to be the only topic he has favorited.Look at the shot below then:

Now I have added more topics to the user’s
wp__bbp_favoritesby favouriting more topics but Its not displaying the favourites in those topics.Another scenario on a different topic here:

Not displaying the number of favorite for the topic.
I added a new user and it was able to successfully favourite and increase the count on one of those topics that didn’t get from the previous two users.
So I think the favorite count only work if a certain user has only one topic inside their
wp__bbp_favoritesHere’s the favourite count code again as I have used:
$topic = bbp_get_topic_id(); $users = get_users() ; $count = 0; foreach ($users as $user) { $topic_list = array(get_usermeta ($user->id, 'wp__bbp_favorites', false)) ; if (in_array ($topic , $topic_list)) $count++ ; } echo $count;What do you suggest I do now Robin? Should I try
explodeexplosion???November 7, 2019 at 11:12 am #205319In reply to: Get Number of Favorites & Subscription to a topic
Robin W
Moderatorgreat – you may want to check the favorites for if a user has more than one favorite topic – I am suspecting your code was only tested with 1 favorite – if so same principal, if not I don’t know why one works and then other doesn’t !!
November 7, 2019 at 9:57 am #205318Topic: Change forum date output
in forum InstallationBabblebey
Participantbbp_topic_post_date()&bbp_reply_post_date()returns date in this formatSeptember 2, 2018 at 4:34 am.How does one change it to the other formats:
time ago,September 2, 2018or2-10-2019And possibly other formats as preferred.
November 7, 2019 at 9:29 am #205317In reply to: Get Number of Favorites & Subscription to a topic
Babblebey
ParticipantThat was a hit, Robin!
<?php $topic = bbp_get_topic_id(); $users = get_users() ; $countsub = 0; 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; ?>That worked it….. Thank you.
November 7, 2019 at 5:56 am #205314In reply to: How to reorder topics in one forum?
Robin W
Moderatorsyntax error
line
add_filter('bbp_before_has_topics_parse_args', 'my_custom_display_topic_index_query ' );should read
add_filter('bbp_before_has_topics_parse_args', 'my_custom_display_topic_index_query' );is essence you have a space after the word query before the ‘ in
'my_custom_display_topic_index_query 'November 7, 2019 at 5:39 am #205312In reply to: Get Number of Favorites & Subscription to a topic
Robin W
Moderatorlooks like it hasn’t converted to an array basically it should read
array (size = 2)
0 => 149
1 => 65etc.
ok so let’s try replacing
$topicsub_list = array(get_usermeta ($user->id, 'wp__bbp_subscriptions', false)) ;with
$topicsub_lista = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ; $topicsub_list = explode (',' , $topicsub_lista) ;November 7, 2019 at 12:45 am #205293In reply to: Get Number of Favorites & Subscription to a topic
Babblebey
ParticipantOk, so I’ve got this result, Robin!
Topic : 65 user_id: 1 array (size=1) 0 => string '149,65' (length=6) Topic : 65 user_id: 2 array (size=1) 0 => string '145,146,65' (length=10) 0I believe that should mean that User 1 and User 2 and currently subscribed to the topic But I still get a
0. The Replica of the Favorite should actually work but I don’t know..November 6, 2019 at 2:07 pm #205283In reply to: Get Number of Favorites & Subscription to a topic
Robin W
Moderatorhmm, can’t see why it shoudln’t work
try for test purposes
<?php $topic = bbp_get_topic_id(); $users = get_users() ; $countsub = 0; foreach ($users as $user) { $topicsub_list = array(get_usermeta ($user->id, 'wp__bbp_subscriptions', false)) ; echo '<br>Topic : '.$topic ; echo '<br>user_id: '.$user->id.'<br>' ; var_dump ($topicsub_list) ; if (in_array ($topic , $topicsub_list)) $countsub++ ; } echo $countsub; ?>that should help you find out where the problem is
November 6, 2019 at 9:59 am #205279Topic: Redirection using the logon shortcode
in forum TroubleshootingChuckie
ParticipantIf I attach a redirect_to parameter to the wp-login.php it will redirect to the topic.
But if I use my custom logon page that uses the defined shortcode it will not redirect. It seems the query parameters are stripped.
Please advise.
November 6, 2019 at 5:18 am #205272In reply to: Get Number of Favorites & Subscription to a topic
Babblebey
Participant<?php $topic = bbp_get_topic_id(); $users = get_users() ; $countsub = 0; foreach ($users as $user) { $topicsub_list = array(get_usermeta ($user->id, 'wp__bbp_subscriptions', false)) ; if (in_array ($topic , $topicsub_list)) $countsub++ ; } echo $countsub; ?>It didn’t work that way, Robin!
I got a
0in the result, even as i was sure there’s a subscription -
AuthorSearch Results