Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,776 through 4,800 (of 32,481 total)
  • Author
    Search Results
  • #187863
    jkin
    Participant

    Hi, I put all my functions into snippet, and the snippet works fine for me.

    However, in order to solve the video problem, which shows only code in the front page, (yet, it shows at the backend without problem), I tried to put the above code into the snippet, the result is that all contents in the bbpress forum went disappeared.

    Could anyone advise what to do next?

    The video code is like below.

    [video width="640" height="640" mp4="URL../wp-content/uploads/2017/10/video.mp4"][/video]

    jack_tyler
    Participant

    Hi wpweaver,

    Thanks for this. I’m gonna try your code. 🙂

    wpweaver
    Participant

    I don’t think there is a plugin or existing feature that does this.

    I’m really surprised that this isn’t a common question, as it is a real huge issue that allows spammers a backdoor to register as a user to your site. Very bad. This code will redirect all login and password attempts to a static page on your site which can use the regular bbp login, register, and pass shortcodes.

    You can use this custom code:

    <?php
    // intercept the Register and Lost your password? links from the standard WP login screen
    
    define( 'REGISTRATION_URL', 'https://example.com/register');
    
    	add_filter('register_url','custom_redirect_login_register');
    	add_filter('lostpassword_url','custom_redirect_login_register');
    
    	function custom_redirect_login_register($reg_url) {
    		return home_url( REGISTRATION_URL );
    	}
    
    	/**
    	 * Redirects visitors to <code>wp-login.php?action=register</code> to
    	 * <code>site.com/registration-page-name</code>
    	 */
    
    	add_action( 'login_form_register', 'custom_catch_register' );
    	function custom_catch_register()
    	{
    		wp_redirect( home_url( REGISTRATION_URL ) );
    		exit();
    	}
    
    	/*
    	 * intercept bbforum.me/wp-login.php?action=lostpassword and
    	 *           bbforum.me/wp-login.php?action=retrievepassword
    	 *
    	 */
    
    	add_action( 'login_form_lostpassword', 'custom_filter_option' );
    	add_action( 'login_form_retrievepassword', 'custom_filter_option' );
    	/**
    	 * Simple wrapper around a call to add_filter to make sure we only
    	 * filter an option on the login page.
    	 */
    	function custom_filter_option()
    	{
    		wp_redirect( home_url( REGISTRATION_URL ) );
    		exit();
    	}
    ?>

    There are articles on how do add custom code to your bbPress installation.

    Note that this is an option provided with my plugin “Weaver for bbPress” which is a fully turn-key solution to creating a bbPress site. I have not created a stand alone version of this option yet.

    dejanx
    Participant

    I use the theme of Spider Mag,and I want to be the same view of the front page on the mobile phone as the pc Now after I edit cistom code css lokk in mobile dont same like on PC..On the right side of the PC are widgets and commercials and on the front page there are two tutorials next to each other, while on the mobile page at the bottom of the page I show up and advertise. Now I need to edit. Here you see the pictures.

    View on PC https://imgur.com/a/qeb6g

    View after edit custom code css. First go tutorials and on the bottom ads and vidgets , what now must edit ? https://imgur.com/a/9qkLV

    This functions I hve for edit what I want https://imgur.com/a/67GYN

    How make now like on PC view?

    Thanks.

    if above that div id maybe you can directly add that html/php code and don’t forget when you update bbpress.

    #187843
    sharojit
    Participant

    I am working on a site and create two different forum named #1.Mental Health & #2.Staff. Also, create pages for both forums and show tropics from them using the shortcode. But the problem is it shows tropic from the different forum. Like in mental health page shows tropic from the staff forum. Here are those links and a screenshot too.

    #1. Mental Health
    #2. Staff

    jack_tyler
    Participant

    Hi @siamlottery,

    Thank you for your response. What I want to do is to add a custom HTML/PHP above the <div id="bbpress-forums"> as you can see on this screenshot https://www.screencast.com/t/C1AiIkH6

    #187832
    aussiemike
    Participant

    Hello
    I am using the latest version of WP and bbPress with iThemese Builder theme.
    Through the theme functions I am able to show all parts of the forum on a particular theme layout, apart from the forum index page when the breadcrumb ‘forums’ link is clicked. This takes me back to the main template layout which does not have the forum wigdets as required on all forum pages.
    I also have the same issue with the search results.

    I have tried the following code but as I am not overly familiar with bbPress conditionals it does not solve the problem. I believe what I am look for is the correct information to go into this line:
    if ( is_bbpress() && in_category( ‘page’ ) )

    // create view for forums
    function custom_filter_category_layouts( $layout_id ) {
        if ( is_bbpress() && in_category( 'page' ) )
                return '599b46ad5fa63';
    
        return $layout_id;
    }
    add_filter( 'builder_filter_current_layout', 'custom_filter_category_layouts' );

    Any advice appreciated.

    Mike

    #187825
    aussiemike
    Participant

    Hello
    I am seeking help with the correct conditionals to show a custom view.
    I am using
    WP Version 4.8.2
    bbPress Version 2.5.14
    Ithemes Air Theme

    I have been given the following code to insert into the functions.php file in my child theme but I am missing something here?

    function custom_filter_category_layouts( $layout_id ) {
        if ( is_single() && in_category( 'news' ) )
                return 'INSERT LAYOUT NUMBER';
        
        return $layout_id;
    }
    add_filter( 'builder_filter_current_layout', 'custom_filter_category_layouts' );
    

    I have tried most of what look to be the relevant conditionals at https://codex.bbpress.org/bbpress-conditional-tags/

    I can get most forum views to use a theme layout I have created in Air Theme apart from the forum index page and the CHILD FORUMS (forums created with a parent)

    I spoke with iThemes support and they told me it was best to ask here. If someone could help me out here it would be appreciated.

    Best Regards
    Mike

    Mike Costanzo
    Participant

    This is the first post I’ve found that accurately describes my predicament.

    I am setting up a development site and attempting to import my forums via multiple XML files. However, the import process seems to be breaking a key relationship that allows the front-end of BBPress to work.

    After importing, the Forums, Topics, and Replies all display correctly in the Dashboard, but on the front end I just get the standard “Oh bother! No topics were found here!” If I then run the Repair Tools “Recalculate the parent topic for each post” and/or “Recalculate the parent forum for each post,” then the relationship between Forums and Topics is lost, and the Replies page fails to load completely (returns an empty page with no error message).

    From my digging around in the database, this problem seems centered around the field post_parent in wp_posts. On import, WordPress is setting this to “0” instead of the value in my XML file. If I click “Edit” on a Topic in the Dashboard and then click “Update” without changing anything, WordPress correctly repopulates this post_parent value and the Topic appears on the front end under its parent forum. But like @bigt11 and @welshdemon, I don’t have time to do that with 1,200 Topics and 7,400 Replies.

    Does anyone have any ideas? I have spent weeks trying to figure this out. I have tried multiple different XML import plugins, but none of them seem to word well with BBPress (or work with big XML files). Any help you can give here is very much appreciated!

    #187757
    sanjayrath
    Participant

    The steps have been outlined at this link and it works perfectly.

    Shortcode to add “Edit Profile” link

    #187717
    jerichox
    Participant

    Can anyone help me Style this Recent topic widget to match what I currently have on my page for Recent Posts.. I would like it to use the Avatar of the user that posted like it does now, just bigger and have it look the same..

    http://piw.ewarena.com/ is the webpage

    Ive messed with the output code a little and always mess it up cant get it to how I want since im a newbie to the CSS stuff.. Any help would be appreciated!

    using the BBpress Recent Topic Widget..

    #187716
    super powered
    Participant

    Relevant tag validation code for above since I had to write it for my project anyways:

    
    
    function new_reply_pre_set_terms_tag_test($terms, $topic_id, $reply_id)
    {
        //Bail Early if not set
        if(!$terms)
            return $terms;
    
        //Bail early if we are allowed to modify tags
        if(current_user_can( 'modify_topic_tags' ))
            return $terms;
    
        if(!is_array($terms))
            $terms = explode(', ', $terms);
    
        //For each to check if array term already exists. Remove if doesnt
        foreach ($terms as $tag => $tag_value):
            if(!term_exists($tag_value, 'topic-tag')):
                unset($terms[$tag]);
            endif;
        endforeach;
    
        return implode(', ', $terms);
    }
    
    function new_topic_pre_insert_tag_test($data)
    {
        //Bail Early
        if(!is_array($data) || !isset($data['tax_input']) || !isset($data['tax_input']['topic-tag']))
            return $data;
    
        //Bail early if we are allowed to modify tags
        if(current_user_can( 'modify_topic_tags' ))
            return $data;
    
        //Make sure we're an array
        if(!is_array($data['tax_input']['topic-tag']))
            $data['tax_input']['topic-tag'] = array($data['tax_input']['topic-tag']);
    
        //For each to check if array term already exists. Remove if doesnt
        foreach ($data['tax_input']['topic-tag'] as $tag => $tag_value):
            if(!term_exists($tag_value, 'topic-tag')):
                unset($data['tax_input']['topic-tag'][$tag]);
            endif;
        endforeach;
    
        return $data;
    }
    
    add_filter('bbp_new_reply_pre_set_terms','new_reply_pre_set_terms_tag_test', 22, 3);
    add_filter('bbp_edit_reply_pre_set_terms','new_reply_pre_set_terms_tag_test', 22, 3);
    add_filter('bbp_new_topic_pre_insert','new_topic_pre_insert_tag_test');
    
    
    #187715
    super powered
    Participant

    The reason the function doesn’t work is because BBPress throws a fatal error when it tries to handle the array of items when it expects it as a string. We probably just need to get a filter in the core that allows us to manipulate that value before it tries to use the split() function.

    Until then, kind of a hacky workaround is to use JS to append the values to a hidden field:

    
    function display_tag_elements($selectedTags, $userRole, $task)
    {
        $html = array();
        $tags = get_categories(array('hide_empty' => 0, 'taxonomy' => 'topic-tag'));
        $selectedTagsArray = explode(', ', $selectedTags);
        if ($userRole != 'bbp_participant' || $task != 'edit')
        {
            $html[] = "";
            foreach ($tags as $tag)
            {
                $selected = '';
                if (in_array($tag->name, $selectedTagsArray))
                {
                    $selected = 'checked';
                }
                $html[] = "<input type='checkbox' class='bbp_topic_tags_checkbox' name='bbp_topic_tags_checkbox[]'" . $selected . " value='" . $tag->name . "'>" . $tag->name . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            }
    
            $html[] = "<input type='hidden' class='bbp_topic_tags_hidden' name='bbp_topic_tags' value='".$selectedTags."'>";
    
            $html[] = "
                <script>
                    var checkboxes = document.getElementsByClassName('bbp_topic_tags_checkbox');
                    var hidden = document.getElementsByClassName('bbp_topic_tags_hidden');
                    var hiddenVal = hidden[0].value.split(', ');
                    
                    for(var x = 0; x < checkboxes.length; x++)
                    {
                        checkboxes[x].addEventListener( 'change', function() 
                        {
                            var index =  hiddenVal.indexOf(this.value);
                            var checked = this.checked;
                            if(checked && !index > -1) 
                                 hiddenVal.push(this.value);
                            else if (!checked && index > -1)
                                 hiddenVal.splice(index, 1);
                            
                             hidden[0].value = hiddenVal.join();
                        });
                    }
                </script>
            ";
        } else
        {
            $html[] = $selectedTags;
        }
    
        return implode('', $html);
    }
    
    

    However this has a pretty notable downside in that someone could just inspect the code and add whatever they want to the hidden field. So you’ll want to make sure your also using one of the spam filters like bbp_new_reply_pre_set_terms to make sure the new values are terms you’ve predefined.

    Side note: there also seems to be a pretty annoying bug in that participants can edit the topics tags on reply, so I would just disable it on reply for non-moderators.

    EDIT: kind of like I just did. I don’t think I should be allowed to add tags to existing topics. this feels like a bug.

    #187708

    In reply to: Quote

    ico33
    Participant

    Anybody knows a code to insert for having quote?

    #187703

    In reply to: Delete own posts

    sarwarc
    Participant

    Hi LeGuerg,

    Thanks for the useful post. I have added those lines of code in two php files that you mentioned, but still particants can’t delete their own posts.

    /home/XXX/public_html/XXX/wp-content/plugins/bbpress/includes/replies/capabilities.php
    /home/XXX/public_html/XXX/wp-content/plugins/bbpress/includes/topics/capabilities.php

    Any idea why? Anyone’s help will help will be greatly appreciated.

    #187693
    carajoan
    Participant

    I’m having this problem after trying this solution, searching the codex and this forum. Here are all the various solutions I’ve tried:

    .reply {
        color: #000000 !important;
    }
    
    #commentform #submit, .reply, #reply-title small {
        background-color: #000000;
        color: #ffffff;
    }
    
    .forum a { color: black !important; }
    
    .bbp-forum-info { color: black !important; }
    
    .bbp-forum-topic-count { color: black !important; }
    
    .bbp-forum-reply-count { color: black !important; }
    
    .bbp-forum-freshness { color: black !important; }
    
    .bbp-topics {
    color: black !important;
    background-color:white;
    }
    
    .bbp-forums a { color: black !important; }
    
    #bbpress-forums div.bbp-topic-content a,
    #bbpress-forums div.bbp-reply-content a {
    	background-color: white;
    }
    
    #bbpress-forums div.even,
    #bbpress-forums ul.even {
     background-color: #fff;
    }
     
    #bbpress-forums div.odd,
    #bbpress-forums ul.odd {
     background-color: #fbfbfb;
    }
    
    /*styling to move 'Subscribe' to right hand side */
    .single-forum .subscription-toggle  {
        float:right !important ;
    }
    #187679
    jerichox
    Participant

    I would like to add the Recent Topic Widget to the Footer of my page, however it does not match the format.. I have opened the widget.php file and found it but keep getting stuck on the code.. Any ideas/help?

    Below is the link.. I would like the recent topics to match the recent posts part of the footer..
    http://piw.ewarena.com/2017/10/another-news-test/

    #187675
    Tony
    Participant

    I have two forums and I have two non-bbPress widgets. I’ve setup the widgets to show up on forum pages with the Widget Options plugin. Each of the forums need to show only the menu that pertains to it (match by state name). As of now, both widgets show up on both forum pages.

    Tried conditional tag: is_bbpress() with the page ID’s, but it doesn’t change anything. None of my researched plugins seem to have this feature figured out.

    Any ideas? Still fairly new to all this and not a coder so don’t have the best vernacular for troubleshooting.

    WP version: 4.8.2
    bbPress version: 2.5.14
    Site: https://selfdirectforum.com/forum/

    #187667

    In reply to: PHP Fatal Error

    Taim786
    Participant

    Hi Gunilla,

    If you have still not resolved your problem, you need to edit your wp-config.php file which should be located in the root of your WordPress installation. You need to insert below mention code at the end of the file and then this error will disappear.

    define( ‘WP_MEMORY_LIMIT’, ‘256M’ );

    Source: https://www.webxen.com/kb/wordpress-fatal-error-allowed-memory-size-of-67108864-bytes-exhausted/

    #187664
    kwerri
    Participant

    I have a plugin called myCred which allows me to add a shortcode to a post so that anyone looking at that post will be allowed to click on a link to add points.

    I am trying to figure out where in bbPress I will add this shortcode so that the link will appear for each post.

    I am guessing that I will need to create a specially named page and then add the shortcode, but I am not sure about how to create the page (i.e. what name to give it). Am I on the right track, and if not, can someone help?

    #187659
    #187647
    sarwarc
    Participant

    Thanks for finding the solution. Where do I add the code for menu and forum to make the Profile show up in Menu?

    #187615
    jjaureguiberry
    Participant

    I’m trying to integrate buddypress-docs with bbpress forums; the intention is to have topics of discussion within an article/doc. Using buddypress-docs hook ‘bp_docs_after_doc_content’, I create a corresponding forum (if it doesn’t exist) and add a shortcode to display a topic creation form. If a topic exists and is selected, I redirect to the associated article, and display a single topic with:
    echo do_shortcode( '[bbp-single-topic id=' . $topic_id .']' );
    So far, so good, I don’t know if it is the right aproach, but it seems to work.
    The problem comes when I want to post a reply within the selected topic. $_REQUEST variables are used to detect and display the selected topic, but on single-topic the additional ‘bbp_redirect_to’ hidden field is added, causing to redirect and lose those variables. I commented the line where this field is added (bbpress/includes/common/template.php:1620) and it works the way I want, but don’t want to do that 🙂
    Any suggestions on how to work this around without messing around with the plugin’s code? Hope the issue is clear, thank you for any help you can provide and for taking the time to read this.

    Wordpress ver. 4.8.2
    BBPress ver. 2.5.14
    BuddyPress Docs ver. 1.9.4

Viewing 25 results - 4,776 through 4,800 (of 32,481 total)
Skip to toolbar