tech55541 (@tech55541)

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 71 total)
  • @tech55541

    Participant

    Hello,
    Also figured out this one, you can use these 2 functions.

    bbp_get_topic_subscription_link
    bbp_get_topic_favorite_link

    Thanks.

    @tech55541

    Participant

    Hello,
    It was a CSS issue, all fixed.

    Thanks.

    @tech55541

    Participant

    Thanks, got it.

    @tech55541

    Participant

    Hello,
    Any help over here?

    Thanks.

    @tech55541

    Participant

    Hello,
    Yes sort of. My email is redirected to Office 365, now on my old host when this happened, I could not use the internal php mail function, it had to be an SMTP account on a sub domain that was not redirected over to Office 365. Although it is not required where I am now, it seems that using SMTP is safer.
    I had to change the sending address and name so BBPress would talk to the WP SMTP plugin if you know what I mean. Had to do the same for BuddyPress.

    Thanks.

    @tech55541

    Participant

    Hello,
    I found some working code, could you please just check it to make sure it is 100% valid and I am not missing anything?

    /*BBPress email fix*/
    add_filter( 'wp_mail_from_name', 'email_sent_from_name' );
    function email_sent_from_name( $name )
    {
        return 'SITE NAME';
    }
    add_filter( 'wp_mail_from', 'email_sent_from' );
    function email_sent_from( $email )
    {
        return 'email@example.com';
    }

    Yes, I did replace the values with required ones such as the address and send from name.

    Thanks.

    @tech55541

    Participant

    Hello,
    I still need some code to change these 2 items, if you could help me come up with something, that would be great.

    @tech55541

    Participant

    Thanks.

    @tech55541

    Participant

    Hello,
    Anyone? This is not custom coding for me, this is a possible bug, is anyone going to look?

    Thanks.

    In reply to: BBPress Slow

    @tech55541

    Participant

    Hello,
    It is possible that the page was waiting for the plugin or API call to load first before your content. This would explain the delay.

    Thanks.

    @tech55541

    Participant

    Thanks @robkk, that code in functions.php did the trick.

    @tech55541

    Participant

    Sure, anytime. Glad it worked for you.

    @tech55541

    Participant

    Hello,
    Actually after further testing, my code above for some reason hid the Forums, Topics, and Replies menu from people who had access to view them. Here is an updated piece of code that does not have this problem.

    /*Customize the BBPress roles to allow Participants to trash topics
    add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 10, 2 );
    
    function ST_add_role_caps_filter( $caps, $role ){
        // Only filter for roles we are interested in!
        if( $role == 'bbp_participant' ) {
    
    	$new_caps = array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    'view_trash'            => false,
    
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => false,
                    'read_hidden_forums'    => false,
    
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => true,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => false,
    
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => true,
                    'delete_others_replies' => false,
                    'read_private_replies'  => false,
    
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );	
    
    	}
    
        return $new_caps;
    }
    /*Fixes an issue that only allows mods to trash topics.
    bbpress.trac.wordpress.org/changeset/5852
    bbpress.trac.wordpress.org/ticket/2685*/
    
    add_filter( 'bbp_map_reply_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 );
    add_filter( 'bbp_map_topic_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 );
    
    // tweak for replies
    function ST_tweak_trash_meta_caps( $caps, $cap, $user_id, $args ){
    
    	// apply only to delete_reply and delete_topic
    	if ( $cap == "delete_reply" || $cap == "delete_topic" ){
    		// Get the post
    		$_post = get_post( $args[0] );
    		if ( !empty( $_post ) ) {
    
    			// Get caps for post type object
    			$post_type = get_post_type_object( $_post->post_type );
    			$caps      = array();
    
    			// Add 'do_not_allow' cap if user is spam or deleted
    			if ( bbp_is_user_inactive( $user_id ) ) {
    				$caps[] = 'do_not_allow';
    
    			// Moderators can always edit forum content
    			} elseif ( user_can( $user_id, 'moderate' ) ) {
    				$caps[] = 'moderate';
    
    			// User is author so allow edit if not in admin
                } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
                    $caps[] = $post_type->cap->delete_posts;
    
    			// Unknown so map to delete_others_posts
    			} else {
    				$caps[] = $post_type->cap->delete_others_posts;
    			}
    		}
    
    	}
    	// return the capabilities
    	return $caps;
    }

    NOTE: Had to remove links.

    Thanks.

    In reply to: Hide User Role

    @tech55541

    Participant

    Hello,
    Please try this CSS code.

    .bbp-author-role {
    display: none;
    }

    Thanks.

    In reply to: Hide User Role

    @tech55541

    Participant

    Hello,
    Could you please send us a direct link to a page with user roles on it?

    Thanks.

    @tech55541

    Participant

    Hello,
    No one apparently wants to help at wordpress.stackexchange.com, anywhere else you suggest? Is there anyone else on this forum that is a Jquery expert?

    Thanks.

    @tech55541

    Participant

    OK, that makes since.

    Thanks for clearing that up.

    @tech55541

    Participant

    Thanks.

    @tech55541

    Participant

    Hello @robkk,
    Does the meta_key have to be a specific value? Or can it be anything? If it is a specific value, how would you find it? I tried inspecting the resolutions toggle for some kind of number, but could not find one.

    Thanks, can’t wait to here back.

    In reply to: Hide User Role

    @tech55541

    Participant

    Hello,
    You can put it in a child theme style.css file. You can also use this plugin.
    https://wordpress.org/plugins/simple-custom-css/

    Thanks.

    In reply to: Private Message

    @tech55541

    Participant

    Hello,
    The best thing to do I think is to use BuddyPress. It seems like a lot of extra work, but you can really build a nice community that way.

    BuddyPress


    The plugin posted above would also work.

    Thanks.

    In reply to: Hide User Role

    @tech55541

    Participant

    Hello,
    Please try this CSS code.

    #bbpress-forums div.bbp-forum-author .bbp-author-role, #bbpress-forums div.bbp-topic-author .bbp-author-role, #bbpress-forums div.bbp-reply-author .bbp-author-role {
    display: none;
    }

    Thanks.

    @tech55541

    Participant

    Hello,
    It was hard, but I and another member on a private dev forum were able to figure it out. What tripped us up was this.
    https://bbpress.trac.wordpress.org/ticket/2685
    Can’t believe this has not been fixed in core yet.

    Anyway, here is my full solution. All you have to do is add this code to functions.php.

    /*Customize the BBPress roles to allow Participants to trash topics*/
    add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 999, 2 );
    
    function ST_add_role_caps_filter( $caps, $role ){
    if( $role == bbp_get_participant_role() || $role == "default" ) {
    
    	$new_caps = array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    'view_trash'            => false,
    
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => false,
                    'read_hidden_forums'    => false,
    
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => true,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => false,
    
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => true,
                    'delete_others_replies' => false,
                    'read_private_replies'  => false,
    
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );	
    
    	}
    
        return $new_caps;
    }
    /*Fixes an issue that only allows mods to trash topics.
    https://bbpress.trac.wordpress.org/changeset/5852
    https://bbpress.trac.wordpress.org/ticket/2685*/
    
    add_filter( 'bbp_map_reply_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 );
    add_filter( 'bbp_map_topic_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 );
    
    // tweak for replies
    function ST_tweak_trash_meta_caps( $caps, $cap, $user_id, $args ){
    
    	// apply only to delete_reply and delete_topic
    	if ( $cap == "delete_reply" || $cap == "delete_topic" ){
    		// Get the post
    		$_post = get_post( $args[0] );
    		if ( !empty( $_post ) ) {
    
    			// Get caps for post type object
    			$post_type = get_post_type_object( $_post->post_type );
    			$caps      = array();
    
    			// Add 'do_not_allow' cap if user is spam or deleted
    			if ( bbp_is_user_inactive( $user_id ) ) {
    				$caps[] = 'do_not_allow';
    
    			// Moderators can always edit forum content
    			} elseif ( user_can( $user_id, 'moderate' ) ) {
    				$caps[] = 'moderate';
    
    			// User is author so allow edit if not in admin
                } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
                    $caps[] = $post_type->cap->delete_posts;
    
    			// Unknown so map to delete_others_posts
    			} else {
    				$caps[] = $post_type->cap->delete_others_posts;
    			}
    		}
    
    	}
    	// return the capabilities
    	return $caps;
    }

    I suppose this was the correct way to do it @casiepa?

    Thanks.

    In reply to: Delete own posts

    @tech55541

    Participant

    Hello,
    Where does this code go?

    Thanks.

    In reply to: Delete own posts

    @tech55541

    Participant

    Hello there,
    What exactly does this code do? Does it allow participants to delete or trash posts? That is my question.
    I enable the capability for participants to delete posts, but they cannot delete if they cannot trash the post first. The only way for trash to show up is to enable the moderate capability which opens up way to many options. Is there any way to modify this code to only allow participants to trash their posts?

    Thanks.

Viewing 25 replies - 1 through 25 (of 71 total)