Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,851 through 4,875 (of 32,518 total)
  • Author
    Search Results
  • #187466
    mithrandir
    Participant

    To find the location of the template files navigate to:
    ‘wp-content/plugins/bbpress/templates/default/bppress/’

    You will find all the template parts in this folder. It is recommended to not modify the files directly, instead create a folder named bbPress in the ‘generatepress’ theme root folder. ie. ‘wp-content/themes/generatepress/bbpress/’ copy any files you wish to modify into this folder. This way updates to bbPress wont overwrite any files you have modified and your changes wont be lost.

    Test this by copying the content-archive-forum.php to the newly created bbpress folder and begin to modify the file.

    a simple php echo command will confirm it is working by printing a message at the top of the content-forum-archive template.

    <?php echo "Hello world!"; ?>

    The Example provided in the previous reply can be pasted on top, or wherever you would like to display the topics. Some formatting is required, by adding appropriate div classes and styling with css as necessary. Would be happy to help with any of the html, php or wordpress functions if there is any difficulty.

    *my apologies if this a duplicate reply, previous reply did not get submitted properly,spam protection may have blocked it, since it included links to screenshots on imgur.

    #187451
    mithrandir
    Participant

    The following functions would be useful:

    //to get the topic author name
    bbp_get_topic_author_display_name()

    //to get the forum title
    bbp_get_topic_forum_title()

    Example:

    <?php echo 'Started by: ' . bbp_get_topic_author_display_name(); ?>
    <?php echo 'in: ' . bbp_get_topic_forum_title(); ?>

    You would need to modify the respective template file, depending on where you would like to display the “topic info”

    If you could provide more information on what you are trying to achieve, would be happy to help out.

    #187437
    mithrandir
    Participant

    It is definitely possible, to do so you will have to modify the template ‘content-archive-forum.php’
    you could use a custom loop to loop through the topics you would like to display based on the user role.

    Example:

    <div class="Featued">
        <?php
        //get current users user role
        $role = bbp_get_user_display_role(get_current_user_id());
        //if role is keymaster,moderator or participant display topics
        if ($role == "Keymaster" || $role == "Moderator" || $role == "Participant") {
            ?>
            <!--begin loop-->
            <?php
            $args = array('post_type' => 'topic', 'posts_per_page' => 10);
            $the_query = new WP_Query($args);
            if ($the_query->have_posts()) :
                ?>
                <!--the loop-->
                <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
                    <div>
                        <a class=”bbp-topic-permalink” href="<?php bbp_topic_permalink(); ?>"title=”<?php bbp_topic_title(); ?>”><?php bbp_topic_title(); ?></a>
                    </div>
                <?php endwhile; ?>
                <!--  end of the loop-->
                <?php wp_reset_postdata(); ?>
            <?php else: ?>
                <p><?php __e('Sorry, no posts matched your criteria.'); ?> </p>
            <?php
            endif;
            ?>
            <?php
        } elseif ($role == "Guest" || $role == "Blocked") {
            //do nothing
        }
        ?>
    </div>

    It is not very complicated depending on your level of expertise, but will require some knowledge of php and wordpress. If you could provide more information regarding what you are trying to achieve or any areas you are facing difficulty with, I can try my best to help out.

    #187429
    mithrandir
    Participant

    The code below loops through specified number of topics in the forum. eg ‘posts_per_page’ => 100 .
    Please the read the link included below.

    if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => 'false', 'meta_key' => '_bbp_last_active_time', 'orderby' => 'meta_value', 'order' => 'DESC', 'post_parent' => 'any', 'posts_per_page' => 100 ) ) )
    		bbp_get_template_part( 'bbpress/loop', 'topics' );

    Link to topic:
    https://bbpress.org/forums/topic/display-list-of-topics-under-specific-forum/

    #187428
    sysix
    Participant

    Hello Guys,

    I think I have found a bug. But at first some Info from the System:

    WP version 4.8.2
    PHP version 7.0.22-0ubuntu0.16.04.1
    bbPress version 2.5.14-6684

    I want the hide the Tag-Input for all “normal” Users. So only the Keymaster and the mods can assign tags. I found, that I can hook into the capatiblities with bbp_get_caps_for_role and set the settings to false:

    `
    add_filter(‘bbp_get_caps_for_role’, function ($caps, $role) {
    // only the admin can delete and manage topic tags
    if (!in_array($role, [‘bbp_keymaster’])) {
    $caps[‘manage_topic_tags’] = false;
    $caps[‘delete_topic_tags’] = false;
    }

    // only mods and admin can edit or assign tags
    if (!in_array($role, [‘bbp_keymaster’, ‘bbp_moderator’])) {
    $caps[‘edit_topic_tags’] = false;
    $caps[‘assign_topic_tags’] = false;
    }

    return $caps;
    }, 10, 2);

    But the problem is, that in template\defaults\bbpress\form-reply.php we check with:

    <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) ) : ?>

    current_user_can calls WP_User->has_cap and there is $capabilities['assign_topic_tags'] = true.

    —–

    Workaround:

    `
    add_filter(‘user_has_cap’, function($caps, $metaCaps, $args) {
    $forumCaps = bbp_get_caps_for_role($args[0]);

    return array_merge($caps, $forumCaps);
    }, 10, 4);
    `

    #187420

    In reply to: Remove sidebar?

    mithrandir
    Participant

    The theme you are using is most likely overriding the bbpress default template, any template files you modify in the plugin folder are most likely being bypassed by theme or child theme. It would help to visit the bbpress codex which explains the template hierarchy in detail.

    Getting Started in Modifying the Main bbPress Template

    Step-by-Step Guide to Creating a Custom bbPress Theme

    I could try my best to help out if you could provide more information regarding which theme you are using, folder structure, child theme etc.

    #187419
    mithrandir
    Participant

    You would have to use a conditional statement comparing against, if it is the forum archive. Depending on your theme and how bbPress has been implemented, the location of the title may vary. I am by no means an expert, but I can try my best to help out if you could provide more information.

    <h1 class="entry-title main-title">
        <?php
        // Display title on all pages except forum archive
        if (!bbp_is_forum_archive()) {
            the_title();
        }
        ?>
    </h1>
    #187376

    In reply to: Small ticks all over

    ricklndn
    Participant

    Thats really cool how you figured that out and made some code that works.. thank you very much sir it worked.

    #187375

    In reply to: Small ticks all over

    Robin W
    Moderator

    ok you have css that does

    .inner-page-content article.article-content ul li::before {
    	content: "\f046";
    	font-family: FontAwesome;
    	color: #b6d91a;
    	position: absolute;
    	left: 0;
    }

    so if your theme has a custom css area, suggest you add the following

    .inner-page-content article.article-content ul li::before {
    	content: none !important;
    	}
    #187352
    paladinbrewer
    Participant

    Well that makes me sad 🙁 I guess I have no choice but to use the shortcode to manually build the forums on a page? Will that change how it loads as far as efficiency goes?

    That or pay someone to create a normal template for me for my theme 🙁

    #187348

    In reply to: Forum Freshness

    melodies
    Participant

    I know that changes made directly inside the bbPress plugin will be overridden during the next update, but I’m just wondering if in the meantime there is a line of code I could change within the plugin as a temporary fix?

    …Similar to the way the person who was experiencing the same problem in the link provided above did, stating: “In my case (Pacific Time) I needed to subtract 7 hours which translated to 25200 seconds” and made the temporary fix directly inside his install of the plugin.

    #187347
    Robin W
    Moderator

    As far as I can see your theme author has rewritten some (maybe all) of the theme templates, renaming all the bbpress css codes, to harmonise in with the theme, which effectively neuters my plugin.

    It would take considerable effort to change all that to make the two work.

    I think that is as far as I can help.

    #187334
    sbarkin
    Participant

    I created a custom page for the forum “home page”. bbPress has clickable breadcrumbs and “Forum” will load the default bbPress forum home, as such I added the following to my .htaccess to redirect the user to my custom page:

    RewriteEngine On
    RewriteRule /forums$ /the-forum

    This redirects the user:
    from: http://ok.thissiteworks.com/forums/ (bbPress forum home)
    to: http://ok.thissiteworks.com/the-forum/ (custom forum home)

    That works – but only for logged in users. When a user is not logged in the redirect does not work.

    1. Can someone advise why this would not work for not logged in users?
    2. Is there perhaps a better way to redirect the users to the custom page?
    #187326
    Robin W
    Moderator

    So I am trying your bbp style pack, it looks like I have a lot of options I’d like to use. Is there some particular short code I’m supposed to use? I tried:
    [bsp-display-forum-index forum= ‘46,50,52,54,56,59’]
    And in the bbp style pack settings -> Forum Templates, I changed it to “Alternative Forum Template 1” but I dont see any changes. Am I using the wrong shortcode?

    style pack will work against the standard forum code, so if you have a forum(s) displaying without style pack being activated, then it should work against that url with the changes

    ok, that is my plugin, and I’ll try to get to a resolution

    It may be as simple as closing and restarting your browser, so try this first !!

    If that doesn’t work…

    Style pack works with many/most sites, but it can fail due to a myriad of reasons, including (but no means limited to) site permissions, other plugins and most often site themes where the theme author has altered bbpress files.

    My plugin uses two different techniques to make changes.

    For some I change how bbpress sends information by changing or overwriting bbpress code, for some I change what is called css, which your browser uses to display information.

    Therefore some changes may take effect, whilst others don’t seem to.

    Additionally you may have :

    1. ‘caching’ software that speeds up the download of your site, but may not recognise and immediately make changes from my plugin
    Do you know if you are using caching software?
    2. Site permissions issues – you site might (quite validly for it) not allow my plugin to write code to certain areas
    Try
    Dashboard>settings>bbp style pack>css location
    check the activate box and set the location to
    wp-content/uploads/
    and save these changes

    For the template, are you able to look at the site files to see if your theme has a directory called bbpress ?

    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    #187321
    Robin W
    Moderator

    And it doesn’t end up the same, not really. Everytime bbpress is updated now I have to hope 20 different authors of 20 different plugins also update their code in a timely manner, and if any of them decide to stop the project I now lose functionality.

    not really here for a philosophical argument – that’s the way bbpress authors (which I am not) wrote it, and as free software they should be able to write what they want.

    I just write some additional plugins which again I do for free and yes I have to update for free, and provide some support here for free.

    #187319
    paladinbrewer
    Participant

    @robin-w
    So I am trying your bbp style pack, it looks like I have a lot of options I’d like to use. Is there some particular short code I’m supposed to use? I tried:
    [bsp-display-forum-index forum= ‘46,50,52,54,56,59’]
    And in the bbp style pack settings -> Forum Templates, I changed it to “Alternative Forum Template 1” but I dont see any changes. Am I using the wrong shortcode?

    #187318
    paladinbrewer
    Participant

    No answer to the other ones? 🙂

    And it doesn’t end up the same, not really. Everytime bbpress is updated now I have to hope 20 different authors of 20 different plugins also update their code in a timely manner, and if any of them decide to stop the project I now lose functionality.

    #187291

    In reply to: Forum Freshness

    Robin W
    Moderator

    correct place – I was guessing at whether the code will work, I’ll take a further look at it if I get a chance

    #187290
    roby80
    Participant

    Hi everybody, first post here! 😉

    I hope somebody can help me, since I’m having problems with the translation of a new bbPress installation… It’s kind of strange actually, because it seems to translate only part of the strings, but if I check my .mo & .po files they’re fully translated, just how it should be.

    I’ve been using WordPress for years but it’s the first time I used bbPress as well, so I followed these instructions religiously.
    (I actually only had to change the directory in which I put the .mo & .po files to wp-content/languages/plugins, since putting them in wp-content/languages/bbpress/ – I had to create this folder to try – like written in the documentation won’t work. After that I tried to put them in every other “logic” place that came to mind with no success)

    Here are a couple of screenshot to let me show my “half translated/half not” situation:
    EDIT: img’s won’t work so here are the links
    https://imgur.com/2PkKazk
    https://imgur.com/GHeexfT

    Thank you very much for any input!

    WordPress 4.8.2
    bbPress 2.5.14
    URL: http://www.guitarpub.it/forum/

    #187286
    rogerlridge
    Participant

    @robin-w I did a little digging and I found the piece of code responsible for logging the user’s visit based on the current page $page_url = sanitize_text_field($_SERVER['REQUEST_URI']);

    Would you know how to edit that to fit for bbp_forum_permalink(); so that it logs for each individual forum because I have the CBXUserOnline shortcode in the loop-single-forums.php file so I was hoping that it would recognise the views for each individual forum. Hopefully I’m making sense lol

    Please let me know if what I’ve said makes sense 🙂

    #187258

    In reply to: Echo Subscribe Link

    Robin W
    Moderator

    this should work

    add_filter ('bbp_before_get_user_subscribe_link_parse_args' , 'change_subscribe_link' ) ;
    
    function change_subscribe_link ($args) {
     $args ['subscribe'] = '<img src="http://www.mysite.com/image1.jpg" />' ;
     $args ['subscribe'] = '<img src="http://www.mysite.com/image1.jpg" />' ;
     
     return $args ;
    }
    #187254

    In reply to: Forum Freshness

    Robin W
    Moderator

    suggest you try this in your functions file

    add_filter ('bbp_convert_date', 'rew_convert_date', 10 , 3 ) ;
    
    function rew_convert_date ($time, $d, $translate) {
    $d = 'G' ;
    $time = mysql2date( $d, $time, $translate );
    return apply_filters( 'rew_convert_date', $time, $d, $translate );
    }

    may or may not work !

    vicky962
    Participant

    Dear team,

    I want to hide attachments and external Url’s for guest users, how can we do it, is there any plugin that can do it , or please send me code to achieve it.

    Thanks in Advance.

    Regards,
    Waqas

    #187252
    melodies
    Participant

    On my forum, the timestamp on the posts are 7 hours in the past.
    When a new post is made, it starts at “7 hours ago” rather than “just now,” “1 minute ago,” etc.

    The general time is set correctly in the WP > Dashboard > settings and all other timestamps displayed across the site are accurate (messages, notifications, etc). Only notifications relating to bbPress are off by 7 hours.

    This same issue can be found in an old thread post (Link below):

    The time zone is off by 7 hours in my bbpress plugin forums

    However, the solution in that post is outdated, since the code layout in has changed, and “line 178 in /wp-content/plugins/bbpress/bbp-includes/bbp-common-functions.php” no longer exists for manual alteration.

    Can you please tell me which file I can edit in bbPress to manually subtract 7 hours from the freshness output timestamp of all future forum posts?

    Thank you.

    #187213
    Robin W
    Moderator

    just had a quick look at what was in the free version, and looks like the pro version may have what you want – it claims

    Buddpress profile link integration (New in V1.0.4)
    BBpress profile link integration (New in V1.0.4)
    BBpress Online User Statistics (New in V1.0.5)

    maybe worth looking at

    CBX User Online for WordPress

Viewing 25 results - 4,851 through 4,875 (of 32,518 total)
Skip to toolbar