Forum Replies Created

Viewing 15 replies - 1 through 15 (of 27 total)
  • Thread Starter pyoil

    (@pyoil)

    Any help on this is appreciated

    Thread Starter pyoil

    (@pyoil)

    There are other short codes that I have in my title other than the [year] shortcode. How can I add a filter to ensure that shortcodes work in the sitemap.

    Can I do something like the below:

    
    add_filter('rank_math/sitemap/html_sitemap/title', function ($title) {
        return do_shortcode( $title );}
    );
    Thread Starter pyoil

    (@pyoil)

    What is the actual fix? Remove the free plugin? Or change the function name?

    I removed the plugin as instructed first. Should I now go install it again and rename the function?

    Thread Starter pyoil

    (@pyoil)

    Thanks

    This option does not appear when Disable Marker Toggle is Enabled: https://www.screencast.com/t/hPKyLMd82JP

    There is no list section in the Style tab. I see only the following in the Style Tab: https://www.screencast.com/t/jjVqvzYn217

    Thread Starter pyoil

    (@pyoil)

    I am on PHP 8.0

    Thread Starter pyoil

    (@pyoil)

    Thanks. Please update this thread if you have an updated or refined solution.

    Thread Starter pyoil

    (@pyoil)

    Both are important. I want the post hierarchy to be maintained and the slug to be removed.

    I found this solution that is actually working but it seems overly complex and I am not sure if it is breaking more things than fixing.

    I had to remove your code and replace it with the one on this page: https://wordpress.stackexchange.com/questions/114723/removing-base-slug-from-hierarchical-custom-post-type

    Thread Starter pyoil

    (@pyoil)

    The post type slug is hub

    I used the code in your blog to remove the word hub from the URL and it works when the CPT has no parent.

    But when the CPT has a parent it gives 404.

    So domain.com/hosting works but domain.com/hosting/wp-engine-review gives 404 error. This second link is the child of the first link.

    Thread Starter pyoil

    (@pyoil)

    I have restored my database with my backups.

    Thread Starter pyoil

    (@pyoil)

    Hey Thomas.

    The tag fired for login.

    But the sign up event doesn’t fire for me because the link to set the password is sent to the email and the user remains the in the wp-login.php page.

    Any workaround for the tag to fire in the wp-login.php page?

    Thread Starter pyoil

    (@pyoil)

    Brilliant!!

    You have made the world a better place with this plugin.

    • This reply was modified 4 years, 5 months ago by pyoil.
    • This reply was modified 4 years, 5 months ago by pyoil.
    Thread Starter pyoil

    (@pyoil)

    I don’t see the blocks for locker
    Screenshot: https://imgur.com/0xTgph4

    Update: I see the latest version premium version of the plugin 5.5.5. But I didn’t receive an update option in WordPress. Still using 5.3.0. What could be the reason?
    Screenshot 1: https://imgur.com/o57CbZm
    Screenshot 2: https://imgur.com/5uztchO

    Am I missing something?

    • This reply was modified 4 years, 6 months ago by pyoil.
    • This reply was modified 4 years, 6 months ago by pyoil.
    • This reply was modified 4 years, 6 months ago by pyoil.
    • This reply was modified 4 years, 6 months ago by pyoil.
    Thread Starter pyoil

    (@pyoil)

    Thanks. I think I can make this work.

    I see how the user can click a button and give themselves the achievement. However, when I create the achievement, I don’t see a way I can make the user automatically revoke the achievement.

    I want the user to be able to give or revoke achievements themselves.

    How do I achieve the revoke achievement functionality in Gamipress? If this feature does not exist, I am open to using a custom PHP that will do this.

    Also to display the right toggle button to give and revoke achievement, I am creating a shortcode that displays text inside a shortcode depending on whether the user has or does not have the achievement. So I have two shortcodes one to show the button to revoke the achievement and one to hide the button to get the achievement I will pass the post id of the achievement in the shortcode.

    Revoke button will show when the user has the achievement.
    [gamipress_show has_achievement = "custompostid4231"]Show Button To Revoke Achievement [/gamipress_show]

    Get button will be hidden when the user has the achievement.
    [gamipress_hide has_achievement = "custompostid4231"]Show Button To Get Achievement [/gamipress_hide]

    This is the PHP I have so far to create this shortcode. I need help replacing i_need_help_with_gamipress_function below with the appropriate function that will check if the user has achievement for the custompostid I pass in the shortcode:

    
    add_shortcode( 'gamipress_show', 'gamipress_show_shortcode' );
    function gamipress_show_shortcode($atts = [], $content = null, $tag = '')
    {
        // normalize attribute keys, lowercase
        $atts = array_change_key_case((array) $atts, CASE_LOWER);
    
        // start output
        $o = '';
    
        // start box
        $o .= '<div class="wcr-box">';
    
        $current_user = wp_get_current_user();
    
        if ( i_need_help_with_gamipress_function ) {
            // enclosing tags
            if (!is_null($content)) {
                // secure output by executing the_content filter hook on $content
                $o .= apply_filters('the_content', $content);
            }
    
        } else {
            // User does not have achivement
        }
        // end box
        $o .= '</div>';
    
        // return output
        return $o;
    }
    

    Thank you in advance for all the help

    • This reply was modified 5 years, 1 month ago by pyoil.
    • This reply was modified 5 years, 1 month ago by pyoil.
    Thread Starter pyoil

    (@pyoil)

    Thanks Robin. That fixed it.

    Thread Starter pyoil

    (@pyoil)

    No I am not using the bbp style pack plugin.

    This extra subforum is coming directly from the Private Groups plugin, because when I disable it, it goes away like this https://www.screencast.com/t/XgMEr09vx28j

    When I enable the plugin I get https://www.screencast.com/t/8BRQpTyVc

    I am using the following bbpress plugins on my website

    bbPress Notify (No-Spam)
    bbPress Messages
    bbPress
    bbP private groups

    Apart from these plugins I have custom PHP inserted into my website’s function.php and the snippet is below:

    //Removes the sub-forum topic and reply count
    function remove_counts() {
    $args['show_topic_count'] = false;
    $args['show_reply_count'] = false;
    $args['count_sep'] = '';
    return $args;
    }
    add_filter('bbp_before_list_forums_parse_args', 'remove_counts' );
    
    //Removes Breadcrumbs
    //add_filter( 'bbp_no_breadcrumb', '__return_true' );
    
    //Change Breadcrumbs Text
    function change_bread_crumbs_text( $args = array() ) {
    $args['root_text'] = 'Community';
    return $args;
    }
    add_filter( 'bbp_after_get_breadcrumb_parse_args', 'change_bread_crumbs_text' );
    
    //Add descriptions to subforums
    function custom_list_forums( $args = '' ) {
    
    	// Define used variables
    	$output = $sub_forums = $topic_count = $reply_count = $counts = '';
    	$i = 0;
    	$count = array();
    
    	// Parse arguments against default values
    	$r = bbp_parse_args( $args, array(
    		'before'            => '<ul class="bbp-forums-list">',
    		'after'             => '</ul>',
    		'link_before'       => '<li class="bbp-forum">',
    		'link_after'        => '</li>',
    		'count_before'      => ' (',
    		'count_after'       => ')',
    		'count_sep'         => ', ',
    		'separator'         => ' ',
    		'forum_id'          => '',
    		'show_topic_count'  => true,
    		'show_reply_count'  => true,
    	), 'list_forums' );
    
    	// Loop through forums and create a list
    	$sub_forums = bbp_forum_get_subforums( $r['forum_id'] );
    	if ( !empty( $sub_forums ) ) {
    
    		// Total count (for separator)
    		$total_subs = count( $sub_forums );
    		foreach ( $sub_forums as $sub_forum ) {
    			$i++; // Separator count
    
    			// Get forum details
    			$count     = array();
    			$show_sep  = $total_subs > $i ? $r['separator'] : '';
    			$permalink = bbp_get_forum_permalink( $sub_forum->ID );
    			$title     = bbp_get_forum_title( $sub_forum->ID );
    			$content = bbp_get_forum_content($sub_forum->ID) ;
    
    			// Show topic count
    			if ( !empty( $r['show_topic_count'] ) && !bbp_is_forum_category( $sub_forum->ID ) ) {
    				$count['topic'] = bbp_get_forum_topic_count( $sub_forum->ID );
    			}
    
    			// Show reply count
    			if ( !empty( $r['show_reply_count'] ) && !bbp_is_forum_category( $sub_forum->ID ) ) {
    				$count['reply'] = bbp_get_forum_reply_count( $sub_forum->ID );
    			}
    
    			// Counts to show
    			if ( !empty( $count ) ) {
    				$counts = $r['count_before'] . implode( $r['count_sep'], $count ) . $r['count_after'];
    			}
    
    			// Build this sub forums link
    			$output .= $r['before'].$r['link_before'] . '<a href="' . esc_url( $permalink ) . '" class="bbp-forum-link">' . $title . $counts . '</a>' . $show_sep . $r['link_after'].'<div class="bbp-forum-content">'.$content.'</div>'.$r['after'];
    		}
    
    		// Output the list
    		return $output ;
    	}
    }
    
    add_filter('bbp_list_forums', 'custom_list_forums' );
    
    // Change Forums in Index page table header to Communities
    function change_translate_text( $translated_text ) {
    if ( $translated_text == 'Forum' ) {
    $translated_text = 'Communities ';
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );
    
    // Enable visual page editor
    // Simple
    function bbp_enable_visual_editor( $args = array() ) {
    $args['tinymce'] = true;
    $args['teeny'] = false; // Uses TinyMCE Advanced Settings
    // $args['quicktags'] = false;
    return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
    
    // Add Forum Description Below Title In Single Forum Page
    function rw_singleforum_description() {
      echo '<div class="bbp-forum-content">';
      echo bbp_forum_content();
      echo '</div>';
    }
    add_action( 'bbp_template_before_single_forum' , 'rw_singleforum_description');
    
    // Add Contact Methods
    function add_extra_contactmethod( $contactmethods ) {
    // Add new ones
    $contactmethods['twitter'] = 'Twitter';
    $contactmethods['facebook'] = 'Facebook';
    $contactmethods['googleplus'] = 'Google Plus';
    $contactmethods['youtube'] = 'Youtube';
      
    // remove unwanted
    unset($contactmethods['aim']);
    unset($contactmethods['jabber']);
    unset($contactmethods['yim']);
      
    return $contactmethods;
    }
    add_filter('user_contactmethods', 'add_extra_contactmethod');
    
    // Add Link To Gravatar in bbPress Profile Page
    function casiepa_mention_gravatar() {
      if ( is_user_logged_in() ){
                $current_user = wp_get_current_user();
      }
    ?>
    
    <div>
    	<label for="bbp-gravatar-notice">Profile Picture</label>
    	<fieldset style="width: 60%;">
    	  	<?php echo get_avatar( $current_user->user_email, 96 );?>
    		<span style="margin-left: 0; width: 100%; font-style: normal; font-size: 14px;" name="bbp-gravatar-notice" class="description"><a href="https://gravatar.com" title="Gravatar">Click here</a> to change your profile picture.</span>
    	</fieldset>
    </div>
    
    <?php
    }
    add_action( 'bbp_user_edit_before_name', 'casiepa_mention_gravatar' );
    
    // Automatically subscribe when a user replies
    function default_reply_subscribed() {
    
    		// Get _POST data  IE is this a first post of a topic?
    		if ( bbp_is_post_request() && isset( $_POST['bbp_topic_subscription'] ) ) {
    			$topic_subscribed = (bool) $_POST['bbp_topic_subscription'];
    
    		// Get edit data  IE either the author or someone else is editing a topic or reply
    		} elseif ( bbp_is_topic_edit() || bbp_is_reply_edit() ) {
    
    			// Get current posts author
    			$post_author = bbp_get_global_post_field( 'post_author', 'raw' );
    
    			// Post author is not the current user EG a moderator is altering this. In this case we'll leave the default to blank, 
    			//as much of the time mods are correcting or moderating, their not interested in the topic itself !
    			if ( bbp_get_current_user_id() !== $post_author ) {
    				$topic_subscribed = bbp_is_user_subscribed_to_topic( $post_author );
    
    			// Post author is the current user  IE you're editing your own post, so default should be to see any replies
    			} else {
    				$topic_subscribed = true ;
    				//the next line is what it used to say instead of true
    				//bbp_is_user_subscribed_to_topic( bbp_get_current_user_id() );
    			}
    
    		// Get current status
    		} elseif ( bbp_is_single_topic() ) {
    			//the user is writing a new reply ?
    			$topic_subscribed = true ;
    			//the next line is what it used to say instead of true
    			//bbp_is_user_subscribed_to_topic( bbp_get_current_user_id() );
    
    		// No data
    		} else {
    			$topic_subscribed = true;
    			//used to say false !
    		}
    
    		// Get checked output
    		$checked = checked( $topic_subscribed, true, false );
    
    		return apply_filters( 'default_reply_subscribed', $checked, $topic_subscribed );
    	}
    	
    add_filter ('bbp_get_form_topic_subscribed', 'default_reply_subscribed');
    
    // Add Search Bar & Create New Topic & Forum Profile Buttons On Top
    add_action( 'generate_before_content', function() {
    	if ( function_exists( 'is_bbpress' ) && is_bbpress() ) {
    	  if ( !function_exists( 'is_buddypress' ) || !is_buddypress() ) {
    		?>
    		<div class="account-info">
    			<ul>
    				<li><?php echo do_shortcode( '[bbp-search-form]' ); ?></li>
    				<?php if ( is_user_logged_in() ) { 
    				  global $wp;
    				  if ( $wp->request != 'community' ) {
    					if(strpos($_SERVER['REQUEST_URI'], '/community/') !== false){
    				  ?>
    					<li><a class="button blue" href="<?php echo home_url( $wp->request ) ?>/#new-post"><i class="fa fa-plus-circle" aria-hidden="true"></i> Create A New Topic</a></li>
    					<?php } else if(strpos($_SERVER['REQUEST_URI'], '/topic/') !== false){
    					?>  
    					  <li><a class="button blue" href="<?php echo home_url( $wp->request ) ?>/#new-post"><i class="fa fa-reply" aria-hidden="true"></i> Add New Reply</a></li>
    				  <?php }
    					}
    				  	if ( function_exists( 'bbp_get_user_profile_url' ) ) { 
    					  ?>
    						<li><a class="button blue" href="<?php echo bbp_get_user_profile_url( get_current_user_id() ); ?>"><i class="fa fa-user" aria-hidden="true"></i> Your Profile</a></li>
    					<?php }
    				} else { ?>
    					<li><a class="button blue" href="/wp-login.php" title="Log in"><i class="fa fa-sign-in" aria-hidden="true"></i>Login To Post</a></li>
    				<?php } ?>
    			</ul>
    		</div>
    		<?php
    	}
    	}
    } );
    
    // Add Topics & Replies & Post Count below Avatar
    //this function hooks to BBpress loop-single-reply.php and adds the counts to the reply display
    function display_counts ($reply_id = 0) 
    		{
    		$user_id=bbp_get_reply_author_id( $reply_id ) ;
    		$topic_count  = bbp_get_user_topic_count_raw( $user_id);
    		$reply_count = bbp_get_user_reply_count_raw( $user_id);
    		$post_count   = (int) $topic_count + $reply_count;			
    		
    		$topic_count = number_format($topic_count);
    		$reply_count = number_format($reply_count);
    		$post_count = number_format($post_count);
    
    		echo '<div class="tc_display">' ;
    		echo '<ul>' ;
    		
    // displays topic count
    		echo '<li>' ;
    				echo $label1 =  'Topics Started: '; // Topics Started
    				echo $topic_count ;
    		echo "</li>" ;
    		
    		
    // displays replies count
    		
    		echo '<li>' ;
    				echo $label2 =  'Replies Written: '; 
    				echo $reply_count ;
    		echo "</li>" ;
    
    		
    		
    // displays total posts count
    		
    		echo '<li>' ;
    				echo $label3 =  'Total Posts: ';
    				echo $post_count ;
    		echo "</li>" ;
    		
    //end of list		
    		echo "</ul>" ;
    		echo "</div>" ;
    
    		}
    add_action ('bbp_theme_after_reply_author_details', 'display_counts') ;
    
Viewing 15 replies - 1 through 15 (of 27 total)