Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,401 through 5,425 (of 32,518 total)
  • Author
    Search Results
  • #182702
    mpnuu
    Participant

    Hello

    I have only added style.css file with comment section and functions.php file with my_theme_enqueue_styles() function as it is advised in Codex (https://codex.wordpress.org/Child_Themes). My website is not yet public, because I’m doing it for my customer and I don’t want to publish it before it is ready.

    #182684
    brettdarnesh
    Participant

    I have a number of not so happy customers being inundated with emails from the forum, they are receiving numerous repeat emails for some reason.

    I’m happy to try and figure it out, BUT for the URGENT NOW, I need a way to just shut off all the emails coming from bbpress. Is there a surefire way to do this?

    happy with functions.php code snippets, anything

    thanks for your help

    Brett

    #182681

    In reply to: bbp_reply_admin_links

    Robin W
    Moderator
    #182680

    In reply to: bbp_reply_admin_links

    Robin W
    Moderator

    sorry, this was not meant to be a solution, but rather to point you to then code

    'before' => '<span class="bbp-admin-links">',
    			'after'  => '</span>',

    is what it currently does, so if you wanted to take out the span entirely you would do

    function theredeclipse_change ($args) {
    	$args['before'] = '' ;
    	$args['after']   = '' ;
    return $args ;
    }
    #182678

    In reply to: bbp_reply_admin_links

    theredeclipse
    Participant

    I’ve tried at least to change <span> like in your example, but it doesn’t work. Aswell tried to pull this out in this way:

    add_filter ('bbp_reply_admin_links', 'theredeclipse_change' ) ;
    
    function theredeclipse_change ($retval, $r) {
    $r = bbp_parse_args( $args, array(
    			'before' => '<span class="bbp-admin-links">',
    			'after'  => '</span>',
    		), 'get_reply_admin_links' );
    return $retval ;
    }

    And several attempts more, but nothing happens :[

    #182677

    In reply to: How make full width

    Robin W
    Moderator
    #182663

    In reply to: bbp_reply_admin_links

    Robin W
    Moderator

    hmmm … if you want each link to be a button, I can point you to some code, but you’ll need to figure it out.

    so

    so for replies, the function is in

    bbpress/includes/replies/template.php

    which I think you found.

    function bbp_get_reply_admin_links( $args = array() ) {
    
    		// Parse arguments against default values
    		$r = bbp_parse_args( $args, array(
    			'id'     => 0,
    			'before' => '<span class="bbp-admin-links">',
    			'after'  => '</span>',
    			'sep'    => ' | ',
    			'links'  => array()
    		), 'get_reply_admin_links' );
    
    		$r['id'] = bbp_get_reply_id( (int) $r['id'] );
    
    		// If post is a topic, return the topic admin links instead
    		if ( bbp_is_topic( $r['id'] ) ) {
    			return bbp_get_topic_admin_links( $args );
    		}
    
    		// If post is not a reply, return
    		if ( !bbp_is_reply( $r['id'] ) ) {
    			return;
    		}
    
    		// If topic is trashed, do not show admin links
    		if ( bbp_is_topic_trash( bbp_get_reply_topic_id( $r['id'] ) ) ) {
    			return;
    		}
    
    		// If no links were passed, default to the standard
    		if ( empty( $r['links'] ) ) {
    			$r['links'] = apply_filters( 'bbp_reply_admin_links', array(
    				'edit'  => bbp_get_reply_edit_link ( $r ),
    				'move'  => bbp_get_reply_move_link ( $r ),
    				'split' => bbp_get_topic_split_link( $r ),
    				'trash' => bbp_get_reply_trash_link( $r ),
    				'spam'  => bbp_get_reply_spam_link ( $r ),
    				'reply' => bbp_get_reply_to_link   ( $r )
    			), $r['id'] );
    		}
    
    		// See if links need to be unset
    		$reply_status = bbp_get_reply_status( $r['id'] );
    		if ( in_array( $reply_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ) ) {
    
    			// Spam link shouldn't be visible on trashed topics
    			if ( bbp_get_trash_status_id() === $reply_status ) {
    				unset( $r['links']['spam'] );
    
    			// Trash link shouldn't be visible on spam topics
    			} elseif ( bbp_get_spam_status_id() === $reply_status ) {
    				unset( $r['links']['trash'] );
    			}
    		}
    
    		// Process the admin links
    		$links  = implode( $r['sep'], array_filter( $r['links'] ) );
    		$retval = $r['before'] . $links . $r['after'];
    
    		return apply_filters( 'bbp_get_reply_admin_links', $retval, $r, $args );
    	}

    which you can filter at the end, but how would depend on your skills.

    the span part can be simply changed by putting a filter into your child theme’s function file

    eg

    add_filter ('bbp_before_get_reply_admin_links_parse_args', 'theredeclipse_change' ) ;
    
    function theredeclipse_change ($args) {
    	$args['before'] = '<span class="bbp-admin-links">' ;
    	$args['after']   = '</span>' ;
    return $args ;
    }

    and just change whatever you want the span part to look like, or just remove it.

    if you want to style each link, then you’ll see that there is a call to each separate function

    'edit'  => bbp_get_reply_edit_link ( $r ),
    				'move'  => bbp_get_reply_move_link ( $r ),
    				'split' => bbp_get_topic_split_link( $r ),
    				'trash' => bbp_get_reply_trash_link( $r ),
    				'spam'  => bbp_get_reply_spam_link ( $r ),
    				'reply' => bbp_get_reply_to_link   ( $r )
    

    so to do it in functions, you’d need to go to each one.

    you’ll find these in the same file above

    since the class is hard coded, you could add a final filter with a preg_replace

    eg

    add_filter( 'bbp_get_reply_move_link' , 'theredeclipse_move', 10 , 2 ) ;
    
    function theredeclipse_move ($retval, $r) {
    $retval =  preg_replace(whatever args you need, with, $retval);
    return $retval ;
    }

    so $retval will hold the line of code including the class.

    so google preg-replace and see if you can get it working !!

    Ryan Giglio
    Participant

    Turns out every lead I was following was a red herring.

    I had another function hooked into wp_insert_post that was redirecting you back to the Video single page instead of sending you to the Thread single page if you posted your reply FROM the Video single page. It turns out that redirect was hitting and stopping execution before the bbp_new_reply actions were allowed allowed to fire.

    I changed that function to also hook into bbp_new_reply and changed its priority to 11 so it would run after the native actions. Working great!

    #182655

    In reply to: bbp_reply_admin_links

    theredeclipse
    Participant

    Default output looks like

    <span class="bbp-admin-links">
    // inside different classes of links
    </span>

    I would like change it to
    <a class="button"></a>
    So I want to delete span from output and use one style for each <a> link, if its possible.

    And the thing is – I could do it by modifying forum files, but after update it will be overwritten. So I want to use bbpress functions php file to change output, but I don’t know how. I hope I’ve explained it well 😛

    Ryan Giglio
    Participant

    I’m working an educational website that produces video content and uses a BBPress forum for discussion rather than the native WordPress comments. Here’s how it works:

    I have a hook on wp_insert_post that creates a new BBPress topic when a new video post is created and saves this new topic_id to a _comment_topic_id meta field.

    In my single-video.php template where the video is displayed, I’m using the BBPress [bbp-single-topic id=$topic_id] shortcode to display the topic thread and reply form for people to post comments.

    All of this works great! I’m just having one problem – the “subscribe” feature of BBPress isn’t working when people post replies via the Video Single page. The reply is posted just fine, but subscribed users don’t receive a notification. If you’re not familiar – when a user subscribes to a thread, they receive an email whenever someone replies to the thread. This is still working fine when someone posts a reply via the actual Thread single page – it’s only a problem on the thread embedded via the shortcode on the Video single page.

    I’ve tried digging into the core and I got so far as to discover that the bbp_new_reply action isn’t firing – BBPress uses a function called bbp_notify_topic_subscribers hooked into bbp_new_reply to send the notifications and that function isn’t running at all when a reply is made via the Video single page.

    It seems that BBPress uses some hidden inputs to determine what actions to run after a reply has been submitted, but those seem to be included properly through the shortcode. These appear at the bottom of the Topic single form (that works properly);

        <input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="422573">
        <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="0">
        <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply">
        <input type="hidden" id="_wpnonce" name="_wpnonce" value="83ea236cd1">
        <input type="hidden" name="_wp_http_referer" value="/forums/topic/SLUG/">

    And these appear at the bottom of the Video single form (that doesn’t)

        <input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="422573">
        <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="0">
        <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply">
        <input type="hidden" id="_wpnonce" name="_wpnonce" value="83ea236cd1">
        <input type="hidden" name="_wp_http_referer" value="/videos/SLUG/">

    I’m at a loss for how to debug this issue further and could really use some help. BBPress has all kinds of page type/post type checks in the core that I’ve been ducking and weaving around, but this one has got me stumped. I suspect the problem is that SOMEWHERE it’s checking the post type of the current post, seeing it’s a video instead of a topic and bailing before the action runs, but I have no idea how or where to find that and how to patch around it.

    Thanks!

    #182603
    Pascal Casier
    Moderator

    This is bbPress, for BuddyPress you could check the BuddyPress forums 🙂

    Below just a quick idea to stop ALL email to subscribers, but UNTESTED:

    function casiepa_fltr_get_forum_subscribers( $user_ids ) {
    	return array();
    }; 
    // add the filter 
    add_filter( 'bbp_forum_subscription_user_ids', 'casiepa_fltr_get_forum_subscribers', 10, 1 );
    #182589
    Anonymous User
    Inactive

    Hello,

    Sorry if I am bumping this old thread, but there’s already a thread open for this over wporg support forums at https://wordpress.org/support/topic/does-this-have-shortcode-can-use-this-in-wordpress-sidebar-as-form/. I left you a reply from there.

    Best,
    Samuel

    #182582
    fastk9dad
    Participant

    I am looking to make my “New Topic” button below follow the pagination, by that I mean if there is only one page and the pagination links don’t exist I want the “New Topic” button to appear all the way to the right. If there is pagination I want it to sit at it’s left most side like my example below. Right now I’m just placing it there in a static position which means on pages with no pagination it’s just floating in space.

    Example position:
    button position

    This is the static code I’m using for the button:

    #bbpress-forums .new-topic {
        margin-top: -41px;
        margin-right: 80px;
        float: right;
    }
    #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

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