Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,401 through 5,425 (of 32,505 total)
  • Author
    Search Results
  • #182581
    fastk9dad
    Participant

    Update: I was able to figure out how to achieve my desired result via CSS by using this code:

    .bbppu-mark-as-read:after {
        content: '|';
        padding-left: 10px;
        padding-right: 10px;
    }

    The result:
    link separator

    #182560
    fastk9dad
    Participant

    Background: I have my forum Subscribe link on the right side of the header using float:right, I am also running Pencil Unread plugin and have enabled the “Mark all as read” option and also used float:right to prevent it from blending in with the breadcrumbs however now “mark all as read” and “subscribe” are getting up close and personal like this:

    Mark all as readSubscribe

    Ideally I would like to insert a pipe and a couple of spaces between them to follow suit with how the topics page is formatted like this:

    Mark all as read | Subscribe

    I have searched the forums high and low and haven’t really come up with an answer. I tried looking for the “bbp_template_before_topics_loop” code figuring I could add it to my child theme and modify it at will but turned up empty.

    So what is the best way to accomplish this?

    #182554
    Kalusha
    Participant

    I have now this code into functions

    ##Name ändern Participant in User Standard User
    function my_custom_roles( $role, $user_id ) {
    if( $role == ‘Teilnehmer’ )
    return ‘Standard User’;

    return $role;

    }

    add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles’, 10, 2 );

    function my_custom_roles2( $role, $user_id ) {
    if( $role == ‘Keymaster’ )
    return ‘Michael’;

    return $role;
    }

    add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles2’, 10, 2 );

    function my_custom_roles3( $role, $user_id ) {
    if( $role == ‘Zuschauer’ )
    return ‘Premium User’;

    return $role;
    }

    add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles3’, 10, 2 );

    So I change only the names. Now I must to have that the spectator has the same capability as the participants. So I have no code for this found, I have change the capability.php in bbpress core. I know it´s not the best way and after a Update I must change it again but it works. I have no other idea. 🙁

    #182553
    Robin W
    Moderator

    can you paste the exact code you are using into here, and I’ll check it

    #182551
    Robin W
    Moderator

    follow this link with a description on how to do this

    Custom Capabilities

    #182481
    sally
    Participant

    Hi Robin,

    thanks so much for the adapted code, all works yet perfect!!!

    Thanks for the Support!

    Best Regards
    Sally

    #182467
    Robin W
    Moderator

    ok, this code allows participabts to

    trash their own replies and
    trash their own topics where there have been no replies, once a reply has been posted then they can no longer delete.

    it does display slightly weirdly when you delete a topic, but it is the best you are going to get from me.

    give it a try and see if you still have the admin problems

     /*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_get_participant_role() ) {
    			
    			$newcaps = array(
    
    				// Primary caps
    				'spectate'              => true,
    				'participate'           => true,
    
    				// Forum caps
    				'read_private_forums'   => true,
    
    				// Topic caps
    				'publish_topics'        => true,
    				'edit_topics'           => true,
    				'delete_topics'         => true,
    				'view_trash'			=> true,
    				
    
    				// Reply caps
    				'publish_replies'       => true,
    				'edit_replies'          => true,
    				'delete_replies'        => true,
    				
    				
    				// Topic tag caps
    				'assign_topic_tags'     => true,
    			);
    	
    	return $newcaps;
    	}
    	
        return $caps;
    }
    
    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 );
    
    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 =  $_post->post_type ;
    			
    			
    			// 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 particiapte so allow delete 
                } elseif ( user_can( $user_id, 'participate' ) && ( (int) $user_id === (int) $_post->post_author ) ) {
                 
    			//allow any reply to be deleted
    			if ($post_type == bbp_get_reply_post_type()) $caps  = array('delete_replies') ;
    			
    			//only allow topic delete if there are no replies
    			if ($post_type == bbp_get_topic_post_type()) {
    				$reply_count = bbp_get_topic_reply_count();
    
    				if ( $reply_count == 0)  $caps  = array('delete_topics') ;
    			}
    			
    			// Unknown so do not allow
    			} else {
    				$caps[] = 'do_not_allow';
    			}
    		}
    		
    	}
    	
    	// return the capabilities
    	return $caps;
    	
    }
    #182431
    sally
    Participant

    Hi Robin,

    yes, when participant roles delete replies it works. I was thinking, when a participant delete a topic what he creates, and a lot of users reply to this, after he deletes, all the replies are as well deleted, made no sense.

    Is it possible, to take out the possibility for participants to delete the topics? They should be only able to delete the replies of them

    Regarding the Admin Role:

    When i activate the Code in the Dashboard the following happens

    1.) yes, thats correct. With activated code as Admin i cannot manage / access the Forums page and cannot create topics and replies, when logged in.

    To test then, i opened in the same browser a second Tab and pasted the http://domain.com/forums link and refreshed the browser to see if it works there, but i still get redirected to the Homepage (Landing page)…

    Also what is strange, under Dashboard – Admin Menu the Links Forums, Topics and Replies are complete missing …, when deactivating the code they appear again..

    Regards
    Sally

    #182427
    Robin W
    Moderator

    deleting replies will redirect to the topic that still exists, so that will work!

    deleting topics redirects to the topic which no longer exists, so gets a 404 error which your site directs to the homepage – not sure how to fix that. A moderator can still view the topic, so that is ok. might be able to do some code with a readtopics capability so that an author can view his own closed topics.

    on admins – Sorry I still don’t quite understand.

    1. so I have a browser tab logged into admin, and showing the dashboard. I then open another tab in the same browser and paste in a forums link and it goes to the homepage – yes ?
    2. if so – I can’t replicate
    3. Why do you need to do this?

    #182416
    sally
    Participant

    Yes, the code on top works, only the redirection seems to be the issue..

    Role Admin

    When code is activated, and I login to the Admin Dashboard, and enter the forums link, I get redirected to the homepage, cannot access / view the forums .

    When I deactivate the code, I can access the forums link as Admin..

    Participant

    Delete Topics

    Topics can be trashed and deleted, but after pressing Trash, Participant Role get redirected to homepage

    Delete Reply’s

    Reply’s can be trashed / deleted without redirection, works fine…

    Thx
    Regards
    Sally

    #182415
    Robin W
    Moderator

    ok, whilst out I think I know what the issue is.

    Firstly can you confirm that apart from redirecting you to home, the code at the top of this thread works? ie redirection to the wrong place is the only outstanding issue.

    If so, the issue is that after you delete a topic, bbpress sends you to back to the topic, which as a moderator you are allowed to see trashed topics, but as a partyicipant you are not. This then will send you to a 404 page, which in your case I think just sends you to home.

    So let me look at ways to get around this.

    #182413

    In reply to: bbp-messages

    russ8523
    Participant

    Hi Samuel,
    First ley me say that I am a beginner, this being my first WP site. I can not handle code. Secondly, my site has now been completely rebuilt online in a sub directory – the Wamp version was messed up! The site is at https://newsite.hampsteadbowmen.com. I can give you Admin access if you give me a private email? I will copy this into the other thread.

    Regards,
    Stewart

    #182411

    In reply to: bbp-messages

    Ismail
    Participant

    Hello everyone,

    Sorry but I just came to discover this thread, I am the author of bbp-messages and there’s now a major update made and it now supports Multisite, the problem that Stewart was reporting.

    Also Stewart, the link wordpress/members1/http:/localhost/wordpress/members1/ pretty much seems messed up, so it’s hard to tell whether it is bbP issue or configuration. I think you did not configure your testing environment quite well and also the bbPress link looks filtered by BuddyPress. Next time I’d suggest you edit your hosts file (c:\System32\drivers\etc\hosts with admin permissions using notepad) and add a new entry 127.0.0.1 bbpress.dev now bbpress.dev will act like a normal domain and you wouldn’t run into issues while testing or migrating (all you can do is replace .dev with .tld in the db SQL file). Also add the virtual host for Apache http://stackoverflow.com/a/25203499/3910932

    Thank you Arutam and Robin you’re very helpful. I just wanted to point that this thread continues in wp-org plugin support forums https://wordpress.org/support/topic/messages-upgrade/

    Best,
    Samuel

    #182410
    sally
    Participant

    Hi Robin,

    Thanks for checking the code. Can you help me to get the open issues fixed with the origin code ?

    Best Regards
    Sally

    #182408
    Robin W
    Moderator

    though re-reading the thread this morning, I think I have not fixed anything, juts done it another way.

    and that doesn’t work either – forget the code above

    #182391
    Robin W
    Moderator

    ok, I’ve taken pity and kicked this round for an hour – I expect to be on your Christmas list !!!

    This seems to work, although please do some testing for all roles, and check it out.

    /*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_get_participant_role() ) {
    			
    			$caps = array(
    
    				// Primary caps
    				'spectate'              => true,
    				'participate'           => true,
    
    				// Forum caps
    				'read_private_forums'   => true,
    
    				// Topic caps
    				'publish_topics'        => true,
    				'edit_topics'           => true,
    				'delete_topics'         => true,
    				
    
    				// Reply caps
    				'publish_replies'       => true,
    				'edit_replies'          => true,
    				'delete_replies'        => true,
    
    				// Topic tag caps
    				'assign_topic_tags'     => true,
    			);
    
    	}
    	
        return $caps;
    }
    /*then only allow participants to trash their own topics*/
    
    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 );
    
    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 ( user_can( $user_id, 'participate' ) && ( (int) $user_id === (int) $_post->post_author ) ) {
                    $caps      = array();
    				//$caps[] = $post_type->cap->delete_posts;
    
    			// Unknown so do not allow
    			} else {
    				$caps[] = 'do_not_allow';
    			}
    		}
    	}	
    	// return the capabilities
    	return $caps;
    	}
    #182378
    AiratTop
    Participant

    I can open https://airat.biz/forums/ after delete [] in /plugins/bbpress/includes/forums/functions.php on lines 1800, 1818, 1832

    Old: $post_stati[]
    New: $post_stati

    And line 1854:
    Old: $meta_query[]
    New: $meta_query

    Can you check it out?

    I think this issue with php7 support

    Now i have a warning:
    [Thu Mar 02 20:46:15.572617 2017] [php7:warn] [pid 23849] [client ip] PHP Warning: array_unique() expects parameter 1 to be array, null given in /site_path/wp-content/plugins/bbpress/includes/forums/functions.php on line 1836

    #182377
    AiratTop
    Participant

    I have the same problem.

    I can’t open page https://airat.biz/forums/ and https://airat.biz/wp-admin/edit.php?post_type=forum
    Error 500

    I saved Permalinks, reinstalled plugin, but pages still don’t working.

    bbPress tools also don’t help
    /wp-admin/tools.php?page=bbp-repair

    Error log:

    [Thu Mar 02 20:33:57.235075 2017] [php7:error] [pid 16265] [client ip] PHP Fatal error: Uncaught Error: [] operator not supported for strings in /site_path/wp-content/plugins/bbpress/includes/forums/functions.php:1800\nStack trace:\n#0 /site_path/wp-includes/class-wp-hook.php(298): bbp_pre_get_posts_normalize_forum_visibility(Object(WP_Query))\n#1 /site_path/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array)\n#2 /site_path/wp-includes/plugin.php(515): WP_Hook->do_action(Array)\n#3 /site_path/wp-includes/class-wp-query.php(1681): do_action_ref_array('pre_get_posts', Array)\n#4 /site_path/wp-includes/class-wp-query.php(3238): WP_Query->get_posts()\n#5 /site_path/wp-includes/class-wp.php(617): WP_Query->query(Array)\n#6 /site_path/wp-includes/class-wp.php(735): WP->query_posts()\n#7 /site_path/wp-includes/functions.php(955): WP->main('')\n#8 /home/a in /site_path/wp-content/plugins/bbpress/includes/forums/functions.php on line 1800

    bbPress 2.5.12
    BuddyPress 2.8.1
    WordPress 4.7.2
    PHP 7.1.2-3+deb.sury.org~xenial+1

    #182374

    In reply to: Change query

    Robin W
    Moderator

    I am not sure I understand what it is you are asking

    wp-query is a wordpress function

    https://codex.wordpress.org/Class_Reference/WP_Query

    #182372

    Topic: Change query

    in forum Troubleshooting
    yito
    Participant

    In loop-replies.php, I want to change WP_Query.
    But ‘bbp_repliesisbbpress()->reply_query->have_posts();` ,so I don’t know how to change some of WP_Query.

    Please someone teach me how to.

    Wordpress version 4.7.2
    bbPress version 2.5.12

    #182355

    In reply to: User Role

    Robin W
    Moderator

    try this – it should work but is untested

    Please come back and let us know if it does or doesn’t

    add_filter ('kal_get_user_role_map()' , 'bbp_get_user_role_map()' ) ;
    
    function kal_get_user_role_map() {
    
    	// Get the default role once here
    	$default_role = bbp_get_default_role();
    
    	return (array) apply_filters( 'kal_get_user_role_map', array (
    		'administrator' => bbp_get_keymaster_role(),
    		'editor'        => $default_role,
    		'author'        => bbp_get_spectator_role(),
    		'contributor'   => $default_role,
    		'subscriber'    => $default_role
    	) );
    }

    This goes in your function file

    #182341
    russ8523
    Participant

    I simply want to edit the wording in the (Pale Blue), fields in the ‘Edit Profile’ section. an example: to change “Your password should be at least ten characters long. Use upper and lower case letters, numbers, and symbols to make it even stronger.” to “eight characters long”. Also the (Pale Blue), name field is empty, just a ‘period’. Where is the code/file located? I’ve searched high and low!?

    WP 4.7.2 bbpres 2.5.12 newsite.hampsteadbowmen.com

    Any help will be very much appreciated.

    #182320

    Topic: sidebar

    junglejim620
    Participant

    Hi bbPress,

    From the edit page, I used this shortcode [bbp-forum-index].

    Then set full template with no sidebars and from the bottom sidebar I chosen NONE. The page still showing the sidebar?

    The main question is, is there anyway making NOT to show the sidebar on the page?

    Please advise help, thanks

    #182307

    Hi Dominik,

    It’s great that you’re digging around the code to figure out what functions to use! Can you describe a bit about what you’d like to accomplish? Once we know the end result, we can help you work towards it, step by step.

    #182306

    In reply to: User Role

    Use the bbp_get_user_role_map filter, to map WordPress roles to bbPress roles.

Viewing 25 results - 5,401 through 5,425 (of 32,505 total)
Skip to toolbar