Skip to content

Fatal errors on the BuddyBoss activity page  #109

Description

@marklchaves

Restriction settings

  • Logged In Users
  • Redirect > Login & Back
  • Handling matches both set to Filter.
  • Content Is A Post with Tag

Demo

https://share.zight.com/eDuKpN0Q

Error log

ccv2-buddyboss-error-log.txt

Suggested fixes (tested on a local site)

PostContent.php line 166 (note: line 114 is not an issue)

		// FIX for the 500 error on the BuddyBoss activity feed.
		$message = \ContentControl\get_default_denial_message();
		if ( is_bool( $restriction ) ) {
			// Do nothing?
		} else {
			$message = $restriction->get_message();
		}

		/**
		 * Filter the excerpt to display when a post is restricted.
		 *
		 * @param string $message     Message to display.
		 * @param object $restriction Restriction object.
		 *
		 * @return string
		 */
		return apply_filters(
			$filter_name,
			$message, //$restriction->get_message(), this throws a fatal error for BuddyBoss.
			$restriction
		);

content.php line 56

		// FIX for the 500 error on the BuddyBoss activity feed.
		if ( is_bool( $restriction ) ) {
			// Do nothing?
		} else {

		    if ( $restriction->show_excerpts() ) {
                        ...

Activity

  1. marklchaves commented on Jul 18, 2024

    @marklchaves
    ContributorAuthor

    Revised suggested fix (workaround) for the 500 error, denial message, and excerpts in the BuddyBoss activity feed

    • For the BuddyBoss activity feed, make sure to set the global default denial in the Content Control General Settings.
    • Note: For the BuddyBoss activity feed, you can only show the global default denial (i.e. not the denial message override in the restriction). The workaround "disables" the custom message override in the restriction for lists b/c that's what's causing the 500 error. The restriction custom denial message override still works fine on post archive pages.

    Example source code

    1. /classes/Controllers/Frontend/Restrictions/PostContent.php
    2. /inc/functions/content.php

    Zip: custom-code-for-buddyboss.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions