• I am trying to create a ratings setup that will allow users to rate content they purchased access to and read, and then have the result of that rating be displayed on the sales page for the content. None of the content is protected as yet, so there is no interference from a ‘protected content’ software.

    First, I created a post template for my sales page, which would be used as a sales page to show the results of the ratings the purchased content. Since I was not able to find PHP code to call the ratings result, I set up a do_shortcode section in this template so I could dynamically display the result on a page. The post_id where the ratings shortcode is installed is stored in a custom field, allowing the sales page template to be reused.

    First I used a shortcode to install a ratings form in a post with post_id of 76. The ratings system worked correctly.

    Then, I set a do_shortcode in my template, as follows, and it displayed correctly.
    <?php echo do_shortcode('[mr_rating_result post_id=76" no_rating_results_text="No rating result yet" show_rich_snippets="false"]' ) ?>

    Next, in order to test the dynamics of the system, I attempted to call the result by inserting a variable into the do_shortcode code from above, as follows:

    <?php $TTratings=get_post_meta($post_id, "course_completion_page", $single); ?>
    <?php echo do_shortcode('[mr_rating_result post_id=\"$TTratings\" no_rating_results_text="No rating result yet" show_rich_snippets="false"]' ) ?>;

    This failed, and gave me the “No rating results yet” message. It has been stuck in that mode ever since.

    I can clear the cache and rate post 76 repeatedly, but I cannot retrieve any results of the rating into the template.

    Can you tell me where I have gone off track?

    Thanks,
    Kirk

    • This topic was modified 7 years, 11 months ago by kirkward.
Viewing 1 replies (of 1 total)
  • Plugin Author dpowney

    (@dpowney)

    Hi,

    Can you confirm the following code snippet echoes 76?

    <?php $TTratings=get_post_meta($post_id, "course_completion_page", $single); ?>
    <?php echo $TTratings; ?>

    If it does, then also try this

    <?php echo do_shortcode('[mr_rating_result post_id="' . $TTratings . '" no_rating_results_text="No rating result yet" show_rich_snippets="false"]' ) ?>;

    Hope this helps,
    Daniel

Viewing 1 replies (of 1 total)
  • The topic ‘Works, Then Doesn’t Work’ is closed to new replies.