Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,476 through 3,500 (of 32,481 total)
  • Author
    Search Results
  • #204982
    Chuckie
    Participant

    It was suggested:

    https://codex.wordpress.org/Plugin_API/Filter_Reference/registration_redirect

    But I tried:

    add_filter( ‘registration_redirect’, ‘my_redirect_home’ );
    function my_redirect_home( $registration_redirect ) {
    return ‘https://www.publictalksoftware.co.uk/registration-complete’;
    }

    I used the “Snippets” plugin and it did not seem to work.

    #204974
    Robin W
    Moderator

    This code will change the WordPress profile to bbpress profile

    add_action('wp_before_admin_bar_render', 'rew_admin_bar_remove_wp_profile', 0);
    
    function rew_admin_bar_remove_wp_profile() {
            global $wp_admin_bar;
    
            /* **edit-profile is the ID** */
            $wp_admin_bar->remove_menu('edit-profile');
     }
    
    add_action('admin_bar_menu', 'rew_add_bbp_profile', 999);
    
    function rew_add_bbp_profile($wp_admin_bar) {
    	
    			$current_user = wp_get_current_user();
    			$user=$current_user->user_nicename  ;
    			$user_slug =  get_option( '_bbp_user_slug' ) ;
    			if (get_option( '_bbp_include_root' ) == true  ) {	
    				$forum_slug = get_option( '_bbp_root_slug' ) ;
    				$slug = $forum_slug.'/'.$user_slug.'/' ;
    			}
    			else {
    				$slug=$user_slug . '/' ;
    			}
    			
    			$profilelink = '/' .$slug. $user . '/edit' ;
    			
    			$wp_admin_bar->add_node( array(
    				'parent' => 'user-actions',
    				'id'		=> 'bbp-edit-profile',
    				'title' => 'Edit Profile',
    				'href' => $profilelink,
    			) );
    
    }

    Put this in your child theme’s function file – or use

    Code Snippets

    #204959
    demonboy
    Participant

    Hi Robin,

    Using your prompt I hacked something that removes the action altogether and just uses the if statement. On the loop-single-forum.php file I started with this:

    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 40250) ){
    ?>
         <li class="bbp-forum-info-40250">  
    <?php
        }
    
    else {?>
    	<li class="bbp-forum-info">
    <?php
    }?>

    where I set the CSS selector ‘bbp-forum-info-40250’ width to 100%. At the end of the template I then added this:

    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 40250) ){
    ?>
           
    <?php
        }
    
    else {?>	
    	<li class="bbp-forum-topic-count"><?php bbp_forum_topic_count(); ?></li>
            rest of the normal template follows
    	</li>
    <?php
    }?>

    where nothing appears for forum id 40250 and the rest of the template displays as normal for all other forums. So now my first forum description is 100% width without topic counts/views/freshness, whilst the rest of the forums display as normal.

    If interested you can see the result here.

    #204949
    Robin W
    Moderator

    agree line 2, and line 4 should be

    $user_id = $user->ID ;

    #204945
    Chuckie
    Participant

    On the login widget it has a register button. But it has no ID, so I had no choice but to use .user-submit like this:

    /* Main buttons */
    #bbp_user_edit_submit,
    #bbp_topic_submit,
    #bbp_reply_submit, #bbp_topic_content-tmce,
    #bbp_topic_content-html,
    #bbp_reply_content-tmce,
    #bbp_reply_content-html,
    #bbp_search_submit,
    .user-submit {
    	text-shadow: none;
    	font-style: normal;
    	background: #d35438 !important;
    	color: #000 !important;
      text-align: center;
      border-radius: 4px;
    	-moz-border-radius:4px;
      -webkit-border-radius:4px;
    	border: white 1px solid;
      -moz-box-shadow: none !important;
      -webkit-box-shadow: none !important;
    	box-shadow: none !important;
    }
    
    /* Main buttons - hover */
    #bbp_user_edit_submit:hover, #bbp_topic_submit:hover, #bbp_reply_submit:hover,
    #bbp_topic_content-tmce:hover,
    #bbp_topic_content-html:hover,
    #bbp_reply_content-tmce:hover,
    #bbp_reply_content-html:hover,
    #bbp_search_submit:hover,
    .user-submit:hover {
    	color: #fff !important;
      -moz-box-shadow: inset 0 0 20px #000 !important;
      -webkit-box-shadow: inset 0 0 20px #000 !important;
      box-shadow: inset 0 0 20px #000 !important;
    }
    

    It would be nice for consistency that this button have an official ID along with any other buttons missing the ID.

    #204944
    Chuckie
    Participant

    Understood. I know some php and know c++ and this tool looked not too much code. But then I don’t know the mechanics of BBPress and don’t really know how to debug properly except by trial and error for php.

    I might just try the tool on my staging site.

    #204942
    Robin W
    Moderator

    This code (untested) should subscribe all current users to forum ID 3

    $list = get_users();
    if (empty (get_option ('rew_done')) {
    	foreach ($list as $user) {
    		$user_id = $user=>ID ;
    		$forum_id = 3 ;
    		bbp_add_user_forum_subscription( $user_id, $forum_id ) ;
    	}
    	update_option ('rew_done' , 'done' ) ;
    }

    Put this in your child theme’s function file – or use
    https://en-gb.wordpress.org/plugins/code-snippets/ and load a page, then remove it

    #204929
    Robin W
    Moderator

    bbp style pack

    lets you add an ‘edit profile’ to the menu see

    dashboard>settings>bbp style pack>login

    and also has a shortcode that you can put into a text widget in the sidebar

    [bsp-profile’ label=’Edit Profile’ edit=’y’]

    see

    dashboard>settings>bbp style pack>shortcodes

    #204928
    Chuckie
    Participant

    There are lots of discussions about this.

    Pretty much all plugins are three versions of wp out of date. I don’t know which are stable to use. Since they are exposing source code I wonder if they can be updated?

    Or is there a known up to date way to do this?

    #204887
    jbrandsma
    Participant

    Welp.. I figured it out. Here is the code that I placed in my theme’s function.php file so that all avatars are rendered correctly:

    function jb_get_bp_user_avatar($avatar, $id_or_email, $size, $default, $alt)
    {
        if (is_numeric($id_or_email)) {
            $id = (int) $id_or_email;
            $user = get_user_by('id', $id);
        } elseif (is_object($id_or_email)) {
            if (!empty($id_or_email->user_id)) {
                $id = (int) $id_or_email->user_id;
                $user = get_user_by('id', $id);
            }
        } else {
            $user = get_user_by('email', $id_or_email);
        }
        if ($user && is_object($user)) {
            $avatar = bp_core_fetch_avatar(array('item_id' => $user->ID));
        }
        return $avatar;
    }
    add_filter('get_avatar', 'jb_get_bp_user_avatar', 10000, 5);
    #204875

    In reply to: Locked topics

    Chuckie
    Participant

    Yeah, but in forums like phpBB, if you close a topic you are locking the topic. This is indicated to the user by a icon. I added some styling which I had gleaned from the internet:

    #bbpress-forums .status-closed > li.bbp-topic-title > a.bbp-topic-permalink:before {
    	content: "[Locked]";
    	text-shadow: 1px 1px 0 #ffffff;
    	color: #ff0000;
    	margin-right: 5px;
    	font-size: 16pt !important;
    }

    This gives me a lock symbol but the look and feel of this symbol is not as nice as the paper clip which is visible for topics with attachments (using the GD Attachments plugin).

    #204872
    Robin W
    Moderator

    then yes the code I sent is fine and works and is enough !!

    #204870
    Robin W
    Moderator

    not quite sure what you are trying to achieve – where are you putting this code ?

    #204867
    stoffer_dev
    Participant

    I found a way to put it in a plugin 🙂

    I Thought I would have to hook into ‘plugins_loaded’ like so:

     add_action( 'plugins_loaded', 'bbpress_overwrite' );
    
     function bbpress_overwrite() {
         add_filter ('bbp_before_has_search_results_parse_args', 'rew_amend_search') ;
     }
    
    function rew_amend_search ($args) {
    	$args['post_type'] =  bbp_get_topic_post_type() ;
    return $args ;
    }

    But for some reason this was enough: ?

    add_filter ('bbp_before_has_search_results_parse_args', 'rew_amend_search') ;
    
    function rew_amend_search ($args) {
    	$args['post_type'] =  bbp_get_topic_post_type() ;
    return $args ;
    }
    #204864
    Robin W
    Moderator

    ok, a better filter might be – try adding this to your functions file

    add_filter ('bbp_before_has_search_results_parse_args', 'rew_amend_search') ;
    
    function rew_amend_search ($args) {
    	$args['post_type'] =  bbp_get_topic_post_type() ;
    return $args ;
    }
    #204854
    stoffer_dev
    Participant

    I put this:

    add_filter ('bbp_before_get_search_terms_parse_args', 'pluus_amend_search') ;
    
    function pluus_amend_search ($args) {
    	$args['post_type'] =  bbp_get_topic_post_type() ;
    return $args ;
    }

    in my wp-content/themes/<ThemeName>/functions.php

    But Forum names (“bbp_get_forum_post_type()”) are still included in the search results on the frontend.

    Only editing “plugins/bbpress/includes/search/template.php” works 🙂

    Robin W
    Moderator

    to get rid of that bit, put this in your custom css part fo your theme

    div.bbp-template-notice.info {
    	border : none !important ;
    	display: none;
    }

    you might also want

    .bbp-pagination {
    	display: none;
    }
    #204834
    Robin W
    Moderator

    It is not being maintained, but I presume it still works?

    Wordpress removes plugins that are not maintained, but most continue to work and are based on stable code.

    or is this one now not working ?

    #204819
    nothere
    Participant

    Is it possible to download or install the same or similar code as this bbpress support form layout has? I like the layout, and would like to incorporate it on my site. Not sure if this is a possibility? Thanks.

    #204811
    brunov99
    Participant

    For the record.
    I found it but no idea at all where it came from.
    It was a style="display:none;" CSS inline declaration inside the generated code.
    Generated by what ? Don’t know.
    Anyway, I had to force the display with a display:inline-block; and !important tag to bypass it.

    **Resolved**

    #204807
    Chuckie
    Participant

    Sorted it. I added this second style:

    #bbpress-forums li.bbp-header div {
    	background: #7A7A78 !important;
    	border:  none;
    }
    #204806
    Chuckie
    Participant

    I have this styling:

    #bbpress-forums div.bbp-reply-content {
    	border-left: solid 1px black;
    	background: whitesmoke !important;
    	padding-left: 5px;
    }
    
    #bbpress-forums div.bbp-reply-author {
    	background: whitesmoke !important;
    }
    
    #bbpress-forums div.bbp-reply-content li {
    	color: #000 !important;
    }
    
    #bbpress-forums div.bbp-reply-content a {
    	color: blue !important;
    }
    
    #bbpress-forums div.bbp-reply-content a:hover {
    	text-decoration: underline;
    }
    

    The problem is that it applies it to the very first row with the headings and I don’t want it to. Ideally I want to set the background of just the replies themselves to whitesmoke.

    #204789
    jbrandsma
    Participant

    I am using bbpress in conjunction with buddypress and I noticed that the forums have different avatars for users than their profile avatar. Is there a way to use the avatars from buddypress and not from bbpress?

    I found this topic and its exactly what I’m referring too, but it was never marked as resolved and the answer was only for replies. The code snippet in this post works for me, but I need it to go further and apply to all avatars. I tried adding a filter to ‘bbp_get_current_user_avatar’ but I can’t get it to work.

    Wordpress, buddypress, and bbpress are all up-to-date – I also have the Youzer plugin installed

    Thanks in advance!

    #204788

    In reply to: Fetch different avatar

    jbrandsma
    Participant

    I hope you’re still around but I’m trying to accomplish the same goal. Your code snippet works for the replies, as you said, but I’m still trying to use the bp avatars for ALL avatars – like you. I am just curious how you handled that! Thanks!

    #204787
    Robin W
    Moderator

    hmmm… quite a puzzle

    so you could try putting your customised file here

    wp-content/languages/plugins/bbpress-fr_FR.mo

    plugins load code from only two places, but no idea which loads first, but looks like that location loads last, so it might work. but again might be overwritten by WordPress updates

Viewing 25 results - 3,476 through 3,500 (of 32,481 total)
Skip to toolbar