Search Results for 'code'
-
AuthorSearch Results
-
January 5, 2018 at 5:42 pm #189149
Robin W
ModeratorSORRY – just read you post again, and now I think I understand
on one site you want the code as above
on another site you just want a single post, but with title and date, but no link on the date – yes ?
if so then untested but this should be it
add_filter( 'bbp_get_forum_freshness_link', 'rew_freshness_no_date_link' , 100, 6) ; function rew_freshness_no_date_link($anchor, $forum_id, $time_since, $link_url, $title, $active_id ) { if (!empty ($active_id)) { ?> <a href="<?php bbp_topic_permalink($active_id); ?>"><?php bbp_topic_title(active_id) ?></a> (<?php bbp_topic_last_active_time(active_id); ?>) <?php } else echo 'No topics' ; }January 5, 2018 at 5:22 pm #189148Robin W
Moderatoryou’ve lost me now ๐
The key line that does the reference is
<a href="<?php bbp_topic_permalink($topic); ?>"><?php bbp_topic_title($topic) ?> (<?php bbp_topic_last_active_time($topic); ?>)</a>This translates as
<a href="[topic link]">[topic title] ([date])</a>which makes both the topic title and the date a single clickable link and the code shows 3 of these.
I’m not really sure what you are trying to achieve – I had thought you wanted 3 clickable links on both title and date, which is what the above does.
If you don’t want the date clickable, then do
<a href="<?php bbp_topic_permalink($topic); ?>"><?php bbp_topic_title($topic) ?></a> (<?php bbp_topic_last_active_time($topic); ?>)January 5, 2018 at 3:48 pm #189146In reply to: access control
Steve
ParticipantThanks for the link. I will check out your plugin. It may be what I need. Though still wondering about access control.
I am mostly confused by the “FORUM ACCESS” that is described here,
https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum/#5-%c2%a0forum-visibility-and-accessIt talks about viewing and posting permissions but doesn’t say WHERE it is. It is very frustrating.
Anybody know if these settings really exist and WHERE they are. Thanks.
January 5, 2018 at 3:40 pm #189144brent0r
ParticipantWhen I use your code above, I get the 3 last posts without a link on the date/time.
When I am not using your 3 last posts code (different site) from above, bbpress naturally links the last post.
How would I best go about removing just the link from a single last post in that example?I’ve figured that I could use your code as above but change to ($count == 1). I’m obviously not experienced with writing code but to me it seems an excessive way to go about it.
January 4, 2018 at 2:30 pm #189125In reply to: Display Topics name in dropdown in admin section
Robin W
ModeratorThe topic ID is a changeable box, so lets you change the id number. Lots of code would be needed to get it to work for titles, but this code will show the topic name in the box at the bottom
add_action( 'bbp_reply_metabox', 'rew_topic_title' ); function rew_topic_title ($post_id ) { $reply_topic_id = bbp_get_reply_topic_id( $post_id ); ?> <p> <strong class="label"><?php esc_html_e( 'Topic Title:', 'bbpress' ); ?></strong> <label class="screen-reader-text" for="bbp_author_id"><?php esc_html_e( 'Topic Title:', 'bbpress' ); ?></label> <?php bbp_topic_title ($reply_topic_id) ; ?> </p> <?php }Put this in your child theme function file
January 3, 2018 at 1:37 pm #189110Robin W
Moderatorin place of your code put back the original
<?php bbp_forum_freshness_link(); ?>and then add this to your functions file
add_filter( 'bbp_get_forum_freshness_link', 'rew_freshness_last_three' , 100, 6) ; function rew_freshness_last_three ($anchor, $forum_id, $time_since, $link_url, $title, $active_id ) { //set up and run a query to get a list of all topics in this forum that this user can see // Setup possible post__not_in array $post_stati[] = bbp_get_public_status_id(); // Super admin get whitelisted post statuses if ( bbp_is_user_keymaster() ) { $post_stati = array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id() ); // Not a keymaster, so check caps } else { // Check if user can read private forums if ( current_user_can( 'read_private_forums' ) ) { $post_stati[] = bbp_get_private_status_id(); } // Check if user can read hidden forums if ( current_user_can( 'read_hidden_forums' ) ) { $post_stati[] = bbp_get_hidden_status_id(); } } // Parse arguments against default values $r = array( 'post_parent' => $forum_id, 'post_type' => bbp_get_topic_post_type(), 'post_status' => implode( ',', $post_stati ), 'ignore_sticky_posts' => true, 'posts_per_page' => -1 ); // Create a new query for the topic list $get_posts = new WP_Query(); $topics = $get_posts->query( $r ) ; //var_dump ($topics) ; //now run through this list and get the last active date of each topic foreach ($topics as $topic) { $id = $topic->ID ; $last_active = get_post_meta( $id, '_bbp_last_active_time', true ); $curdate = strtotime($last_active); $show[$curdate] = $id ; } if (!empty ($show)) { //so now we have a list of dates with topic ids, so we need to find the latest 3 arsort($show); $count=0 ; foreach ($show as $topic) { $count++ ; ?> <a href="<?php bbp_topic_permalink($topic); ?>"><?php bbp_topic_title($topic) ?> (<?php bbp_topic_last_active_time($topic); ?>)</a> <?php if ($count == 3) break ; } } else echo 'No topics' ; }It has to sort through all topics for all forums to work this out, so it may slow your forums index display and get worse as your forum content grows.
January 3, 2018 at 11:31 am #189108In reply to: Forums page: where is it?
Robin W
Moderatorthe page is a virtual page
you can make it an actual wordpress page by following
Item 3 method 2
January 2, 2018 at 5:54 pm #189092brent0r
ParticipantI’ve managed to find a solution, I will add styling later to both topic title and date.
<a href="<?php bbp_forum_last_reply_url(); ?>"><?php bbp_forum_last_topic_title() && bbp_forum_last_topic_title(); ?> (<?php bbp_forum_last_active_time(); ?>)</a>I’d still love to find a way to display 3 last posts rather than just one.
January 2, 2018 at 5:50 pm #189091In reply to: Freshness Link
brent0r
ParticipantIs it possible to post your final, working code used?
January 2, 2018 at 12:55 pm #189089In reply to: Two URLs for same page
Robin W
Moderatornot quite sure what you last sentence means, but in essence if
dashboard>settings>forums>forum root slug>forum root equals ‘forums’, then create a page with the permalink of ‘forums’ and put
[bbp-forum-index]in it. You can then do your seo on that page
If you are using yoast seo, you may want to add this plugin as well – I haven’t yet looked at it, but seems to do some seo stuff on topics etc.
January 2, 2018 at 8:43 am #189079In reply to: blog subscription register with all forums
Robin W
Moderatoruser will get forum access as per
dashboard>settings>forums>auto role – you can change this to blocked if you don’t want automatic access.
The rest of your request would require some bespoke code, which is well beyond any free help I’m afraid.
January 1, 2018 at 6:16 pm #189071brent0r
ParticipantOn the forums index under Last Post I have:
“Title Of the Thread That Was Updated Most Recently”
“17 hours, 11 minutes ago”I am wanting to put the two on a single line.
eg. “Title of the Thread (7 hours, 11 minutes ago)”The area of the loop-single-forum file is as follows:
<li class="bbp-forum-freshness"> <?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?> <?php bbp_forum_freshness_link(); ?> <?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?> <p class="bbp-topic-meta"> <?php do_action( 'bbp_theme_before_topic_author' ); ?> <span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?></span> <?php do_action( 'bbp_theme_after_topic_author' ); ?> </p> </li>I’ve tried editing this quite a bit but all attempts have failed. Any tips or feedback on how I can display the Thread Title (time posted) on a single line would be greatly appreciated.
Thank you!
December 31, 2017 at 4:17 pm #189065tylertervooren
ParticipantThanks, Robin. I think I’m using a few of your plugins as well. ๐
The way I approached this plugin is that it’s only use is to print the url of the user profile. As you can see, no surrounding a tag and no anchor text. That means you can put it anywhere inside of your own links, which is probably even easier than trying to specify that with a shortcode attribute.
So, if the logged in/logged out part were added, it would still break, just in a different way. ๐
The idea is that, if you need to check for logged in/logged out status, you probably need to do it for multiple elements of your site. In that case, a separate plugin that does that is more useful and will work in harmony with this one.
Anyway, that was my thought process. Happy to hear other thoughts.
December 31, 2017 at 3:11 pm #189064Robin W
ModeratorI started with something very simple, so know the amount of work to publish a plugin and understand all the processes to that point – congratulations !!
you can fix the broken part by only executing if the user is logged in eg
change
function bbp_profile_link_shortcode() { $link = bbp_get_user_profile_url( bbp_get_current_user_id() ) ; return $link; }to
function bbp_profile_link_shortcode() { if (!is_user_logged_in()) return ; $link = bbp_get_user_profile_url( bbp_get_current_user_id() ) ; return $link; }This makes the function not display if the user isn’t logged in
December 30, 2017 at 2:19 pm #189041In reply to: Forum registration email from wordpress
Robin W
Moderatoruse this in your functions file and change the address to what you want
add_filter('bbp_get_do_not_reply_address','my_bbp_no_reply_email'); function no_reply_email(){ $email = 'noreply@yourdomain.com'; // any email you want return $email; }you can change that default to email address as well with :
add_filter('bbp_subscription_to_email','my_bbp_subscription_to_email'); function my_bbp_subscription_to_email(){ $email = 'noreply@yourdomain.com'; // any email you want return $email; }December 29, 2017 at 1:31 pm #189028Robin W
Moderatorjust loaded that plugin to my test site, and with auto-embed on it works fine.
This
<p>https://photos.app.goo.gl/pOeSirvJb5oC7kFC2</p>displays the embed just fine.
So all we now need to do is work out the difference between my test site and your staging site !!
When you’ve come back on the Q’s above, I’ll do some more digging.
December 28, 2017 at 11:56 am #189012In reply to: Custom Topic Sorting
Robin W
Moderatoruntested by this should work
//change topic order add_filter('bbp_before_has_topics_parse_args', 'rew_topic_order_by_meta'); function rew_topic_order_by_meta ($args) { $args['meta_key'] = 'put_meta_key_here' ; $args['orderby'] = 'meta_value' ; $args['order'] = 'DESC' ; //or ASC if needed return $args ; }just put your meta_key where it says
December 27, 2017 at 2:25 pm #189001In reply to: Organic Square, my powerfull BBPress hack.
peter-hamilton
ParticipantHi @brent0r
I made the following adjustment in my child-themeยดs loop-single-forum.php and styled with CSS.
This code will place all elements in the right order to have simple CSS adjustments make it all work as expected.<?php /** * Forums Loop - Single Forum * * @package bbPress * Theme OrganicSquare * Child-theme of TwentySixteen */ ?> <ul id="bbp-forum-<?php bbp_forum_id(); ?>" <?php bbp_forum_class(); ?>> <li class="bbp-forum-info"> <div class="forumtitle"> <?php do_action( 'bbp_theme_before_forum_title' ); ?> <a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>"><?php bbp_forum_title(); ?></a> <?php do_action( 'bbp_theme_after_forum_title' ); ?> <?php do_action( 'bbp_theme_before_forum_sub_forums' ); ?> <div class="bbp-forum-content"><?php bbp_forum_content(); ?></div> <?php do_action( 'bbp_theme_after_forum_sub_forums' ); ?> <?php do_action( 'bbp_theme_before_forum_description' ); ?> <?php do_action( 'bbp_theme_after_forum_description' ); ?> <?php bbp_forum_row_actions(); ?></div> </li> <li class="bbp-forum-topic-count"> <div class="topic-reply-counts">Topics: <span class="ismcounter"><?php bbp_forum_topic_count(); ?></span></div> <div class="topic-reply-counts">Posts: <span class="ismcounter"><?php bbp_show_lead_topic() ? bbp_forum_reply_count() : bbp_forum_post_count(); ?></span></div> </li> <li class="bbp-topic-freshness mob-hide-link-forum"> <?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?> <div class="freshness-author"><span class="fresh-avatar"><?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'type' => 'avatar', 'size' => '40' ) ); ?></span> <div class="fresh"><h2><a href=" <?php bbp_forum_last_reply_url(); ?>" class="forumpostlink"><?php bbp_forum_last_reply_title(); ?></a></h2> <span class="forumlist-name"><?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'type' => 'name' ) ); ?></span> <span class="widgetlistdate"><?php bbp_forum_freshness_link(); ?></span></div> <?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?> </div> </li> </ul><!-- #bbp-forum-<?php bbp_forum_id(); ?> -->December 27, 2017 at 10:33 am #188991In reply to: Size of box for listing sub forums
Robin W
Moderatoryou have total height constrained by
#bbpress-forums li.bbp-body ul.forum { border-top: 0; height: 90px; }so
#bbpress-forums li.bbp-body ul.forum { height: auto !important; }December 26, 2017 at 5:11 pm #188981In reply to: Size of box for listing sub forums
Robin W
ModeratorLine 4255 of your theme Pixiehuge has
#bbpress-forums li.bbp-body ul.forum li { height: 100%; display: flex; display: -webkit-flex; flex-direction: column; -webkit-flex-direction: column; justify-content: center; -webkit-justify-content: center; }The height : 100% is the issue
You need to put
#bbpress-forums li.bbp-body ul.forum li { height: auto; }or
#bbpress-forums li.bbp-body ul.forum li { height: auto !important; }(Try without the !important first)
into your theme’s custom css, or the custom css part of my bbp style pack plugin
December 24, 2017 at 5:46 pm #188955Robin W
Moderatoryou can simply filter this in your theme’s function file.
not tested but
add_filter( 'bbp_number_format', 'rew_number_format', 10 , 5) ; function rew_number_format ($number_format, $number, $decimals, $dec_point, $thousands_sep) { $thousands_sep = '' ; return apply_filters( 'rew_number_format', number_format( $number, $decimals, $dec_point, $thousands_sep ), $number, $decimals, $dec_point, $thousands_sep ); }December 24, 2017 at 2:02 pm #188951In reply to: Forum Index Order by Freshness
Robin W
ModeratorI’ve fixed that in the style pack plugin with version 3.7.2
for anyone using the function above it should read
function rew_forum_order_by_freshness ($args) { $args['meta_key'] = '_bbp_last_active_time' ; $args['orderby'] = 'meta_value' ; $args['order'] = 'DESC' ; return $args ; } add_filter('bbp_before_has_forums_parse_args', 'rew_forum_order_by_freshness');which just changes the order, rather than the previous function which overwrites all the parameters submitted by subscriptions
December 24, 2017 at 10:36 am #188950In reply to: Argghh.. I can’t turn off the indent
Robin W
Moderatorit’s caused by
#bbpress-forums .reply { margin-left: 0 !important; width: auto !important; }which says it is inline code.
The width: auto !important needs to be width :100% !important.
Auto makes it only as wide as it needs to be, so for short sentences it truncates.
But I’m also getting an error saying that your “sydney-child-theme/style.css could not be loaded”
December 23, 2017 at 9:19 pm #188942In reply to: CODE Tags Feature Request
posemotion
ParticipantI was able to edit the style.css to get what I was looking for. Line 207. Compare and change.
code, kbd, tt, var, samp, pre { font-family: monospace, serif; font-size: 10px; -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; hyphens: none; line-height: 1.6; } code, pre { border: 1px solid rgba(0, 0, 0, 0.1); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; margin-bottom: 24px; max-width: 100%; overflow: auto; padding: 12px; white-space: pre; white-space: pre-wrap; word-wrap: break-word; }December 23, 2017 at 2:14 pm #188939dobosalina
ParticipantThis is the code
function bp_redirect($user) $redirect_url = ""; if (defined('ICL_LANGUAGE_CODE')) { switch (ICL_LANGUAGE_CODE) { case 'fr': $redirect_url = "https://volunteerteacher.org/fr/enregistrement-avec-succes/"; break; default: $redirect_url = 'https://volunteerteacher.org/registration-successful/"'; break; } bp_core_redirect($redirect_url); } return $redirect_url; } add_action('bp_core_signup_user', 'bp_redirect', 100, 1); -
AuthorSearch Results