Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 8,676 through 8,700 (of 32,519 total)
  • Author
    Search Results
  • #162643
    Robin W
    Moderator
    #162635
    BenM
    Participant

    Hi,

    I would like to add private forums. So I set my forums to private and I create a private page with [bbp-forum-index] shortcode (slug of this page is ‘forums’). After this, I add the forum page to my top menu.

    But nothing works for guest visitors :
    – I see the forum page in menu even if I’m not logged in.
    – If I’m not logged in and I click on forum page, I’ve a 404.

    If user is logged, it works.

    What’s the problem ? How can I hide menu item to non-logged users ?

    Thanks.

    #162632
    bayan.assaf
    Participant

    You can add the following code in your functions.php file:

    add_action(‘media_buttons’, ‘ml_pre_media_buttons’, 1);
    add_action(‘media_buttons’, ‘ml_post_media_buttons’, 20);
    function ml_pre_media_buttons($editor_id) {
    if (!$editor_id == ‘bbp_reply_content’)
    return;

    $GLOBALS[‘post_temp’] = $GLOBALS[‘post’];
    $GLOBALS[‘post’] = null;
    }
    function ml_post_media_buttons($editor_id) {
    if (!$editor_id == ‘bbp_reply_content’)
    return;

    $GLOBALS[‘post’] = $GLOBALS[‘post_temp’];
    }

    #162629
    Robin W
    Moderator

    it’s in

    /includes/forums/template.php

    lines

    1987, 1995, 2007, 2017

    You could probably filter it by

    
    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.' ) {
    	$translated_text = 'This elephant contains %1$s and %2$s, and was last giraffed by %3$s %4$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s, and was last updated by %2$s %3$s.' ) {
    	$translated_text = 'This elephant contains %1$s, and was last giraffed by %2$s %3$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s and %2$s.' ) {
    	$translated_text = 'This elephant contains %1$s and %2$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s.' ) {
    	$translated_text = 'This elephant contains %1$s.';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    in your functions file

    Functions files and child themes – explained !

    #162627
    Robin W
    Moderator

    I believe the following in your functions file should work

    function no_edit_lock($retval, $cur_time, $lock_time, $post_date_gmt){
     return false;
     }
     add_filter( ‘bbp_past_edit_lock’, ‘no_edit_lock’, 1, 4);

    Functions files and child themes – explained !

    Please come back and tell us if it does !

    #162606
    Jonny5ive7
    Participant

    Does this go into the theme style.css the bbpress.ccs style? And do I just copy and paste said code?

    aaronos
    Participant

    thanks for your help! Your codex worked for me and has now given me the basis to style the page a bit more.

    Thanks a lot

    #162581
    David13_13
    Participant

    @Robkk

    I didn’t minify the code and I think there is no ajax comments

    #162569
    Robkk
    Moderator

    @dc4x_admin

    I found something awhile ago , sorry I forgot about this topic.

    i cannont seem to find the code i used though.

    But you can just use this plugin instead , it should do the same thing.

    https://wordpress.org/plugins/bbpress-popular-topics/

    The shortcode is something like this for that plugin.

    [bbpresspopulartopics qty = 5]

    #162559
    Robkk
    Moderator

    bbPress is inheriting some CSS from your theme that is suppose to be for the WordPress comments.

    try this custom CSS to fix the issue

    #bbpress-forums .reply {
      margin: 0px;
    }
    #162531
    qbow-admin
    Participant

    i found it somewhere on the web that users cannot use iframe code because wordpress prohibits it for the sake of security. -it says that – if they r allowed to use iframe codes, they might be able to attack you –

    #162530

    In reply to: Edit Page Title

    entrapped
    Participant

    @pinkishhue: I’m using Weaver Xtreme Theme.


    @Robkk
    : The custom titles in AIO SEO are all set to %page_title% | %blog_title%
    There are none of the forum related options you said to check. (Maybe in pro version)

    The forum is displayed via shortcode on a standard page.
    When I remove the forum shortcode the title is displayed correctly. Adding the forum to the page removes the title.

    #162528
    qbow-admin
    Participant

    did you add the iframe code into ‘text editor’?
    it won’t work if you put it into ‘visual’ tab

    qbow-admin
    Participant

    I’ve been using bbpress plugin to set up forums for my website’s users. Originally there is no function when it comes to ‘counting views’ of each post. So I added some codes according to this website’s advice.

    It works fine with general(sitewide) forums but when I made a group(buddypress function) and tried to integrate it with bbpress forum, the view count php code does not work in group forums. (Still, it works perfectly fine at sitewide forums)

    this is my code right now (wp-content/plugins/bbpress/templates/default/bbpress/loop-single-topic.php)

    <li class="bbp-topic-voice-count">
        <?php 
    
    if( !function_exists('get_wpbbp_post_view') ) :
    // get bbpress topic view counter
    function get_wpbbp_post_view($postID){
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        return "0";
    }
    return $count;
    }
    function set_wpbbp_post_view($postID) {
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if( $count == '' ){
        add_post_meta($postID, $count_key, '1');
    } else {
        $new_count = $count + 1;
        update_post_meta($postID, $count_key, $new_count);
    }
    }
    endif;
    
    if( !function_exists('add_wpbbp_topic_counter') ) :
    // init the view counter in bbpress single topic
    function add_wpbbp_topic_counter() {
    global $wp_query;
    $bbp = bbpress();
    $active_topic = $bbp->current_topic_id;
    set_wpbbp_post_view( $active_topic );
    }
    add_action('bbp_template_after_single_topic', 'add_wpbbp_topic_counter');
    endif;
    
    echo get_wpbbp_post_view( bbp_get_topic_id() ); ?>
    </li>
    #162520
    Robkk
    Moderator

    as long as you have embed media checked

    and also a full hyperlink from youtube.

    then it should work.

    https://codex.wordpress.org/Embeds

    Robkk
    Moderator

    looking forward to your template or codex changes

    I just updated the codex article and put an example template to look and study off of.

    It is not just copy and pasting the template into a file and it working, you have to study it and read the comments in the code and find similarities in your index.php file. Then you can create a bbpress.php file from your index.php file.

    If I add the short-code to a custom page using the page.php code it works

    Yes I know but it is just that page, you need all of the bbPress forum pages. Using shortcodes like that means you would have to put a topic shortcode for every topic you have in a bunch of pages. And that is not what either of us are looking for , right??

    It doesnt matter if the default forum uses index.php or page.php – it doesnt work.

    Yes it does, and you have to edit the new bbpress.php file.

    I have sequentially copied pages.php and index.php and made them bbpress.php and each time I can see that the default forum is using it, and each time it doesnt work

    Its not as easy as just renaming it.

    So i guess I need a generic index.php that will work (which I think you said you were producing) OR some workaround so the generic forums page doesnt appear in the directory path

    Was busy with other stuff , but yes i uploaded an example template to look over and compare to your index.php. You cannot just copy and paste , you have to look at the simple code and read how it works in the comments i left in the code.

    #162514
    Sanny Srivastava
    Participant

    Hi,

    I am using BBPRESS for my website, I checked this option from backend:

    “Embed media (YouTube, Twitter, Flickr, etc…) directly into topics and replies”

    but only administrator can embed youtube and other embed just reflect the IFRAME code.

    can you help what I am missing, I need it to be allowed for CONTRIBUTORS to embed the youtube embed code.

    Thanks Sanny

    aaronos
    Participant

    Hi there – thanks so much for your help so far. I did some more tests and I just cant get it to work (so looking forward to your template or codex changes.

    To summarise:

    1. I was only using WPtweaks to tell it which page to use as a template but no matter which one I told it to use – it didnt work. Have since de-activated

    2. If I add the short-code to a custom page using the page.php code it works

    3. It doesnt matter if the default forum uses index.php or page.php – it doesnt work.

    4. I have sequentially copied pages.php and index.php and made them bbpress.php and each time I can see that the default forum is using it, and each time it doesnt work

    So i guess I need a generic index.php that will work (which I think you said you were producing) OR some workaround so the generic forums page doesnt appear in the directory path

    fmckinnon
    Participant

    Hey Gang,
    You know the links that are avail in the user menu (top right) when logged in? (Activity, Profile, Notifications, etc). All of those links are dynamically created based on the logged in userID.

    I wanted to create a few of those shortcuts in a custom link in our main site navigation menu, but I’m unsure what type of code to use to dynamically insert the UserID of the logged in user.

    So for example, how can I create a custom link that will populate the users’ ID:
    http://www.theworshipcommunity.com/members/%5B**USERID-OF-MEMBER**/forums/subscriptions/

    As you can see if you go to:
    http://www.theworshipcommunity.com/dicuss/

    Under “Discussion Forums” i have some sub-links that show the RSS feed options. It’s under there I wanted to have a custom link for “My Subscriptions & Unread Topics” with that dynamic URL above.

    Thanks,
    Fred

    #162498
    Robkk
    Moderator

    Plus i basically just got this code from here

    Resizing Avatars

    #162497
    Robkk
    Moderator

    did you copy it correctly I just tested it out and pasted it right from my functions.php file

    Im going to paste it again just in case it was me that forgot something.

    function my_bbp_change_avatar_size($author_avatar, $topic_id, $size) {
        $author_avatar = '';
        if ($size == 14) {
            $size = 24;
        }
        $topic_id = bbp_get_topic_id( $topic_id );
        if ( !empty( $topic_id ) ) {
            if ( !bbp_is_topic_anonymous( $topic_id ) ) {
                $author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
            } else {
                $author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );
            }
        }
        return $author_avatar;
    }
    
    /* Add priority (default=10) and number of arguments */
    add_filter('bbp_get_topic_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
    add_filter('bbp_get_reply_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
    #162496
    Hunniemaid
    Participant

    For some reason when I added the function code to my functions.php it gave me a 500 Internal Server Error.

    #162495
    Robkk
    Moderator

    use this PHP function to resize the small avatars

    function my_bbp_change_avatar_size($author_avatar, $topic_id, $size) {
        $author_avatar = '';
        if ($size == 14) {
            $size = 24;
        }
        $topic_id = bbp_get_topic_id( $topic_id );
        if ( !empty( $topic_id ) ) {
            if ( !bbp_is_topic_anonymous( $topic_id ) ) {
                $author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
            } else {
                $author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );
            }
        }
        return $author_avatar;
    }
    
    /* Add priority (default=10) and number of arguments */
    add_filter('bbp_get_topic_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
    add_filter('bbp_get_reply_author_avatar', 'my_bbp_change_avatar_size', 20, 3);

    The CSS you would have to use now is

    #bbpress-forums .bbp-author-avatar .avatar-24 {
      width: 24px !important;
      height: 24px !important;
      padding: 0 !important;
      border: none !important;
    }

    and you can remove the first function i gave you to test with

    Robkk
    Moderator

    Well the file you are suppose to copy and create a bbpress.php file from is index.php

    And although putting the forum index shortcode in a page is “easier” in a sense , you will still come up with issues just like you are going through. This is why I have been editing the Codex for the last few days to hopefully fix these issues that users might come across.

    As for that weird wp tweaks issue you have , I do not know how to fix that. if you are only using that plugin just for a bbPress specific sidebar there are better plugins than that one.

    And it is not hard to manually create a bbPress specific sidebar too.

    Thanks so much – although I am wondering if it is going to solve my problem (but please do!)

    it might help a little, there is a bunch of post meta that you would have to remove for it to look correct.

    You can also contact me later today through email, if you need help during the process.

    Contact

    #162493
    Hunniemaid
    Participant

    Alright the second code worked. Thank you so much for helping. Do you by chance have any suggestions on how to un-blur my avatar picture? Thank you again.

Viewing 25 results - 8,676 through 8,700 (of 32,519 total)
Skip to toolbar