Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 10,076 through 10,100 (of 32,504 total)
  • Author
    Search Results
  • #154860
    Paolo
    Participant

    I’ve found this on github and modified it a bit.

    //Close forum topics inactive for more than 30 days
    
    add_action('bbpress_daily_event', 'bbpress_close_old_topics');
    function bbpress_topic_scheduler() {
    wp_schedule_event(time(), 'daily', 'bbpress_daily_event');
    }
    function bbpress_close_old_topics() {
    // Auto close old topics
    $topics_query = array(
    'author' => 0,
    'show_stickies' => false,
    'parent_forum' => 'any',
    'post_status' => 'publish',
    'posts_per_page' => -1
    );
    if ( bbp_has_topics( $topics_query ) )
    while( bbp_topics() ) {
    bbp_the_topic();
    $topic_id = bbp_get_topic_id();
    $last_active = strtotime( get_post_meta( $topic_id, '_bbp_last_active_time', true ) );
    if ($last_active < strtotime( '-30 days') )
    bbp_close_topic( $topic_id );
    }
    }
    

    I’m using it on the support forum of our Business directory plugin.

    Hope you can find it useful too.

    Thx

    #154852

    In reply to: Photo in Latest posts

    Icaroferreira
    Participant

    Thank you.

    So, Please, where exactly I should enter these codes above, within my code I have in the folder: loop-single-topic.php

    see:

    <?php

    /**
    * Topics Loop – Single
    *
    * @package bbPress
    * @subpackage Theme
    */

    ?>

    <ul id=”bbp-topic-<?php bbp_topic_id(); ?>” <?php bbp_topic_class(); ?>>

    <li class=”bbp-topic-title”>

    <?php if ( bbp_is_user_home() ) : ?>

    <?php if ( bbp_is_favorites() ) : ?>

    <span class=”bbp-row-actions”>

    <?php do_action( ‘bbp_theme_before_topic_favorites_action’ ); ?>

    <?php bbp_topic_favorite_link( array( ‘before’ => ”, ‘favorite’ => ‘+’, ‘favorited’ => ‘×’ ) ); ?>

    <?php do_action( ‘bbp_theme_after_topic_favorites_action’ ); ?>

    </span>

    <?php elseif ( bbp_is_subscriptions() ) : ?>

    <span class=”bbp-row-actions”>

    <?php do_action( ‘bbp_theme_before_topic_subscription_action’ ); ?>

    <?php bbp_topic_subscription_link( array( ‘before’ => ”, ‘subscribe’ => ‘+’, ‘unsubscribe’ => ‘×’ ) ); ?>

    <?php do_action( ‘bbp_theme_after_topic_subscription_action’ ); ?>

    </span>

    <?php endif; ?>

    <?php endif; ?>

    <?php do_action( ‘bbp_theme_before_topic_title’ ); ?>

    “><?php bbp_topic_title(); ?>

    <?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
    if (class_exists(‘userpro_api’)) {
    /* Integrating UserPro */
    global $userpro;
    $link = preg_replace(“/(?<=href=(\”|’))[^\”‘]+(?=(\”|’))/”, $userpro->permalink( bbp_get_topic_author_id() ),
    bbp_get_topic_author_link( array( ‘size’ => 14 ) ) );
    } else {
    $link = bbp_get_topic_author_link( array( ‘size’ => ’14’ ) );
    }
    ?>

    <span class=”bbp-topic-started-by”><?php printf( __( ‘Started by: %1$s’, ‘bbpress’ ), $link ); ?></span>

    <?php do_action( ‘bbp_theme_after_topic_started_by’ ); ?>

    <?php if ( !bbp_is_single_forum() || ( bbp_get_topic_forum_id() !== bbp_get_forum_id() ) ) : ?>

    <?php do_action( ‘bbp_theme_before_topic_started_in’ ); ?>

    <span class=”bbp-topic-started-in”><?php printf( __( ‘in: %2$s‘, ‘bbpress’ ), bbp_get_forum_permalink( bbp_get_topic_forum_id() ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></span>

    <?php do_action( ‘bbp_theme_after_topic_started_in’ ); ?>

    <?php endif; ?>

    </p>

    <?php do_action( ‘bbp_theme_after_topic_meta’ ); ?>

    <?php bbp_topic_row_actions(); ?>

    <li class=”bbp-topic-voice-count”><?php bbp_topic_voice_count(); ?>

    <li class=”bbp-topic-reply-count”><?php bbp_show_lead_topic() ? bbp_topic_reply_count() : bbp_topic_post_count(); ?>

    <li class=”bbp-topic-freshness”>

    <?php //bbp_topic_freshness_link(); ?>

    <p class=”bbp-topic-meta”>

    <?php do_action( ‘bbp_theme_before_topic_freshness_author’ ); ?>
    <?php
    if (class_exists(‘userpro_api’)) {
    global $userpro;
    $link = preg_replace(“/(?<=href=(\”|’))[^\”‘]+(?=(\”|’))/”, $userpro->permalink( bbp_get_topic_author_id( bbp_get_topic_last_active_id() ) ), bbp_get_author_link( array( ‘post_id’ => bbp_get_topic_last_active_id(), ‘size’ => 30 ) ) );
    } else {
    $link = bbp_get_author_link( array( ‘post_id’ => bbp_get_topic_last_active_id(), ‘size’ => 14 ) );
    }
    ?>

    <span class=”bbp-topic-freshness-author”><?php echo $link; ?></span>

    <?php do_action( ‘bbp_theme_after_topic_freshness_author’ ); ?>

    </p>

    <!– #bbp-topic-<?php bbp_topic_id(); ?> –>

    #154848
    sidelancer
    Participant

    The template did change to the new php file, but removing the code did not remove the ad unfortunately. I tried removing other code but nothing seems to affect it.

    edit: I’d love to just hide the ad with CSS, but the problem is that is against google policy.

    #154844
    Robin W
    Moderator

    I suspect it is the loop-single-forum template

    create a directory on your theme called ‘bbpress’
    ie wp-content/%your-theme-name%/bbpress
    find
    wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/%your-theme-name%/bbpress/loop-single-forum.php
    bbPress will now use this template instead of the original

    then

    remove lines 20 and 24

    line 20

    <?php do_action( 'bbp_theme_before_forum_subscription_action' ); ?>
    

    line 24

    <?php do_action( 'bbp_theme_after_forum_subscription_action' ); ?>
    

    come back if that doesn’t work

    #154841
    izzyian
    Participant

    @robin-w

    Hi, no this does not work :

    function role_show ($args) {
    $displayed_user = bbp_get_reply_author_id() ;
    $role = bbp_get_user_role( $displayed_user);
    if ( bbp_is_user_keymaster($displayed_user) ||$role == 'bbp_moderator')  $args['show_role'] = true ;
    else $args['show_role'] = false ;
    return $args ;
    }
    add_filter ('bbp_before_get_reply_author_link_parse_args', 'role_show' )

    This is a screen shot of that result :
    http://bitfiu.com/wp-content/uploads/2014/11/functions-picture.png

    #154838
    Stephen Edgar
    Keymaster

    Sounds great, have at it 🙂

    Check out and edit the Google doc here.

    General guidelines on creating new codex articles:

    Codex Standards & Guidelines

    Make a copy of this template for each page you create:
    https://codex.bbpress.org/wp-admin/post.php?post=1767&action=edit

    #154837
    sidelancer
    Participant

    Yep, here it is:

    Adsense Ad

    I’ve looked at it with Firebug, it’s the same header ad that I have showing up on all my other pages (except there it is ABOVE the page, not within it). I also tried putting php code around the ad to stop it on specific page numbers, but that didn’t seem to work either.

    #154835
    Robkk
    Moderator

    i think that these topics should be discussed in a guide for users in the codex.

    How to Moderate in bbPress
    How to Deal with SPAM
    SEO and bbPress
    Common Mistakes to Avoid

    How to Moderate is for users who are brand new to dealing with a forum, and are not sure how to handle it.

    Dealing with SPAM will definitely be useful because alot of users make topics about how to handle it.

    SEO and bbPress , there is some topics about this subject and help optimizing it would be quite useful.

    Common mistakes is useful too so that users know what not to do.

    what do you guys think??

    #154821
    Robkk
    Moderator

    @elenams

    i thought i replied to this one..

    pretty much the plugins stlye.css file will get you headed into styling bbPress the way you want it.

    you copy the style.css file from the bbPress plugin folder and put it into a folder called css in your child theme then edit the new style.css file from there.

    if its just small changes you can also put it into a custom css plugin of your choice.

    more information on styling bbPress can be found in the codex

    Codex

    Robkk
    Moderator

    this is not CSS its mostly PHP

    from what it looks like just copy the templates the userpro plugin author gave you and place it a folder called bbpress in your child theme. the url to it should be wp-content/themes/avada-child/bbpress.

    info on creating a child theme

    https://codex.wordpress.org/Child_Themes

    #154817
    Robkk
    Moderator

    well it looks nice how it is already but thats my opinion.

    but if you really want the default bbPress look , i think all you have to do is copy loop-single-topic.php from the bbPress plugin templates and let it overwrite the exact file in your child themes bbpress folder.

    i suggest you test it out and make sure it works well in a local development area on your CPU.

    https://codex.bbpress.org/creating-a-test-site/

    #154815

    In reply to: Truncated usernames

    Robkk
    Moderator

    huh?? i thought i replied already..

    well its font-color: black;

    and just using color:black; works too

    any other CSS tips checkout the guides on styling bbPress in the docs

    Codex

    #154812

    In reply to: No spacing in posts.

    Robkk
    Moderator

    @foresme

    try this.

    if it doesnt work reply back

    #bbpress-forums .bbp-topic-content p,
    #bbpress-forums .bbp-reply-content p {
    margin-bottom:10px;
    }
    Robin W
    Moderator

    try

    function role_show ($args) {
    

    as your first line

    #154780

    In reply to: Unique member names

    peter-hamilton
    Participant

    Been a while, spent quite a lot of time looking for a solution for the “name” issue.

    Wordpress registration checks if a “username” is already used, this is great.

    Buddypress is the problem cause they also add a “Name” field to registration, and this can be duplicate creating issues when multiple John Doe’s appear in my forums and activity.

    Solution

    I created a dirty solution by changing the label for (buddypress) Name to Username, and added a line of text urging new members to fill in the exact same name as the did in the “Username” field.

    Although people can type whatever they want there, I hope most will just copy the first name.

    This way the @name and username should be similar on all pages.

    Then I also removed the option to change this name in the profile edit.php through CSS so no longer can people change their nicknames.
    Unless a code savvy member goes to change the CSS in chrome, then the box will appear and they can change their names.

    Wishlist

    A solution/function where Buddypress or BBpress copies the username and adds that in the nickname field by default.

    Anyway, here is a link to my current register page:

    BBFacelook registration page

    P.H.

    #154775
    galiulinr
    Participant

    Here’s the code works for me:

    <?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
    <!-- The Loop -->
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <l i>
                <a hr ef="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
                <?php the_title(); ?></ a>,
                <?php the_time('d M Y'); ?> in <?php the_category('&');?>
            </l i>
        <?php endwhile; else: ?>
            < p><?php _e('No posts by this author.'); ?></ p>
        <?php endif; ?>
    <!-- End Loop --> 
    #154767

    In reply to: Truncated usernames

    Robkk
    Moderator

    add to the existing code you are using.

    font-weight: bold;

    #154766
    galiulinr
    Participant

    I added the following code in your theme function:

    
    function get_related_author_posts() {
        global $authordata, $post;
        $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) );
        foreach ( $authors_posts as $authors_post ) {
            $output .= '<l i>< a>ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</ a></l i>';
        }
        return $output;
    }
    

    On page user-profile.php, I put the following code:
    <?php echo get_related_author_posts(); ?>

    It shows 5 posts, but I want to show only the for profile author of this posts. Now it shows all the user profiles.Each author should have a list of posts in the profile. Tell me how to do it.

    #154756
    sidelancer
    Participant

    I’m using the Easy Adsense plugin and I would like to prevent it from showing an ad on my forum pages. The plugin does have a custom field to disable ads on specific pages, but the problem is that it only disables ads that are outside the forum area (the header and the sidebar), NOT the ad that is showing inside of the forum content area.

    Does anyone know where I could insert/delete some code to stop it from showing up?

    #154749
    Robin W
    Moderator

    suggest you read

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

    in particular section 6 that talks about adding a register page and putting this into your menu

    and yes bbpress will work alongside buddypress

    #154738

    In reply to: Truncated usernames

    Robkk
    Moderator

    i took this css right from bbpress.org

    add this anywhere you can add custom css
    if it doesnt work add !important to the end like this 12px!important;

    #bbpress-forums div.bbp-reply-author a.bbp-author-name, 
    #bbpress-forums div.bbp-topic-author a.bbp-author-name {
    clear: left;
    display: block;
    font-size: 12px;
    }

    the default size i think is usually 12px
    so either use that or go lower

    #154730
    atfpodcast
    Participant

    Sorry it was my phone. I tried to say after looking at it the bbcode was working. It was the htlm bar from bbpress that is not coming up in my firefox…

    #154720
    Robkk
    Moderator

    try adding this anywhere you can put custom css

    #bbpress-forums #qt_bbp_reply_content_toolbar input {
    color: black;
    }
    alekbounce
    Participant

    Hi everyone!

    I’m using a members plugin called UserPro. I’m trying to integrate bbPress forums with the user profiles created through UserPro.

    All I’m trying to do is replace the user’s photo and username links to instead link to the UserPro profiles.

    Here’s a visual.

    The plugin’s developer gave users his own CSS changes to the “Loop-single-topic”, “Loop-single-reply” and the “loop-single-forum” .php files.

    Though his supplied CSS works in terms of replacing the links, it also breaks the look of the entire forum and removes all of the info below the user’s pic and name.

    Here’s the default “loop-Single-reply”:

    <?php
    
    /**
     * Replies Loop - Single Reply
     *
     * @package bbPress
     * @subpackage Theme
     */
    
    ?>
    
    <div <?php bbp_reply_class(); ?>>
    
    	<div class="bbp-reply-author">
    
    		<?php do_action( 'bbp_theme_before_reply_author_details' ); ?>
    
    		<?php bbp_reply_author_link( array( 'sep' => '', 'show_role' => true ) ); ?>
    
    		<div class="bbp-reply-post-date"><?php bbp_reply_post_date(); ?></div>
    
    		<div class="bbps-post-count"><?php printf( __( 'Post count: %s', 'Avada' ), bbp_get_user_reply_count_raw(bbp_get_reply_author_id()) ); ?></div>
    
    		<?php if ( bbp_is_user_keymaster() ) : ?>
    
    			<?php do_action( 'bbp_theme_before_reply_author_admin_details' ); ?>
    
    			<div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_reply_id() ); ?></div>
    
    			<?php do_action( 'bbp_theme_after_reply_author_admin_details' ); ?>
    
    		<?php endif; ?>
    
    		<?php do_action( 'bbp_theme_after_reply_author_details' ); ?>
    
    	</div><!-- .bbp-reply-author -->
    
    	<div class="bbp-reply-content">
    
    		<div id="post-<?php bbp_reply_id(); ?>" class="bbp-reply-header clearfix">
    
    			<div class="bbp-meta">
    
    				<?php if ( bbp_is_single_user_replies() ) : ?>
    
    					<span class="bbp-header">
    						<?php _e( 'in reply to: ', 'bbpress' ); ?>
    						<a class="bbp-topic-permalink" href="<?php bbp_topic_permalink( bbp_get_reply_topic_id() ); ?>"><?php bbp_topic_title( bbp_get_reply_topic_id() ); ?></a>
    					</span>
    
    				<?php endif; ?>
    
    				<a href="<?php bbp_reply_url(); ?>" class="bbp-reply-permalink">#<?php bbp_reply_id(); ?></a>
    
    				<?php do_action( 'bbp_theme_before_reply_admin_links' ); ?>
    
    				<?php bbp_reply_admin_links( array ( 'after' => '<span class="admin_links_sep"> | </span></span>') ); ?>
    
    				<?php do_action( 'bbp_theme_after_reply_admin_links' ); ?>
    
    			</div><!-- .bbp-meta -->
    
    		</div><!-- #post-<?php bbp_reply_id(); ?> -->
    
    		<div class="bbp-reply-entry">
    			<?php do_action( 'bbp_theme_before_reply_content' ); ?>
    
    			<?php bbp_reply_content(); ?>
    
    			<?php do_action( 'bbp_theme_after_reply_content' ); ?>
    			<div class="bbp-arrow"></div>
    		</div>
    
    	</div><!-- .bbp-reply-content -->
    
    </div><!-- .reply -->
    

    Here’s his supplied CSS:

    <?php
    
    /**
     * Replies Loop - Single Reply
     *
     * @package bbPress
     * @subpackage Theme
     */
    
    ?>
    
    <div <?php bbp_reply_class(); ?>>
    
    	<div class="bbp-reply-author">
    
    		<?php do_action( 'bbp_theme_before_reply_author_details' ); ?>
    
    		<?php 
    
    /* Integrating UserPro */
    		global $userpro;
    		$link = preg_replace("/(?<=href=(\"|'))[^\"']+(?=(\"|'))/", $userpro->permalink( bbp_get_reply_author_id() ), 
    		bbp_get_reply_author_link( array( 'sep' => '<br />', 'show_role' => false ) ) );
    		echo $link . userpro_show_badges( bbp_get_reply_author_id() );
    		?>
    
    		<?php if ( bbp_is_user_keymaster() ) : ?>
    
    			<?php do_action( 'bbp_theme_before_reply_author_admin_details' ); ?>
    
    			<div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_reply_id() ); ?></div>
    
    			<?php do_action( 'bbp_theme_after_reply_author_admin_details' ); ?>
    
    		<?php endif; ?>
    
    		<?php do_action( 'bbp_theme_after_reply_author_details' ); ?>
    
    	</div><!-- .bbp-reply-author -->
    
    	<div class="bbp-reply-content">
    
    		<?php do_action( 'bbp_theme_before_reply_content' ); ?>
    
    		<?php bbp_reply_content(); ?>
    
    		<?php do_action( 'bbp_theme_after_reply_content' ); ?>
    
    	</div><!-- .bbp-reply-content -->
    
    </div><!-- .reply -->
    

    I would be grateful to get any assistance on how I might change the links alone without modifying or breaking everything else. Thanks so much in advance.

    I’m using the Avada theme.

    cvf
    Participant

    Hey there,

    I have a forum on my website but the BBcode buttons have white text which makes them practically invisible. Is there custom CSS I can apply to make the font color of these buttons black? I’ve attached an image.

Viewing 25 results - 10,076 through 10,100 (of 32,504 total)
Skip to toolbar