Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 9,651 through 9,675 (of 32,505 total)
  • Author
    Search Results
  • #157251
    Stagger Lee
    Participant

    A lot of work ? Looks very nice. I had to check source code to see if you are cheating. 🙂

    #157250
    Stagger Lee
    Participant

    This seem to works. Or seems to work, I never know difference.

    add_filter('bbp_before_get_reply_author_role_parse_args', 'ntwb_bbpress_reply_css_role' );
    function ntwb_bbpress_reply_css_role() {
    
    	$role = strtolower( bbp_get_user_display_role( bbp_get_reply_author_id( $reply_id ) ) );
    	$args['class']  = 'bbp-author-role bbp-author-role-' . $role;
    	$args['before'] = '';
    	$args['after']  = '';
    
    	return $args;
    }
    
    add_filter('bbp_before_get_topic_author_role_parse_args', 'ntwb_bbpress_topic_css_role' );
    function ntwb_bbpress_topic_css_role() {
    
    	$role = strtolower( bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ) ) );
    	$args['class']  = 'bbp-author-role bbp-author-role-' . $role;
    	$args['before'] = '';
    	$args['after']  = '';
    
    	return $args;
    }
    #157249
    Robin W
    Moderator

    you could try something like the following in your function file (not tested)

    add_action  ('bbp_template_after_replies_loop', 'bbp_breadcrumb' ); 
    
    #157247

    In reply to: first post

    Matthias
    Participant

    Hm, it shows this error…
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'bb_auth_reply_view' not found or invalid function name in ..../blog/wp-includes/plugin.php on line 213

    #157245

    In reply to: first post

    Robin W
    Moderator

    I thought I can do it with a filter in functions.php.

    unfortunately not that easy if you don’t want to show the replies, as the loop-replies file has no easy filter to hook to !

    yes you can put this in your main theme, just be aware itr will get overwritten by any theme update, so keep a good note of what you did, so you can do it again if needed.

    create a directory on your theme called ‘bbpress’
    ie wp-content/%your-theme-name%/bbpress
    find
    wp-content/plugins/bbpress/templates/default/bbpress/loop-replies.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-replies.php
    bbPress will now use this template instead of the original

    so that gets the right file

    I wish I had time to write a solution for you for free, but I’m tied up in other work.

    but basically you want to look at lines

    <?php while ( bbp_replies() ) : bbp_the_reply(); ?>
    
    <?php bbp_get_template_part( 'loop', 'single-reply' ); ?>
    
    

    You want to stop it getting the template loop-single-reply if it is after pos 1, so something like

    <?php while ( bbp_replies() ) : bbp_the_reply(); ?>
    
    <?php // if user is not logged in and is the first reply
    if( !is_user_logged_in() && $rep_position =2 ) {
    echo  "Replies only viewable for logged in users";
    }
    // if user is not logged in and is after the forst reply, then don't do naything
    elseif( !is_user_logged_in() && $rep_position >2 ) {
    }
    //otherwise carry on as usual
    else bbp_get_template_part( 'loop', 'single-reply' ); ?>
    
    
    #157243

    In reply to: first post

    Matthias
    Participant

    I thought I can do it with a filter in functions.php.
    Don’t want to setup a child theme for this.
    Is it possible to do it with just adding a additonal bbpress file to my theme?

    My php-code knowledge is just search, copy and paste 😉

    Thanks
    Matthias

    #157242

    In reply to: first post

    Robin W
    Moderator

    the filter is just applying to the reply content.

    You probably want to amend a template – How php code/wordpress knowledgable are you?

    #157239

    In reply to: first post

    Matthias
    Participant

    I found a nice code, that shows the first message in a thread for everyone.
    Answer are shown only to logged in users.

    Perfekt so far.
    BUT the code shows in every answer the same message for non logged users
    “Replies only viewable for logged in users”

    Does anyone know, how to change the code, to show only one template-notice
    “Replies only viewable for logged in users” instead?

    
    function bb_auth_reply_view( $reply_id ) {
    $reply_id = bbp_get_reply_id( $reply_id );
    
    // Check if password is required
    if ( post_password_required( $reply_id ) )
    return get_the_password_form();
    
    $content = get_post_field( 'post_content', $reply_id );
    
    // first topic reply shouldn't be hiding
    $rep_position = bbp_get_reply_position($reply_id);
    
    // if user is not logged in and not the first post topic
    if( !is_user_logged_in() && $rep_position > 1 ) {
    return "Replies only viewable for logged in users";
    } else {
    // return normal
    return $content;
    }
    
    }
    add_filter( 'bbp_get_reply_content', 'bb_auth_reply_view' );

    Thanks
    Matthias

    #157234
    Robin W
    Moderator

    The you’ll need to add it into a function and add it to two actions

    ‘bbp_theme_before_reply_content’

    and

    ‘bbp_theme_after_reply_content’

    so for example

    Function agbams_share () {
    your code in here
    }
    
    add_action ('bbp_theme_after_reply_content' , 'agbams_share' ) ;
    add_action ('bbp_theme_after_reply_content' , 'agbams_share' ) ;
    

    see

    Step by step guide to setting up a bbPress forum – part 4

    #157231
    Robin W
    Moderator

    it will all depend on the order that the different css files bare loaded, so bbpress may be overwriting your theme ones

    try

    {
     font-size: 13px !important;
     }

    That says ‘don’t overwrite’

    #157225
    Stagger Lee
    Participant
    add_action( 'bp_before_member_header_meta', 'devb_show_role_on_profile');
    function devb_show_role_on_profile(){
     global $wp_roles;
     
    $user_id = bp_displayed_user_id();
     
    $user = get_userdata( $user_id );
     
    $roles = $user->roles;
     
     if( !$roles)
     return ;
     
     if ( !isset( $wp_roles ) )
     $wp_roles = new WP_Roles();
     
     $named_roles = array();
     
    foreach( $roles as $role ){
     
    $named_roles [] = $wp_roles->role_names[$role];
     }
     
    if( $named_roles )
     echo '<span class="user-role activity">'. join( ', ', $named_roles ) . '</span>';
     
    }

    Showing User role on BuddyPress Profile

    #157222
    Grantiusmaximus III
    Participant

    hey guys, im a complete noob to this whole CSS and webdesign stuff and need some help

    I am trying to increase the size of the font in the forum titles, (the info, topic, replies and freshness)

    i used this piece of css code but it isn’t working

    #bbpress-forums ul.bbp-lead-topic,
    #bbpress-forums ul.bbp-topics,
    #bbpress-forums ul.bbp-forums,
    #bbpress-forums ul.bbp-replies,
    #bbpress-forums ul.bbp-search-results
    {
    font-size: 13px;
    }

    (the theme i am using gives me a built in css sheet to pop any snippets that i may require in there and updates it live without going into the back end)

    here is the link to my forum.

    http://kamikazenoodle.co.uk/forums/

    #157212
    eVersatile
    Participant

    Hello,
    I have been trying to change the tab ‘forum’ in groups. Not the slug, the name of it. I’d like “Forums” to read “Chapters”.
    Here is the script I currently have on there.

    function mb_profile_menu_tabs(){
    global $bp;
    $bp->bp_nav['activity']['name'] = 'Updates';
    $bp->bp_nav['groups']['name'] = 'Books';
    $bp->bp_nav['buddyblog']['name'] = 'Library';
    $bp->bp_options_nav['profile']['change-avatar']['name'] = 'Change Profile Picture';
    $bp->bp_options_nav['buddyblog']['my-posts']['name'] = 'Library';
    unset($bp->bp_nav['forums']);
    unset($bp->bp_nav['groups']);
    unset($bp->bp_nav['forums']);
    bp_core_remove_subnav_item( 'buddyblog', 'edit' );
    }
    add_action('bp_setup_nav', 'mb_profile_menu_tabs', 201);
    function change_profile_submenu_tabs(){
    global $bp;
    $bp->bp_options_nav['groups']['my-groups']['name'] = 'Authored & Edited Books';
    $bp->bp_options_nav['groups']['invites']['name'] = 'Invites to be Editor';
    }
    add_action('bp_setup_nav', 'change_profile_submenu_tabs', 999);
    function jm_move_group_activity_tab() {
      global $bp;
      if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) {
        $bp->bp_options_nav[$bp->groups->current_group->slug]['forum']['name'] = 'not working';
        $bp->bp_options_nav[$bp->groups->current_group->slug]['home']['name'] = 'Updates';
        $bp->bp_options_nav[$bp->groups->current_group->slug]['members']['name'] = 'Editors';
        $bp->bp_options_nav[$bp->groups->current_group->slug]['admin']['name'] = 'Details';
        $bp->bp_options_nav[$bp->groups->current_group->slug]['send-invites']['name'] = 'Invite Editors';
      }
    }
    add_action('bp_setup_nav', 'jm_move_group_activity_tab', 999);
    add_action( 'bp_setup_nav', 'remove_group_unwanted_subnav_tab',500 );
     function remove_group_unwanted_subnav_tab() {
    
    bp_core_remove_subnav_item( bp_get_current_group_slug(), 'admin' );
    }

    I have tried it on a clean install as well and nothing seems to work. $bp->bp_options_nav[$bp->groups->current_group->slug]['forum']['name'] = 'not working'; Should be the line which changes the name of “Forums” tab but nothing is happening. Is there any other function specifically for this tab?

    laddi
    Participant

    Hello to all the bbPress Scientists out there.

    I am almost mad about to show bbPress User Role on BuddyPress Profile Page. And I am currently using this code, but it is not perfect and correct.

    
    function show_user_role () 
    		{
    		global $bp;
    		$reply_id = bbp_get_reply_id( $reply_id );
    		$abc_role = bbp_get_user_display_role( bbp_get_reply_author_id( $reply_id ) );
    		echo '<span class="profile-role ' . $abc_role . '"><i class="fa fa-star"></i> <em>';
    		echo $abc_role;
    		echo '</em></span>';
    	}
    add_action( 'bp_before_member_header_meta', 'show_user_role' );
    

    The demo output can be seen on http://www.punjabi.cc/ website by visiting any members profile.

    First problem with this code is, it does not show correct name for dynamic roles when user is not logged in.

    Second problem, the users who are blocked also tagged ‘Member’ not ‘Blocked’.

    Please either correct it or provide me a another perfect piece of code, I will be highly thankful.

    Regards,
    Laddi

    #157200
    cbalke
    Participant

    How do I go about getting into and editing the coding for the “img” button?

    Currently the code that is applied is (img src=”xxxxxxxx” alt=”ffs” /) with the ( ) being < > and the xxx’s being the images URL.

    I want to change the coding to (url=xxxxx)(img)xxxxx(/img)(/url) with the parentheses replaced with square brackets and xxxxx with the photo’s url.

    By doing so, the images can be clicked which would open a lightbox

    Thanks in advance for the help.
    Wordpress 4.1
    bbPress 2.5.4-5380

    #157194

    In reply to: bbPress Moderation

    cyclesha
    Participant

    Well, Robin, I just heard back from my host provider and all possible checks were done and an error code:

    Code:
    brk(0x5419000) = 0x5419000
    — SIGSEGV (Segmentation fault) @ 0 (0) —

    is what was found and they said it’s back to you.

    Now what?

    Bob.

    #157188
    Robin W
    Moderator

    This is a theme issue.

    You need to get bbpress to use the right theme template if possible.

    Suggest you look at

    Step by step guide to setting up a bbPress forum – Part 1

    and/or check with the theme author

    #157172
    eVersatile
    Participant

    Hello. I have been trying to rename the navigation menu “forum” within groups.
    Currently, I have this code implemented

    function jm_move_group_activity_tab() {
      global $bp;
      if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) {
        $bp->bp_options_nav[$bp->groups->current_group->slug]['forum']['name'] = 'new name';
        $bp->bp_options_nav[$bp->groups->current_group->slug]['home']['name'] = 'new name';
        $bp->bp_options_nav[$bp->groups->current_group->slug]['members']['name'] = 'new name';
        $bp->bp_options_nav[$bp->groups->current_group->slug]['admin']['name'] = 'new name';
        $bp->bp_options_nav[$bp->groups->current_group->slug]['send-invites']['name'] = 'new name';
      }
    }
    add_action('bp_init', 'jm_move_group_activity_tab');
    

    Everything works except for ‘forum’

    #157161
    UgoDimma
    Participant

    Yes I have the code, but the file to edit and where exactly to paste the code.

    #157160
    Robin W
    Moderator

    Do you know what the code is that you would add at that location?

    #157155

    In reply to: BBpress width

    Robin W
    Moderator

    ok, gentle response !!

    your forum is sitting within a class of .entry-content which is set to max-width: 474px;

    so you need to add

    .entry-content {
      max-width: 100% !important;
    }
    

    to your theme style.css at the end

    Strictly speaking you should add this to a child theme

    Functions files and child themes – explained !

    but if you add it to your main theme, juts keep a note of it, as you will need to re-add it should your theme be updated

    Come back if anything not clear, and I’ll help further !

    #157146
    UgoDimma
    Participant

    I want to add ShareThis sharing button at the top and bottom of every posts, but I dont know which file to edit and where exactly to add the code. Please someone guide me through. Am using bbpress 2.5.4 wordpress 4.1

    you can have a look at this screenshot to understand what I really need,
    http://s1382.photobucket.com/albums/ah248agbams/?action=view&current=sharethis_zps1df4998b.png

    #157136

    In reply to: BreadCrumb

    Robin W
    Moderator

    ok, I’m planning to write some code for another purpose that will be using this function in the next few days, when I do I’ll take a look

    #157135

    Hi there,

    I’m looking for an option to hold new topics by non-admin users in moderation for approval before they are visible. I’ve tried looking at this plugin: https://wordpress.org/plugins/bbpressmoderation/ but it deals with topics and replies together- you have to moderate both or not moderate both. I’m not interested in moderating replies, just topic starters.
    Could anybody by any chance suggest a different plugin, a code snippet to use etc. to work around this issue?
    (I’m running the latest versions on WordPress, BuddyPress and bbPress).
    Thank you very much!

    #157132
    mvaneijgen
    Participant

    I had to create several new users but I could not just copied and paste the code again so I modified the code a bit

    
    //code to add expert role 
    
    function add_expert_role( $bbp_roles )
    {
    	/* Add a role called expert */
    	$bbp_roles['bbp_expert'] = array(
    		'name' => 'expert',
    		'capabilities' => custom_capabilities_expert( 'bbp_expert' )
    		);
    	return $bbp_roles;
    }
     
    add_filter( 'bbp_get_dynamic_roles', 'add_expert_role', 1 );
    
    function expert_role_caps_filter( $caps, $role )
    {
    	/* Only filter for roles we are interested in! */
    	if( $role == 'bbp_expert' )
    		$caps = custom_capabilities_expert( $role );
     
    	return $caps;
    }
     
    add_filter( 'bbp_get_caps_for_role', 'expert_role_caps_filter', 10, 2 );
    
    function custom_capabilities_expert( $role )
    {
    	switch ( $role )
    	{
    		 
    		/* Capabilities for 'expert' role */
    		case 'bbp_expert':
    			return 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'   => true,
    				'read_hidden_forums'    => false,
     
    				// Topic caps
    				'publish_topics'        => true,
    				'edit_topics'           => true,
    				'edit_others_topics'    => false,
    				'delete_topics'         => false,
    				'delete_others_topics'  => false,
    				'read_private_topics'   => true,
     
    				// Reply caps
    				'publish_replies'       => true,
    				'edit_replies'          => true,
    				'edit_others_replies'   => false,
    				'delete_replies'        => false,
    				'delete_others_replies' => false,
    				'read_private_replies'  => true,
     
    				// Topic tag caps
    				'manage_topic_tags'     => false,
    				'edit_topic_tags'       => false,
    				'delete_topic_tags'     => false,
    				'assign_topic_tags'     => true,
    			);
    			break;
     
    		default :
    			return $role;
    	}
    }

    This creates the role Expert. I put this in my functions.php of my child-theme

Viewing 25 results - 9,651 through 9,675 (of 32,505 total)
Skip to toolbar