Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 9,601 through 9,625 (of 32,511 total)
  • Author
    Search Results
  • #157604
    theatereleven
    Participant

    Okay, I found these three bad boys:

    
    <?php bbp_topic_tag_list(); ?>
    <?php bbp_topic_subscription_link(); ?>
    <?php bbp_user_favorites_link(); ?>
    

    Now I’m just on the hunt for the others. Any hints appreciated!

    #157572
    Stagger Lee
    Participant

    This seems to work, just tested. Adjust after need.
    Limit user upload by KB size:

    add_filter('wp_handle_upload_prefilter', 'f711_image_size_prevent');
    function f711_image_size_prevent($file) {
    
        // get filesize of upload
        $size = $file['size'];
        $size = $size / 1024; // Calculate down to KB
    
        // get imagetype of upload
        $type = $file['type'];
        $is_image = strpos($type, 'image');
    
        // set sizelimit
        $limit = 700; // Your Filesize in KB
    
        // set imagelimit
        $imagelimit = 7;
    
        // set allowed imagetype
        $imagetype = 'image/jpeg';
    
        // query how many images the current user already uploaded
        global $current_user;
        $args = array(
            'orderby'         => 'post_date',
            'order'           => 'DESC',
            'numberposts'     => -1,
            'post_type'       => 'attachment',
            'author'          => $current_user->ID,
        );
        $attachmentsbyuser = get_posts( $args );
    
        if ( ( $size > $limit ) && ($is_image !== false) ) { // check if the image is small enough
            $file['error'] = 'Image files must be smaller than '.$limit.'KB';
        } elseif ( $type != $imagetype ) { // check if image type is allowed
            $file['error'] = 'Image must be ' . $imagetype . '.';
        } elseif ( count( $attachmentsbyuser ) >= $imagelimit ) { // check if the user has exceeded the image limit
            $file['error'] = 'Image limit of ' . $imagelimit . ' is exceeded for this user.';
        }
        return $file;
    
    }
    #157571
    Stagger Lee
    Participant

    Set a maximum upload count for users on a specific user role

    add_filter( 'wp_handle_upload_prefilter', 'limit_uploads_for_user_roles' );
     
    function limit_uploads_for_user_roles( $file ) {
      $user = wp_get_current_user();
      // add the role you want to limit in the array
      $limit_roles = array('contributor');
      $filtered = apply_filters( 'limit_uploads_for_roles', $limit_roles, $user );
      if ( array_intersect( $limit_roles, $user->roles ) ) {
        $upload_count = get_user_meta( $user->ID, 'upload_count', true ) ? : 0;
        $limit = apply_filters( 'limit_uploads_for_user_roles_limit', 10, $user,$upload_count, $file );
        if ( ( $upload_count + 1 ) > $limit ) {
          $file['error'] = __('Upload limit has been reached for this account!','yourtxtdomain');
        } else {
          update_user_meta( $user->ID, 'upload_count', $upload_count + 1 );
        }
      }
      return $file;
    }

    This action will fire when user delete attachment

    add_action('delete_attachment', 'decrease_limit_uploads_for_user');
    function decrease_limit_uploads_for_user( $id ) {
       $user = wp_get_current_user();
       // add the role you want to limit in the array
       $limit_roles = array('contributor');
       $filtered = apply_filters( 'limit_uploads_for_roles', $limit_roles, $user );
       if ( array_intersect( $limit_roles, $user->roles ) ) {
         $post = get_post( $id);
         if ( $post->post_author != $user->ID ) return;
         $count = get_user_meta( $user->ID, 'upload_count', true ) ? : 0;
         if ( $count ) update_user_meta( $user->ID, 'upload_count', $count - 1 );
       }
    }
    #157569
    Stagger Lee
    Participant

    I just write this on trac. Needs to be restricted for users to see other attachments, they did not uploaded.

    function filter_my_attachments( $wp_query ) {
        if (is_admin() && ($wp_query->query_vars['post_type'] == 'attachment')) {
            if ( !current_user_can( 'activate_plugins' ) ) {
                global $current_user;
                $wp_query->set( 'author', $current_user->id );
            }
        }
    }
    add_filter('parse_query', 'filter_my_attachments' );
    
    add_filter( 'bbp_after_get_the_content_parse_args', 'tp_bbpress_upload_media' );
     
    function tp_bbpress_upload_media( $args ) {
    $args['media_buttons'] = true;
     
    return $args;
    }
    #157563
    Robin W
    Moderator

    ok, sorry for delay – putting in ‘bumps’ tends to not get you help as many of us work on ‘topics with no replies’ and you have replies 🙂

    Put the following in your functions file

    function rew_role_show () {
    $displayed_user = bbp_get_reply_author_id() ;
    $role = bbp_get_user_role( $displayed_user);
    if ( bbp_is_user_keymaster($displayed_user) ||$role == 'bbp_moderator')  {
    echo '<li>' ; 
    echo 'I im in supporting group';
    echo '</li>' ;
    }
    }
    
    add_action ('bbp_theme_after_reply_author_details', 'rew_role_show') ;
    	
    

    Functions files and child themes – explained !

    #157562
    Robin W
    Moderator

    just tested and

    add_filter( 'bbp_get_author_link', 'remove_author_links', 10, 2);
    add_filter( 'bbp_get_reply_author_link', 'remove_author_links', 10, 2);
    add_filter( 'bbp_get_topic_author_link', 'remove_author_links', 10, 2);
    function remove_author_links($author_link, $args) {
    	$author_link = preg_replace(array('{<a[^>]*>}','{}'), array(" "), $author_link);
    	return $author_link;
     }
     
    
    add_filter ('bbp_before_get_author_link_parse_args' , 'rew_remove_avatar' ) ;
    add_filter ('bbp_before_get_reply_author_link_parse_args' , 'rew_remove_avatar' ) ;
    add_filter ('bbp_before_get_topic_author_link_parse_args' , 'rew_remove_avatar' ) ;
    function rew_remove_avatar ($args) {
    	$args['type'] = 'name' ;
    	return $args ;
    }
    
    

    seems to do what is required

    #157559
    melanie bund
    Participant

    Hi ok am reactivating source code – i managed to hide the url, but i dont actually want to do that i want to make it so it doesnt link otherwise you have “started by “. Another idea can i link it to their profile page which is not part of bbpress “http://photohunters.org/photohunters/my-profile/&#8221;

    site page
    http://photohunters.org/photohunters/forum/2nd-hand-market/

    i really do appreciate your help – am just trying to strip the forum down to the bare minimum
    thank you
    Melanie

    #157535
    Robin W
    Moderator

    Can you give us a screen shot of IE and one of safari – just saves me loading this code (so I can help others as well as you) , so I can quickly see the difference

    #157534
    Robin W
    Moderator

    sorry this support forum is manned by volunteers so we do this in our spare time and for free.

    I presume you got this code from

    http://www.digitspeak.com/blogging/wordpress/remove-bbpress-forum-profile-url-link/

    when you say

    the avatar reappears which i managed to get rid of – is there another workaround?

    can you explain a bit more about

    i managed to get rid of

    what did you do?

    #157532
    melanie bund
    Participant

    Hi am posting this again as have had no response
    Hi Have tried to remove the link from username with below code but when i use it, the avatar reappears which i managed to get rid of – is there another workaround?

    add_filter(‘bbp_before_get_breadcrumb_parse_args’, ‘mycustom_breadcrumb_options’);
    add_filter( ‘bbp_get_author_link’, ‘remove_author_links’, 10, 2);
    add_filter( ‘bbp_get_reply_author_link’, ‘remove_author_links’, 10, 2);
    add_filter( ‘bbp_get_topic_author_link’, ‘remove_author_links’, 10, 2);
    function remove_author_links($author_link, $args) {
    $author_link = preg_replace(array(‘{<a[^>]*>}’,'{}’), array(” “), $author_link);
    return $author_link;
    }

    thanks in advance
    Melanie

    #157527
    raytronx
    Participant

    It looks like my issue with the BCCs is being caused by the wpMandrill plugin I use to send emails through the Mandrill service

    The Mandrill API previously couldn’t deal with BCC emails, it has been updated but it’s WP plugin hasn’t.
    I tried this code offered by a user but it ended up sending two emails. One with no BCCs showing and one with the same BCCs showing problem. https://wordpress.org/support/topic/how-to-contribute-fixed-bcc

    #157519
    sajjad
    Participant

    Any reply yet!!!
    I have request to help me to correct this code. I am not expert in php.
    Thank you to all …

    #157501
    laddi
    Participant

    @Robin, 😯 Woooooooow, Amazing, Man its working, :mrgreen:
    Thanks a Billion Trillion Robin, My dear…
    Oh I am so happy to see its gone… 😀 😀

    Hey, Robin, check it out man, we just got it. You are super. If we could meet, I must arrange a Beer Party.

    Oh this is the lovely piece of art: 💡

    remove_filter( 'bbp_get_reply_content', 'bbp_make_clickable', 4);
    remove_filter( 'bbp_get_topic_content', 'bbp_make_clickable', 4); 

    So everybody just use this above code to stay better in Google, and Don’t Forget to Thanks dear Robin W. All Credit Goes to Him. Hats Off!

    Please make this topic Resolved.

    #157495
    netposer
    Participant

    The main forum page (created during the install process using Method 1 or Method 2 shows no forum info.

    If I create a new topic (admin) and go directly there I can see the post, reply and see other forums

    I created a forum called “t-forums” and added “For Sale” and “General” under that. Everything works just great except the parent (Forums).
    Home › Forums › t-forums › For Sale

    So the parent (Forums) seems broke and doesn’t show the forum items on it’s page.

    I’ve removed the plugin and added it back with the same results.

    #157490
    YardenSade
    Participant

    Hello guys,
    I tried to search for this topic for some time, and I found a lot of answers but non of them was on the point for my simple yet maybe difficult task.
    My client needs the forum to be visible only for users/some users.
    Basically only the users should be able to see the forums while others won’t even know it exist.

    Can someone please help me with on the point solution, and if non exist I would have to use some bypass, maybe even make my own php code – which I rather avoid.

    Thanks for reading and helping!
    Techical: using 4.1 WP and latest bbpress.

    #157489
    Robin W
    Moderator

    if you get the remove filter working in the other post you could have it ‘removed’ as default and then add a conditional filter

    e.g. if users has posted xx topics then {
    add_filter( ‘bbp_get_reply_content’, ‘bbp_make_clickable’, 10 );
    add_filter( ‘bbp_get_topic_content’, ‘bbp_make_clickable’, 10 );
    }

    but you’d need to code that yourself as I’m time strapped at the moment

    #157488
    Robin W
    Moderator

    ok, you got me interested enough to look it up.

    bbPress now uses its own version of make_clickable, so the two filters are :

    add_filter( 'bbp_get_reply_content', 'bbp_make_clickable', 4    );
    add_filter( 'bbp_get_topic_content', 'bbp_make_clickable', 4    );
    

    so you need

    remove_filter( 'bbp_get_reply_content', 'bbp_make_clickable', 4);
    remove_filter( 'bbp_get_topic_content', 'bbp_make_clickable', 4);
    #157485
    laddi
    Participant

    Not Working with 10 🙁

    
    
    remove_filter( 'the_content', 'make_clickable', 10 );
    remove_filter( 'post_content', 'make_clickable', 10 );
    remove_filter( 'bbp_get_reply_content', 'make_clickable', 10 );
    remove_filter( 'bbp_get_topic_content', 'make_clickable', 10 );
    
    
    #157477
    Robin W
    Moderator

    The remove filter above I mentioned is not working for me, I even tried changing the priority 1 to 255.

    The remove must have the same priority – see

    https://codex.wordpress.org/Function_Reference/remove_filter

    #157464

    In reply to: Group Forum Tab

    Robin W
    Moderator

    since you are trying to change a function in buddypress viz ‘bp_setup_nav’ then logically it is buddypress.

    Anyway try

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'Forums' ) {
    	$translated_text = 'Chapters';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );
    #157453
    Robin W
    Moderator

    create a directory on your theme called ‘bbpress’
    ie wp-content/%your-theme-name%/bbpress
    find
    wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/%your-theme-name%/bbpress/loop-single-forum.php
    bbPress will now use this template instead of the original

    Then change line 50 of this file from

    <?php bbp_list_forums(); ?>
    

    to

    <?php //bbp_list_forums(); ?>
    
    

    This will, stop it listing sub forums.

    Come back if that’s not what you wanted

    #157441
    laddi
    Participant

    Hello,
    I am tired but couldn’t find a way to stop converting a simple url text into a hyperlink url.

    This is where I working >> http://www.punjabi.cc/topics/zikar-lyrics-jagjeet-kooner/

    Is there any way I can remove this filter, even the code below returns no desired result.

     remove_filter( 'bbp_get_reply_content', 'make_clickable');
    remove_filter( 'bbp_get_topic_content', 'make_clickable');
    

    How to remove this?, Please help me guyz…

    #157439
    laddi
    Participant

    Really thankful for valuable reply and code.

    #157435
    sajjad
    Participant

    Can anyone help me to correct this code?
    Thanks a lot

Viewing 25 results - 9,601 through 9,625 (of 32,511 total)
Skip to toolbar