Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 4,776 through 4,800 (of 32,518 total)
  • Author
    Search Results
  • #188274
    Robin W
    Moderator

    @zopfan – this code may be useful

    //redirect user to log in page if accessing forum from external link
    add_action( 'template_redirect', 'forum_redirect_from_external_link' );
    function forum_redirect_from_external_link() {
      $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
      $actual_link = explode('/',$actual_link);
      if($actual_link[3]=="forums" && !is_user_logged_in() ) {
        wp_redirect( home_url('your-forum-log-in-page-here') ); 
          exit;
      }
    }
    #188273
    xfallseane
    Participant

    Hello i’m french and sorry for my english.

    I have modify the css and template of bbpress and i have copy the files in my host.
    But when i create a topic i have “teste Name of Topic“.

    In local i have check “Topics Loop – Single” and i have find “teste” i have delete this and prefix is deleted but in my host “teste” is not in Topics Loop – Single.
    I do not know what can create the prefix.

    I use bbp pack style and more plugins as bbpress2 bbcode, bp tools bp attachments.

    thank you in advance

    #188265
    Justin
    Participant

    I keep running into the following error when trying to import my Vanilla 2.x forum database. I’m using WordPress 4.9 and bbpress 2.5.14.

    Repair any missing information: Continue
    WordPress database error: [Specified key was too long; max key length is 1000 bytes]
    CREATE TABLE GcuHRqrGbbp_converter_translator ( meta_id mediumint(8) unsigned not null auto_increment, value_type varchar(25) null, value_id bigint(20) unsigned not null default '0', meta_key varchar(255) null, meta_value varchar(255) null, PRIMARY KEY (meta_id), KEY value_id (value_id), KEY meta_join (meta_key(191), meta_value(191)) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    No data to cleanStarting Conversion

    Any ideas on what I need to do to get this error resolved?

    #188262

    Topic: Closed topics

    in forum Themes
    Ryendel Rocha
    Participant

    Hello.
    I would like to create a forum with closed topics. The person just will be able to see the topic the admin and the person who create. Is there any way to do that?

    And is possible to modify the new topics shortcode? I would like to remove the “Topic tag” and another options in some places. One time the topic are closed, there’s no function for this options.

    Thank you for your attention.

    #188258
    Robin W
    Moderator

    if you mean the login , then put this into the custom css of your theme

    #sidebar .bbp-login-form label {
    	width: 120px !important;
    }
    
    #188220
    Jakob Helmer
    Participant

    and in case if the plugin Buddypress is not installed, something like this might be useful:

    // redirect if the url contains the word 'user' and if you are not logged-in
    add_action('init', 'profile_redirect');
    function profile_redirect() {
    if(strpos($_SERVER['REQUEST_URI'], 'user') !== false &&  ! is_user_logged_in()) {
    	wp_redirect("https://www.whateversite.com/" . LOGIN_PAGE_NAME);
    	}
    }

    ‘LOGIN_PAGE_NAME’ = whatever page name you use to login.
    Change the word ‘user’ to your needs.

    #188197
    abufrank
    Participant

    For fixing the “page-not-found” when accessing a private forum, I found that when I placed Pascals code into the 404 page (great code by the way), the browser still flags the 404. So instead, I moved it to the functions.php file using the following:

    //redirect user to log in page if accessing forum from external link
    add_action( 'template_redirect', 'forum_redirect_from_external_link' );
    function forum_redirect_from_external_link() {
      $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
      $actual_link = explode('/',$actual_link);
      if($actual_link[3]=="forums" && !is_user_logged_in() ) {
        wp_redirect( home_url('your-forum-log-in-page-here') ); 
          exit;
      }
    }

    I hope this was constructive… 🙂

    #188195
    michaellanfield
    Participant

    Hi. I have a few issues with bbpress. The page I need help with is https://www.thosecrazyvegans.net/forum/

    1. The top of the browser tab bar it says Forums Archive – Those Crazy Vegans
    however, I would like it to say Forum – ThoseCrazyVegans.net
    How do I fix this?

    2. When someone post a new topic they have to fill out the form at the bottom of the forum, however they cannot select a forum from the drop down menu. How to fix?

    3. The search bar does not have an search button. Why and how to fix?

    4. Is it possible to edit this page in X Theme Cornerstone. I am not able to.

    5. The HTML code that I added to the Forum page does not work. When the New Topic link at the top of the Forum page is clicked, I would like it to go to the New Topic form at the bottom of the page. However, the HTML code that I added does not seem to work. What is the full page code for this?

    Forum page code

    <a href="https://www.thosecrazyvegans.net/wp-login.php">Login</a>  <a href="https://www.thosecrazyvegans.net/register">Register</a>
    
    <a href="https://www.thosecrazyvegans/forum#newtopic">Create New Topic</a>
    
    [bbp-forum-index]
    
    <a href="#newtopic">[bbp-topic-form]</a>

    Thank you.

    #188172
    Jakob Helmer
    Participant

    Maybe you mean the buddypress profile page?
    in that case this piece of code in the functions.php of your theme might help:

    function sh_walled_garden()	{
    	global $bp;
    	if( bp_is_register_page() || bp_is_activation_page() )
    	return;
    	if( ! bp_is_blog_page() && ! is_user_logged_in() )
    	bp_core_redirect( $bp->root_domain .'/'. 'LOGIN_PAGE_NAME' );
    }
    add_action( 'get_header', 'sh_walled_garden' );

    ‘LOGIN_PAGE_NAME’ = whatever page name you use to login

    #188165
    Robin W
    Moderator

    either put this in your functions file

    add_filter( 'bbp_get_forum_archive_title', 'tcv_forum');
    
    function tcv_forum () {
    	Return 'whatever you want it to say' ;
    }

    or create a page called whatever you want it to say, and put this in the content
    [bbp-forum-index]

    #188164
    Robin W
    Moderator

    either put this in your functions file

    add_filter( 'bbp_get_forum_archive_title', 'tcv_forum');
    
    function tcv_forum () {
    	Return 'Forum' ;
    }

    or create a page called forum, and put this in the content, and then point your menu at this page
    [bbp-forum-index]

    #188145
    Mauro
    Participant

    I found the pieces and bits necessary to make this happen.

    
    // ALTER TinyMCE INIT FOR VISUAL EDITOR ON FORUM TOPICS AND REPLIES
    // SOURCE: https://bbpress.org/forums/topic/alter-mceinit-for-visual-editor-on-topics/
    
    // Enable visual editor on tinymce in bbPress
    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
    
    // Enable TinyMCE paste plugin
    function bbp_add_paste_plugin($args) {
      $args[] = 'paste';
      return $args;
    }
    add_filter( 'teeny_mce_plugins', 'bbp_add_paste_plugin');
    
    // ADDS A JQUERY PASTE PREPROCESSOR TO REMOVE DISALLOWED TAGS WHILE PASTING
    // SOURCE https://jonathannicol.com/blog/2015/02/19/clean-pasted-text-in-wordpress/
    function configure_tinymce($in) {
      $in['paste_preprocess'] = "function(plugin, args){
        // Strip all HTML tags except those we have whitelisted
        var whitelist = 'a,p,span,b,strong,i,em,h3,h4,h5,h6,ul,li,ol';
        var stripped = jQuery('<div>' + args.content + '</div>');
        var els = stripped.find('*').not(whitelist);
        for (var i = els.length - 1; i >= 0; i--) {
          var e = els[i];
          jQuery(e).replaceWith(e.innerHTML);
        }
        // Strip all class and id attributes
        stripped.find('*').removeAttr('id').removeAttr('class');
        // Return the clean HTML
        args.content = stripped.html();
      }";
      return $in;
    }
    add_filter('teeny_mce_before_init','configure_tinymce', 99999999999);
    
    #188141
    #188136
    Robin W
    Moderator

    not tested but try adding this to your functions file

    add_filter( 'bbp_get_reply_author_display_name', 'rew_display_first_name' 10, 2);
    
    function rew_display_first_name ($author_name, $reply_id ) {
    	$reply_id = bbp_get_reply_id( $reply_id );
    
    		// User is not a guest
    		if ( !bbp_is_reply_anonymous( $reply_id ) ) {
    
    			// Get the author ID
    			$author_id = bbp_get_reply_author_id( $reply_id );
    
    			// Try to get a display name
    			$author_name = get_the_author_meta( 'first_name', $author_id );
    
    			// Fall back to user login
    			if ( empty( $author_name ) ) {
    				$author_name = get_the_author_meta( 'user_login', $author_id );
    			}
    
    		// User does not have an account
    		} else {
    			$author_name = get_post_meta( $reply_id, '_bbp_anonymous_name', true );
    		}
    
    		// If nothing could be found anywhere, use Anonymous
    		if ( empty( $author_name ) )
    			$author_name = __( 'Anonymous', 'bbpress' );
    
    		// Encode possible UTF8 display names
    		if ( seems_utf8( $author_name ) === false )
    			$author_name = utf8_encode( $author_name );
    
    return apply_filters( 'rew_display_first_name', $author_name, $reply_id );
    }
    #188127
    andrey90
    Participant

    is it possible to create two forums? because I have a forum on my site for free users and the second forum with other topics should be for the pay users, the two forums are separated by two different pages on the site, so i need two forums with one database. I would block the pay forum with a “paid membership” addon for free users.

    but as i can see i can just create one forum with one shortcode in bbpress?

    #188123
    leeproc
    Participant

    Hello all,

    I somehow broke the page layout of my topic index and topic pages. The sidebar should be on the right, but it looks like WordPress is drawing the gray line separator on the left of the page, and pushing all the sidebar content to the bottom. Example: https://www.parentifact.org/forums/forum/questions/

    I thought this was due to some code I put in the style.css and functions.php to style my archive pages, but I removed that code and it’s still messed up. Has anyone experienced this before, or could someone more knowledgeable look at the source and developer tools to figure out what’s going wrong here?

    Thanks!

    #188117
    Wilfrank
    Participant

    I made a small change so that the user can choose the sort order, but can anyone tell me why it does not work?

    function custom_bbp_has_topics($order) {
    
      switch ($order) {
        case 1:
            $args['order'] = 'ASC';
            break;
        case 2:
            $args['order'] = 'DESC';
            break;
        default:
            $args['order'] = 'DESC';
      }
      
      return $args;
    }
    add_filter('bbp_before_has_topics_parse_args', 'custom_bbp_has_topics' );
    #188116
    morpheus978
    Participant

    Hello,
    I created a page on the site with the shortcode [bbp-forum-index] and a custom title.
    I have a problem with the breadcumbs (which I yet have on my site, implemented with the SEO YOAST plugin).

    When I navigate through categories and forums, starting from the index page, breadcumbs works properly. When I open a topic, the root path of the forum disappears.

    I’ll explain better:

    the root page is http://www.apesca.it/forum
    Breadcumb: Home »Forum

    Within the category “Benvenuto – Presentazioni”…
    Breadcumb: Home » Forum » Benvenuto – Presentazioni

    I’m in the forum “Mi Presento”…
    Breadcumb: Home » Forum » Benvenuto – Presentazioni » Mi presento

    I’m in the topic “Ciao a Tutti” …
    Breadcumb: Home » Benvenuto – Presentazioni » Mi presento » Ciao a Tutti

    What i want to get is:
    Home » Forum » Benvenuto – Presentazioni » Mi presento » Ciao a Tutti

    I hope you can help me.

    #188112
    richard.miller
    Participant

    Just installed BBPress, and see that the editor is barebones html.

    I’ve learned from this codex page that the visual editor is disabled by default – so I added the code snippet to my functions file, but no effect at all. Added TinyMCE Advance plugin, no effect at all.

    What could be wrong?

    (note: I see all sorts of references to “enable fancy WP editor” in older posts here, but can’t find that setting)

    WP 4.8.3
    BBpress: 2.5.14

    Robin W
    Moderator

    these sortcodes are theme(or other plugin) related, not bbpress.

    what theme are you using?

    #188106
    Eric Malalel
    Participant

    Now it’s fine. I made an error when copy paste the code.
    It works perfectly, thanks a lot!

    #188092
    dominikb
    Participant

    in form-reply.php i find this line:

    <input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php bbp_form_reply_log_edit(); ?> tabindex="<?php bbp_tab_index(); ?>" />

    it does not seem like, i can uncheck the box here.

    I have my subscription boxes auto-checked via:

    function pw_bbp_auto_checK_subscribe( $checked, $topic_subscribed  ) {
    
        if( $topic_subscribed == 0 )
            $topic_subscribed = true;
    
        return checked( $topic_subscribed, true, false );
    }

    is there maybe a way, to turn this around and use it on the log checkbox?

    #188091
    coreymcollins
    Participant

    I’ve been fighting with how to enable the Topics CPT for all users in the dashboard and not having a great time. I thought I could, perhaps, filter the CPT registration to change the CPT caps and show_ui settings, but no luck.

    Even when I am able to get the Topics CPT to display for all users by commenting out the lines noted below as a test:

    
    // Register Topic content type
    register_post_type(
    	bbp_get_topic_post_type(),
    	apply_filters( 'bbp_register_topic_post_type', array(
    		'labels'              => bbp_get_topic_post_type_labels(),
    		'rewrite'             => bbp_get_topic_post_type_rewrite(),
    		'supports'            => bbp_get_topic_post_type_supports(),
    		'description'         => __( 'bbPress Topics', 'bbpress' ),
    		// 'capabilities'        => bbp_get_topic_caps(),
    		// 'capability_type'     => array( 'topic', 'topics' ),
    		'menu_position'       => 999999999999,
    		'has_archive'         => ( 'forums' === bbp_show_on_root() ) ? bbp_get_topic_archive_slug() : false,
    		'exclude_from_search' => true,
    		'show_in_nav_menus'   => false,
    		'public'              => true,
    		// 'show_ui'             => current_user_can( 'bbp_topics_admin' ),
    		'can_export'          => true,
    		'hierarchical'        => false,
    		'query_var'           => true,
    		'menu_icon'           => ''
    	)
    ) );
    

    Things still don’t completely work. Users can technically create a post, but can’t save the Forum in which the post is created.

    The short of it is: I want users with the Participant Forum Role to be able to see the Topics CPT in the dashboard so they can create their posts here, mainly because it would be helpful for them to be able to Preview a topic before posting it. Out of the box, the front-end bbPress form does not allow for post previews.

    Has anyone achieved this?

    Using:
    WP 4.8.3
    bbPress 2.5.14

    #188058
    uzosky
    Participant

    Hello, please how do I retrieve the user id of the last active user in a forum? To get the last active name requires the following code:
    bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'type' => 'name' ) );
    But how do I get the ID instead of the name?

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