Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,626 through 4,650 (of 32,481 total)
  • Author
    Search Results
  • Robin W
    Moderator

    SORRY – 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' ;
    }
    Robin W
    Moderator

    you’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); ?>)

    #189146

    In reply to: access control

    Steve
    Participant

    Thanks 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-access

    It 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.

    brent0r
    Participant

    When 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.

    #189125
    Robin W
    Moderator

    The 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

    Functions files and child themes – explained !

    Robin W
    Moderator

    in 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.

    #189108
    Robin W
    Moderator

    the page is a virtual page

    you can make it an actual wordpress page by following

    Step by step guide to setting up a bbPress forum – Part 1

    Item 3 method 2

    brent0r
    Participant

    I’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.

    #189091

    In reply to: Freshness Link

    brent0r
    Participant

    Is it possible to post your final, working code used?

    #189089

    In reply to: Two URLs for same page

    Robin W
    Moderator

    not 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.

    BBpress Addon For Yoast SEO

    #189079
    Robin W
    Moderator

    user 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.

    brent0r
    Participant

    On 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!

    tylertervooren
    Participant

    Thanks, 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.

    Robin W
    Moderator

    I 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

    #189041
    Robin W
    Moderator

    use 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;
    }
    Robin W
    Moderator

    just 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.

    #189012

    In reply to: Custom Topic Sorting

    Robin W
    Moderator

    untested 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

    #189001
    peter-hamilton
    Participant

    Hi @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(); ?> -->
    #188991
    Robin W
    Moderator

    you 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;
    }
    #188981
    Robin W
    Moderator

    Line 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

    Robin W
    Moderator

    you 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 );
    }
    #188951
    Robin W
    Moderator

    I’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

    #188950
    Robin W
    Moderator

    it’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”

    #188942
    posemotion
    Participant

    I 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;
    }
    dobosalina
    Participant

    This 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);
    
    
Viewing 25 results - 4,626 through 4,650 (of 32,481 total)
Skip to toolbar