Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,726 through 1,750 (of 32,522 total)
  • Author
    Search Results
  • #220470
    vincenzon617
    Participant

    I have managed to find the solution! For anyone else who may have this problem, change this part of the code above:

    .innerHTML = "clicked";
    to
    .value += "clicked";

    vincenzon617
    Participant

    Is there a way to append text to the reply form using JavaScript?
    I have this function

    window.onload=function() {
    	document.getElementById("toggle-check").addEventListener("click", funct1);
    	
    	function funct1() {
      		
    		if(this.checked) {
    			
    			document.getElementById('bbp_reply_content').innerHTML = "clicked";
    		} else {
    			
    			document.getElementById('bbp_reply_content').innerHTML = "notclicked";
    		};
      		
    	};
    };

    which is used when the user clicks a checkbox that I have made. I would like the text to be appended to the reply form at the end of their message, depending on whether or not they have clicked the checkbox. Currently, the .innerHTML is not working when there is text already in the reply form but it works when the reply form is empty.

    Has anyone got any ideas on how to do this? Maybe there is a text variable that stores the user’s message that I can append to – if so what is the name?

    Many thanks

    #220451
    webmasterfreya
    Participant

    Hi Back to Front,

    I also have buddypress installed. As admin you have for each member a page wich among other things shows topics started and replies made by the member. The replies did not show up (and there were definitly replies).

    As buddypress makes use of bbpress for fora i expected your code to work but it did not (is the culprit then buddypress or bbpress or your code? I haven’t the faintest idea).

    Maybe : if( $bbPress_post_type ==’topic’ ){

    /** TOPIC **/
    $query[‘order’]=’DESC’;
    return $query;

    should have an } else {return $query}

    sino27
    Participant

    Hi there. Sorry for reviving this thread. But I had to as this is some serious privacy issue.

    A code from “bjornwebdesign” is definitely working but not completely. I mean on this code posted in his “Ok, last time, I promise :pโ€ฆ”

    /*
     * Do stuff when the user's xprofile is updated
    */	
    function xprofile_updated ( $user_id, $posted_field_ids, $errors, $old_values, $new_values) {
    	/*
    	 * Change the user_nicename which is used as profile url, we do NOT want the username in url! Bad bad BP...
    	 * Please note: the user profile url can now be changed by the user, direct linking from other places on the web may result in 404.
    	 * Altough this should run AFTER updating profile fields (saving to DB), the nicename is only updated after a second save. So we need to check from $new_values
    	 */
    	$new_display_name = '';
    	foreach ( $new_values as $key => $value ) {
    		if ( is_array($value) && $key == 1 ) { // field display_name = 1, make sure this is correct
    			foreach ( $value as $k => $v ) {
    				if ( $k == 'value' ) {
    					$new_display_name = $v;
    				}
    			}
    		}
    	}
    	//error_log('******** xprofile_updated: '.$user_id.' | NEW DISPLAY_NAME: '.$new_display_name.' *********');
    	$search = array( ' ', '.' ); 
    	$replace = array( '_', '' );
    	$user = get_user_by( 'ID', $user_id );		
    	if ( $user ) {
    		if ( $user->data->user_status == 0 && $new_display_name ) {
    			$new_user_nicename = strtolower(str_replace( $search, $replace, $new_display_name) );
    			if ( strlen ( $new_user_nicename ) > 50 ) {
    				$new_user_nicename = substr ( $new_user_nicename, 0, 50 );
    			}				
    			if ( $user->data->user_nicename != $new_user_nicename ) { // && $user->ID == 80 <-Add this if you only want to run it for 1 user, so you can test it.
    				$args = array(
    					'ID'            => $user->ID,
    					'user_nicename' => $new_user_nicename
    				);
    				wp_update_user( $args );
    				//error_log('******** updated user_nicename: '.$user->ID.' | NEW USER_NICENAME: '.$new_user_nicename.' *********');
    				wp_redirect( get_site_url().'/leden/'.$new_user_nicename.'/profile/edit/group/1/' ); // we cant use bp_core_get_user_domain() here, because it still uses the old user_nicename
    				exit;					
    			}
    		}
    	}
    }
    add_action( 'xprofile_updated_profile',  'xprofile_updated', 100, 5 );

    – but there is one critical flaw. After code is applied, user can not update their profile anymore. Like you can go to (example) update name or nickname. You press save and nothing changes. Profile is not updated.

    If I apply “bjornwebdesign” previous code (meaning code he posted just before his latest code) –

    
    /*
     * Change the user_nicename which is used as profile url, we do NOT want the username in url! Bad bad BP...
     * This runs allways (with init hook), we should only do this once and then on user register & profile update..
     * Please note: the user profile url can now be changed by the user, direct linking from other places on the web may result in 404.
     * And offcourse allways use something like: 'bp_core_get_user_domain( $user_id )' when you want to get the user's profile url.
     */
    $search = array( ' ', '.' ); 
    $replace = array( '_', '' );
    $all_users = get_users();		
    foreach ( $all_users as $user ) {
    	$display_name = $user->data->display_name;
    	if ( $user->data->user_status == 0 && $display_name ) {
    		$new_user_nicename = strtolower(str_replace( $search, $replace, $display_name) );
    		if ( strlen ( $new_user_nicename ) > 50 ) {
    			$new_user_nicename = substr ( $new_user_nicename, 0, 50 );
    		}				
    		if ( $user->data->user_nicename != $new_user_nicename ) { // && $user->ID == 80 <-Add this if you only want to run it for 1 user, so you can test it.
    			$args = array(
    				'ID'            => $user->ID,
    				'user_nicename' => $new_user_nicename
    			);
    			wp_update_user( $args );					
    		}
    	}
    }
    

    then updating of profile is working. User can update profile but after pressing “Save” there is 404 error. Even 404 is acceptable as at least user can update their profile. However performance is severely degraded on a website with many members.

    So basically only his latest code is working in a way that their profile URL is hidden, performance is not degraded but user profiles can not be saved or updated. Can anyone help and update his code so that user are able to update their profiles?

    #220433
    deborah86
    Participant

    Will the shortcodes be converted into blocks to work fully with the block editor? Is bbPress preparing for full-site editing that is coming this year?

    deborah86
    Participant

    I am currently using the Twenty Twenty theme. The theme is causing jumbled text on the forum page.

    Forum Page

    I have tried both bbPress and BuddyBoss. I have the same issue. I contacted BuddyBoss, they stated there is an issue with the Twenty Twenty theme. I contacted the admins at the Twenty Twenty theme. They told me to go to bbPress for support. I cannot locate the issue in the code.

    See Twenty Twenty theme ticket

    I also completed the additional troubleshooting steps:

    • Deactive plugins – this did not solve the issue
    • Themes – switching the themes fixes the issue. I contacted the Twenty Twenty theme authors. They told me to contact you.
    • Selecting the default permalinks – I am already using the default permalinks
    • Repair Forums – this did not solve the issue
    • Using WP Debug – no debug issues appeared
    • Diagnose Javascript errors – there are no javascript errors appearing

    I have basically tried everything besides resetting my WordPress website. Nothing seems to work.

    #220395
    Robin W
    Moderator

    ah yes, it should have been

    bbp_get_reply_type()

    to make it a function, but ‘reply’ is equally as good

    #220394
    vincenzon617
    Participant

    Thanks, Robin works great, although the bbp_get_reply_type and bbp_get_topic_type caused an error so I replaced it with bbp_get_all_child_ids($topicID, 'reply'); and it seems to have done the trick!

    #220387
    Robin W
    Moderator

    or

    $ids = bbp_get_all_child_ids($topicID , bbp_get_reply_type) ;

    #220386
    Robin W
    Moderator

    a quick look at that function would seem to be

    $ids = bbp_get_all_child_ids($topicID , bbp_get_topic_type) ;

    Robin W
    Moderator

    untested, but try

    add_filter( 'bbp_get_view_query_args', 'rew_limit') ;
    
    function rew_limit ($args) {
    $args['posts_per_page'] = -1 ;
    $args['posts_per_page'= 10 ;
    return $args ;
    }

    not sure which 10 it will show!!

    vincenzon617
    Participant

    Is there a way to limit the number of topics shown when using the shortcode [bbp-single-view id=โ€™popularโ€™]?

    I would only like to show the top 10 most popular topics.

    Thanks

    #220360
    webmasterfreya
    Participant

    Hi,

    Your piece of code has an unwanted side effect. When looking at a subscriber as admin the created replies of this subscriber do not show anymore.
    I reverted back to the original code (on top of this topic) and presto the replies of the subscriber show up again.

    #220346
    maxx203
    Participant

    Hello

    to clean up my pending and spam threads and answers, iam using two show SQL queries. Is there maybe any plugin or cron which can execute them?

    DELETE FROM wp_posts WHERE post_status = "pending";
    DELETE FROM wp_posts WHERE post_status = "spam";

    Regards
    Maxx

    #220343
    Robin W
    Moderator

    @traverser11 – great that you are posting the answers here – so many don’t ๐Ÿ™‚ ๐Ÿ™‚ ๐Ÿ™‚

    can you summarise where you are at, so eg

    use this plugin (are you still using the sort topic replies plugin?)
    delete this code from it
    add this code to this place

    etc.

    so it is all in one thread, I’ll then try to give to some switch on and off code

    #220341
    Back to Front
    Participant

    Oh here is an answer!

    Wrong bbp_get_reply_url() when paging with reverse order

    This snippet works – i’m just a bit confused how to turn it on when replies are descending and off when they are ascending…

    add_filter('bbp_get_reply_position', 'lugpa_get_reply_position', 10, 3);
    function lugpa_get_reply_position($reply_position, $reply_id, $topic_id){
        
        if(empty($topic_id))
            $topic_id = bbp_get_reply_topic_id ($reply_id);
        
        $numReplies = bbp_get_topic_reply_count($topic_id);
        return ($numReplies+1) - $reply_position; // plus one because of thread description
    }
    #220323
    Robin W
    Moderator
    #220320
    Back to Front
    Participant

    I gave it a go, and it kinda worked, lol…
    But this reverses all the replies INCLUDING the original topic.
    So the original topic goes to the bottom…
    What I would ideally want is the Topic, THEN the replies in reverse order…

    // Reverse reply order on News topic
    
    add_filter('bbp_has_replies_query','bbp_reverse_reply_order');
    function bbp_reverse_reply_order( $query = array() ) {
    	// Identify post type
    	$bbPress_post_id = get_the_ID();
    	$bbPress_post_type = get_post_type($bbPress_post_id);
    
    	if( $bbPress_post_type =='topic' ){
    
    		/** TOPIC **/
    			$query['order']='DESC';
    			return $query;
    
      }
    };
    #220319
    Back to Front
    Participant

    Checking in because I want this too… there was a plugin called ‘bbpress sort topic replies’, that no longer works, but I’m going to try to grab the code from that

    #220313
    Back to Front
    Participant

    Thanks again for taking a look is the code that appends the checkboxes to the bbpress topic forms… I guess $_POST is a global variable that bbpress topic form is also using?

    Sorry this is obviously a bit beyond me. And obviously beyond a free solution! But yes if you or others in bbpress do paid work like thiset me know and I’ll be in touch!

    // Add custom taxonomies to topic form
    
    add_action ( 'bbp_theme_after_topic_form_content', 'bbp_extra_fields');
    
    function bbp_extra_fields() {
    
    $value = get_post_meta( bbp_get_topic_id(), 'issue', true);
    	echo '<div id="custom-meta">';
    	echo'<fieldset>
            <legend>Issues</legend>';
    	$issues = get_terms('issue', array('hide_empty' => 0));
    	foreach ($issues as $issue) {
    	echo '<span><input type="checkbox" class="issue" for="issue" value="'.$issue->slug.'"></input><label>'.$issue->name.'</label></span>';
    	};
    	echo '</fieldset>';
    
    $value = get_post_meta( bbp_get_topic_id(), 'region', true);
    global $region;
    $region = get_terms('region', array('hide_empty' => 0));
    echo'<fieldset>
            <legend>Region</legend>';
    $regions = get_terms('region', array('hide_empty' => 0));
    foreach ($regions as $region) {
    echo '<span><input type="checkbox" class="issue" for="issue"value="'.$region->slug.'"><label>'.$region->name.'</label></span>';
    };
    echo '</fieldset></div>';
    };
    #220310
    Robin W
    Moderator

    ok, beyond free help, but my code takes an array from $_POST – which presumably is what your form is creating?

    maybe post your form code? and I’ll take one last look

    Nestin Vas
    Participant

    Thank you for the plugin.

    It worked well. There is a provision to allow only the moderator to reply. However, there doesn’t seem to be a provision to allow the topic creator to reply to his own topic.

    If I set it to ‘create/edit/view OWN topics’, the user is unable to view other topics.

    Is there a fix to this?

    I found this topic – https://bbpress.org/forums/topic/how-to-make-only-post-author-and-moderators-can-reply/

    It seems to address the problem, but the file is unavailable. And I’m not sure how to use the code in the last reply.

    #220302
    nosashandy
    Participant

    Hello,

    I’ve question, I already read around the bbPress roles and capabilities

    But, I still not sure do the user with Participant roles, can set the Topic Status to Closed when Create New Topic in the forum.

    Thanks.

    samibz
    Participant

    I installed bbpress and it is activated – when I go into users there is a forum users option for every other wordpress user other than me the administrator.I did not get a welcome page. I have no option to edit my role under my users – I can do this for all the other users on my site.

    I use X-theme which is supposed to support this plugin. I have a feeling this has to do with the fact that I am not listed at the keymaster, but there seems to be no way to do this.

    I am not good at coding or knowing where to put code, so if it involves any please be very specific – where it needs to go, what to type in etc…

    Thanking everyone in advance

    #220284
    ViNOJ
    Participant

    I have just found that it works perfectly if I disable Ultimate Member Plugin.
    I don’t even require above code and all the user profile pics seems to be working properly.

Viewing 25 results - 1,726 through 1,750 (of 32,522 total)
Skip to toolbar