Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 9,076 through 9,100 (of 32,519 total)
  • Author
    Search Results
  • #160542
    andrew55
    Participant

    Got it – This seems to work for showing the first role:

    <?php
    $user = new WP_User( bbp_get_reply_author_id() );
    echo $user->roles[0];
    ?>
    #160537
    novicechess
    Participant

    I’ve found the solution, and it turned out I needed a “container” edit. The code I ended up using was as follows

    #container {
    width: 690px;
    padding: 30px 30px 0;
    }

    #content {
    float: left;
    width: 455px;
    }

    .singlecol #content {
    float: none;
    width: 550px;
    }

    #160534

    Hi Robin,

    “having it exist as /mysite.com/forum”

    would be the perfect solution for me, since my standalone bbpress is already at /mysite.com/forum/, and my wordpress blog is at /mysite.com/blog/ (they are both in production).

    Would your solution work in my case?

    Where exactly should I add the shortcode [bbp-forum-index]?

    Thank you very much!

    Robin W
    Moderator

    great, putting it in the template is equally fine, BUT make sure you put that template into a child theme, else plugin and theme updates will destroy it.

    Functions files and child themes – explained !

    #160524
    andrew55
    Participant

    I’m very happy to have found this – very useful.

    Question – any suggestions on how to adjust the code to where subscribers can also view the role of other users.

    Thanks for any help.

    #160522
    23creative
    Participant

    Hey Guys,

    i have just completed this functionlaity for my site. i wanted to use a jquery chosen as opposed to a text input so in my themes functions.php file i added the following:

    function restrict_topic_tags( $terms, $topic_id, $reply_id ) {
       $terms = bbp_get_topic_tag_names( $topic_id );
       foreach ($_POST['bbp_topic_tags'] as $topicTags){
          $terms .= ', '.esc_attr( strip_tags( $topicTags ) );
       }
       return $terms;
    }
    add_filter( 'bbp_new_reply_pre_set_terms', 'restrict_topic_tags' );
    
    function displayTagElements($selectedTags){
        $html = array();
        $tags = get_categories( array('hide_empty'=> 0,'taxonomy' => 'topic-tag'));
        $selectedTags = explode(', ', $selectedTags);
        //die(var_dump($selectedTags));
        $html[] = '<select class="chzn-select" multiple="multiple" name="bbp_topic_tags[]" id="bbp_topic_tags">';
            foreach($tags as $tag){
                $selected = '';
                if (in_array($tag->name, $selectedTags)) {
                   $selected = 'selected="selected"';
                }
                $html[] = '<option '.$selected.' value="'.$tag->slug.'">'.$tag->name.'</option>';
            }
        $html[] = '</select>';
        return implode('',$html);
    }

    then in my bbpress custom theme files (form-reply.php, any others that had the reply form. I’m sure there is more than one i haven’t fully checked yet) i added the following code at line 75

    <p>
        <label for="bbp_topic_tags"><?php _e( 'Tags:', 'bbpress' ); ?></label><br />
        <?php echo displayTagElements(bbp_get_form_topic_tags()); ?>
    </p>
    #160520
    andrew55
    Participant

    Wow – thanks for taking the time to create this. Much appreciated. I’m a realist, not so much of a purist!

    Unfortunately, I am getting this error in the profile area of all topics and replies:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'andrew55_insert_field ' not found or invalid function name in /home/mysite/wp-includes/plugin.php on line 496

    I tried function with both “bbp buddypress profile information” and “bbp profile information” installed.

    Another idea – instead of pestering for help with advanced php functions, what about just throwing the snippet I have in a template file in my child theme?

    I’ve been looking, but I can’t find the correct template file that controls the “user profile area” for the topics and replies when viewing a single topic. Any suggestions on where I might find this file so I can give it a try? It seems like it would be loop-single-topic.php, but that is for the view for all the topics together.

    I’m still new to bbPress and am finding it tricky to learn my way around the files – but I’m getting there!

    Thanks for any suggestions.

    #160516
    Robin W
    Moderator

    ok assuming it works it just needs wrapping into a function, and then adding to the action so :

    <?php
    Function andrew55_insert_field () {
    require_once '/home/site/public_html/amember/library/Am/Lite.php';
    if (Am_Lite::getInstance()->haveSubscriptions(2))
    {
    ?>
    <p>custom text 1</p>
    <?php
    }
    else {
    if (Am_Lite::getInstance()->isLoggedIn())
    {
    ?>
    <p>custom text 2</p>
    <?php
    }
    else {
    ?>
    <p>custom text 3</p>
    <?php
    }
    }
    }
    

    which could be shortened to

    Function andrew55_insert_field () {
    require_once '/home/site/public_html/amember/library/Am/Lite.php';
    if (Am_Lite::getInstance()->haveSubscriptions(2)) echo '<p>custom text 1</p>' ;
    elseif (Am_Lite::getInstance()->isLoggedIn() ) echo '<p>custom text 2</p>' ;
    else echo '<p>custom text 3</p>' ;
    }
    
    add_action (‘bbp_theme_after_reply_author_details’, ‘andrew55_insert_field ’) ;

    that might upset the purists who seem to love have php statements all over their code, but makes it more readable – apologies if you’re in the purist camp 🙂

    You need to put this code into your functions file, so that it is automatically called when the action is executed

    Functions files and child themes – explained !

    #160512
    andrew55
    Participant

    Thanks – this is a great start. Although, my skill level just isn’t there yet with writing functions for WordPress. Here is the php snippet I have that will create the value I need to have displayed in profile area of topics and replies:

    <?php
    require_once '/home/site/public_html/amember/library/Am/Lite.php';
    if (Am_Lite::getInstance()->haveSubscriptions(2))
    {
    ?>
    <p>custom text 1</p>
    <?php
    }
    else {
    if (Am_Lite::getInstance()->isLoggedIn())
    {
    ?>
    <p>custom text 2</p>
    <?php
    }
    else {
    ?>
    <p>custom text 3</p>
    <?php
    }
    }
    ?>

    If anyone is willing to help, that would be great.

    #160494
    Jake Hall
    Participant

    Hi All,

    I am working on making bbPress work with my current theme, and, previously it was using page.php properties to draw the forum etc. I fixed that by adding a bbpress file to the theme root, however, I am not getting any posts whatsoever appear when looking in topics.

    Does bbPress use the normal the_content(); functions that wordpress use, or are their different functions I am simply missing here?

    The Codex is really bad and doesn’t seem to explain any of this, but I’d be super happy if someone could prove me wrong on that.

    Thanks,

    Jake

    Robkk
    Moderator

    you can tag anybody that is not in the topic manually.

    just type @username

    im talking about the little dropdown that suggests people to @mentino that is shown in this image that will show only people in the topic.

    here is the code any where i got it from

    Add the New BuddyPress Mentions Interface to bbPress Forum Replies

    BBC
    Participant

    Hi Rob

    I have an extra question
    If I read your post for the second time
    It looks if I can only tag people who are already in the threat
    Is that correct?
    Or can I (with your code) tag everyone who is one the forum?
    That is what I am looking for.

    Hope to hear from you.
    Thank Conrad

    #160483
    WutHirsch
    Participant

    Not completely.
    But the mythemeshop support helped me a lot.

    The correct code is:

    .bbpress .sidebar.c-4-12 {
      display: none;
    }
    .bbpress .article {
      width: 100%;
    }

    Also i was able to change the breadcrumb / the forum base title into another word.
    Simply add this code into: bbpress.php:

    
    // bbPress, change Forum title in bbpress 
     
    function isa_custom_forum_title() {
     
         return 'Enter your title';
    }
     
    add_filter('bbp_get_forum_archive_title', 'isa_custom_forum_title');
    #160482
    nirgalo
    Participant

    Hi, bbpress 2.5.6, when I use the [bbp-topic-tags] shortcode, it displays a certain number of tags, but not all the tags assigned to topics. Is this normal? Is the code limiting the output to some max count? Can this be changed? Thanks.

    #160481

    In reply to: Request: Voting

    Lars Henriksen
    Participant

    Thank you very much Chad for taking your time to explain this.

    It works – almost like I wanted.

    The only thing that bugs me, is that you can’t vote for a single reply – it is by topic.

    If you can only vote for an entire topic/thread, it would be more logical to place the buttons next to the subscribe/favorite links in the top.

    I tried to add the code to the ‘content-single-topic-lead.php’ but to no avail.

    You can see it here.

    Anyways, I’m happy with my set up now, thanks again.

    #160473

    In reply to: Request: Voting

    Chad R. Schulz
    Participant

    Sorry, I just noticed a typo in my post. The php file you need to alter is loop-single-reply.php and it’s going to be in your plugins/bbpress/templates/default/bbpress folder. But it may also be in your theme’s folder if your theme has custom bbpress template files. If your theme has a bbpress folder in it themes/{your theme}/bbpress than that’s the file your need to make your adjustments to.

    Make your simple addition: put <?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?> inbetween <?php do_action( 'bbp_theme_before_reply_content' ); ?> and <?php do_action( 'bbp_theme_after_reply_content' ); ?> either before the content <?php bbp_reply_content(); ?> or after it. It all depends on what you prefer.

    And then put it in your theme’s child folder: themes/{child-theme}/bbpress/loop-single-reply.php.

    If you aren’t using a child theme (highly recommended, BTW) you’ll will have to modify this file directly and replace it in the default folder. And, every time you update your theme and/or bbpress you may need to recreate this modification.

    And for css modifications you’ll have to insert the appropriate css mods (use Google Chrome to identify the css selectors and properties/values) into a custom.css file/plugin–I either use the one in Jetpack or in a stand alone plugin. You can also add the css modifications into your child theme’s .css file.

    –Refer to the plugin author’s support page on wordpress.org. There are a lot of valuable css tips and suggestions. Also, the author had proven to be very helpful in getting his plugin up and running for most people.

    Oh, and my website is currently in the development stage and won’t be made public for awhile. I’m building it at my leisure, “The joy of hobby sites.”

    Hopefully this clears up a few things. It’s kinda hard to describe everything in detail. I just end up muddling through until it looks/acts OK. As a suggestion make sure you keep a default/unmodded .php file handy to switch back and forth with until everything works. Wouldn’t want to have to bother reupping a new file from a theme/bbpress .zip file every time you screw something up.

    Good luck, Chad

    #160470
    Stephen Edgar
    Keymaster

    Hmmm…. I’m assuming in that case then you have no other parts (or major parts at least) missing from the DB schema you posted in the original post? e.g. No topic_title table listing the topics separately.

    If that is the case you’d now want to ignore those mappings I posted, rather remap them to the the topic and reply sections instead of the forums section.

    This is now where we add some limiting SQL expressions to separate your topics from replies.

    In the Example.php file at the end of the topics section you’ll see:

    
    // Setup any table joins needed for the topic section
    $this->field_map[] = array(
    	'from_tablename'  => 'replies_table',
    	'from_fieldname'  => 'the_topic_id',
    	'join_tablename'  => 'topics_table',
    	'join_type'       => 'INNER',
    	'join_expression' => 'USING replies_table.the_topic_id = topics_table.the_topic_id',
    	'from_expression' => 'WHERE forums_table.the_topic_id = 0',
    	'to_type'         => 'topic'
    );
    

    We’ll modify that to the following:

    
    // Setup any table joins needed for the topic section
    $this->field_map[] = array(
    	'from_tablename'  => 'forum_table',
    	'from_expression' => 'WHERE forums_table.Forum_Parent = 0',
    	'to_type'         => 'topic'
    );
    

    Similarly at the end of the replies section, we change that join expression to:

    
    // Setup any table joins needed for the topic section
    $this->field_map[] = array(
    	'from_tablename'  => 'forum_table',
    	'from_expression' => 'WHERE forums_table.Forum_Parent != 0',
    	'to_type'         => 'reply'
    );
    

    Now assuming I’ve got the logic correct in understanding your Forum_Parent/Forum_Ancestor what equals 0 and what does not equal 0 then we should be good to go 🙂

    So the topics join expression is limiting the queries for your ‘thread starter’ topics, then in the reply section expression we ignore those previously ignored topics already imported and are assuming the remaining entries in the table are replies to those topics. The Forum_Ancestor of each reply should then point to the “parent topic ID’ mapping.

    I think that’s it, one thing you’ll notice is that we also are not actually creating any forums to import the topics into, all the topics will import without being allocated to a forum, this can be bulk updated later, actually we can set a default forum for topics and relies, I’ll get back to you on that bit of code that I can’t remember of the top of my head right this second 😉

    Robkk
    Moderator

    Is this the same code that bbpress is using on this forum?

    i dont think so, i think its something else, maybe just BuddyPress but i think they took out the notifications for each @mention.

    if you use what i am talking about you type @ then after that a bunch of users names show up that are in the topic for you to put their name in.

    You are also talking about a plugin functionality

    i mean a plugin that you can paste code snippets llke the one i put above into ,

    https://wordpress.org/plugins/functionality/

    Is there also a plugin who can do this?

    For @mention notifications , BuddyPress. For placing code snippets you can use the plugin i mentioned above.

    BBC
    Participant

    @robkk
    Thank for reaction.
    Is this the same code that bbpress is using on this forum?
    You are also talking about a plugin functionality
    Is there also a plugin who can do this?
    If not then I will ask my web builder to implement your code.

    Again thanx

    Greetings
    Conrad

    @bbc

    #160450

    In reply to: Request: Voting

    Chad R. Schulz
    Participant

    I’m trying Thumbs Rating. It doesn’t tie into any user meta, so you can’t restrict the voting to only registered/logged-in users. However, it works very well and very fast. It only adds post meta so it shouldn’t noticeably slow-down your site even with thousands of topics/replies.

    After activation, per the plugin developers instructions I put the following code into my loop-single-relay.php:
    <?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?>
    goes somewhere between <div class="bbp-reply-content"> and </div>
    –this is theme specific and has to be modified based on your needs. I found that placing the vote before or after and not inside the content works best as the “quote” function in the forum(s) gets screwed up with the added voting content.

    That means before/after the <?php do_action( 'bbp_theme_before/after_reply_content' ); ?>

    Of course, as a lightweight plugin some serious css work is required. And it would be best to place this modified .php file into a bbpress child theme folder to ensure it continues to work after updates.

    Good luck, Chad

    #160434
    Chad R. Schulz
    Participant

    I’m building a discussion board site that won’t use the standard bbpress forum interface. Forums will be embedded in individual post/pages with shortcodes. And all forum-type URLs will redirect to the appropriate post/page.

    So no one will have access to the normal forum structure/hierarchy. Will I still need to create categories/sub-categories/forums for the individual forums?

    This site may eventually have hundreds of forums and I’m looking to provide the best possible performance.

    Any help welcome, Thanks.
    Chad

    #160422
    jaydd
    Participant

    Hello!
    I have a forum being diplayed with forum index shortcode on a wp page. I would like to ask if there is a way to display the title of the parent of the sub-forum or the topic on the sub-forum’s or topic’s page, so always the titles of parents that one above the sub-forum or topic in the hierarchy.

    So the the point of all this would be to let the user know which forum he’s in.
    Thanks,
    Daniel

    #160413
    Robkk
    Moderator
    #160407
    tummybos
    Participant

    Thanks very much @robkk. The link on wp user query is a great tool to solve my problem.
    Concerning the use of BuddyPress, i think the link will be a problem in the sense that the links to the profiles that will be displayed will not link to the users forum profile. I want the links to go to user’s bbPress profile page, not the default wordpress user page nor the buddypress profile.
    So I have decided to go by the Wp user query way, but please how am I going to create the php code. Am i supposed to wrote it in a page? or where should I put the code and how will i create the page?
    Thanks.

    #160405
    Robkk
    Moderator

    @screenwavemedia

    create a copy of page.php rename it to bbpress.php and put a conditional tag into the code.

    i think use bbp_is_search()

    https://codex.bbpress.org/theme-compatibility/getting-started-in-modifying-the-main-bbpress-template/

    bbPress Conditional Tags

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