Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1406706

    Hello there,

    we are using a download-plugin for tracking PDF downloads. In order to have a custom construct around the download field, we’ve added a shortcode which also echoes the download-shortcode coming from the plugin. This works like we’ve expected.
    The problem occurs while using a customized column-shortcode from Enfold ALB.

    We have added a restriction within the columns (column.php), which allows the user to access specific parts of the page if you are the given “level”.
    Within the shortcode handler function, I’ve added this:

          if($atts['group_visibility']) {
    
                    if(is_user_logged_in()) {
    
                        $term = get_term( $atts['group_visibility'], 'packages' )->term_id;
                        $userid = get_current_user_id();
                        $userterms = wp_get_post_terms( $userid , 'packages', array( 'fields' => 'ids' ) );
                        
                        if(!in_array($term,$userterms)) {
                            $restricted = true;
    						$restrictedClass = 'restricted-div';
                            $outputaddition = $this->displayRestrictionMessage('Not available for your package.',$deviceID,'package-restriction');
                        }
                    } else {
                        $restricted = true;
    					$restrictedClass = 'restricted-div';
    					$outputaddition = $this->displayRestrictionMessage('You need to be logged in to see this information.',$deviceID,'logged-restriction');
                    }
    
                } 

    This also works fine, later on we have this:

               if(!$restricted) {
                    //if the user uses the column shortcode without the layout builder make sure that paragraphs are applied to the text
                    $content = ( empty( $avia_config['conditionals']['is_builder_template'] ) ) ? ShortcodeHelper::avia_apply_autop( ShortcodeHelper::avia_remove_autop( $content ) ) : ShortcodeHelper::avia_remove_autop( $content, true );
                    $output .=		trim( $content );
                } else {
    		$output .= $outputaddition;
    	}
                

    but this breaks the shortcode in the
    The shortcode in the “page content” ALB template displays the calendar, but when restricted (hence echoing “outputaddition” instead of the content), the shortcode in the “page content” ALB template somehow displays a download-shortcode – which doesn’t make any sense.

    Do you have an Idea on how these changes can affect a shortcode on the page?

    If you need any credentials, please let me know.

    Regards

    • This topic was modified 1 year, 7 months ago by emilconsor.
    • This topic was modified 1 year, 7 months ago by emilconsor.
    #1406831

    Hey emilconsor,

    Thank you for the inquiry.

    To ensure that the HTML is valid and all containers are closed properly, it’s recommended to check the rendered output of the $outputaddition. And instead of editing the column.php file directly, you should try to create a custom shortcode that renders the PDF download button directly based on the specified conditions above. This way, you can use the custom shortcode directly in the Column element without affecting the column’s structure or output.

    Best regards,
    Ismael

    #1406860

    Hi Ismael,

    thanks for your hints.
    I can assure you the HTML code is correct and everything is closed properly in my customized code.

    I already have the shortcode to render the download based on specific conditions, but I need that for the column too, since some content will be restricted, and it is the best (and also the best user experience) to just restrict the entire column instead of restricting every single element one might add.

    The function “displayRestrictionMessage”, in this case for the columns, returns just an empty div.

    #1408218

    Hi,

    Unfortunately, achieving the customization you described would require a significant amount of time and modifications to the theme. Regrettably, this level of customization is not covered by our support. However, if it is crucial for you to have this functionality implemented, you have the option to hire a freelancer who can assist you with the customization. You can find freelancers who specialize in theme customization by visiting our customization page.

    If you have any other questions or require further assistance, please feel free to let us know.

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.