MyBB Community Forums

Full Version: move thread rating
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
is it possible to move {$ratethread} from the showthread template to the postbit template ? as if you remove {$ratethread} from the showthread template and add the code in the showthread_ratethread template to the postbit template the stars show but the js does not update the rating ... idea behind this is the ability to rate the thread from any post and not just the showthread container ... any ideas ?
javascript also needs moving to the postbit. not sure how to do it.

below code segment from showthread_ratethread template should be moved to postbit templates
<strong class="float_left" style="padding-right: 10px;">{$lang->thread_rating}</strong>
		<div class="inline_rating">
			<ul class="star_rating{$not_rated}" id="rating_thread_{$thread['tid']}">
				<li style="width: {$thread['width']}%" class="current_rating" id="current_rating_{$thread['tid']}">{$ratingvotesav}</li>
				<li><a class="one_star" title="{$lang->one_star}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=1&amp;my_post_key={$mybb->post_code}">1</a></li>
				<li><a class="two_stars" title="{$lang->two_stars}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=2&amp;my_post_key={$mybb->post_code}">2</a></li>
				<li><a class="three_stars" title="{$lang->three_stars}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=3&amp;my_post_key={$mybb->post_code}">3</a></li>
				<li><a class="four_stars" title="{$lang->four_stars}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=4&amp;my_post_key={$mybb->post_code}">4</a></li>
				<li><a class="five_stars" title="{$lang->five_stars}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=5&amp;my_post_key={$mybb->post_code}">5</a></li>
			</ul>
		</div>

however, IMO
if it is star rating for the specific post then we need to have it on each & every post.
thread rating is for the first post of the thread and rating is near the first post
(2014-09-19, 02:30 PM).m. Wrote: [ -> ]javascript also needs moving to the postbit. not sure how to do it.

below code segment from showthread_ratethread template should be moved to postbit templates

<strong class="float_left" style="padding-right: 10px;">{$lang->thread_rating}</strong>
		<div class="inline_rating">
			<ul class="star_rating{$not_rated}" id="rating_thread_{$thread['tid']}">
				<li style="width: {$thread['width']}%" class="current_rating" id="current_rating_{$thread['tid']}">{$ratingvotesav}</li>
				<li><a class="one_star" title="{$lang->one_star}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=1&amp;my_post_key={$mybb->post_code}">1</a></li>
				<li><a class="two_stars" title="{$lang->two_stars}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=2&amp;my_post_key={$mybb->post_code}">2</a></li>
				<li><a class="three_stars" title="{$lang->three_stars}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=3&amp;my_post_key={$mybb->post_code}">3</a></li>
				<li><a class="four_stars" title="{$lang->four_stars}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=4&amp;my_post_key={$mybb->post_code}">4</a></li>
				<li><a class="five_stars" title="{$lang->five_stars}" href="./ratethread.php?tid={$thread['tid']}&amp;rating=5&amp;my_post_key={$mybb->post_code}">5</a></li>
			</ul>
		</div>

however, IMO
if it is star rating for the specific post then we need to have it on each & every post.
thread rating is for the first post of the thread and rating is near  the first post

the rating is for the thread rather than the post ... hence the text "rate thread" ... it is a pain when you are near the bottom of the threadlist to have to scroll to the top to rate it .... post rating is another issue btw the above code is exactly what I did ....  it did not work  Sad
^ oh! I had also removed {$ratethread} from showthread template (changed to {$REMOVEDratethread})
(2014-09-19, 05:01 PM).m. Wrote: [ -> ]^ oh! I had also removed {$ratethread} from showthread template (changed to {$REMOVEDratethread})

I also removed {$ratethread} from the showthread template  .... what use does adding {$REMOVEDratethread}  as I would guess mybb would not parse {$REMOVEDratethread} and return this as null (blank) to the template ? However has mybb used REMOVED as a key word within the parse, if this is the case I can understand how this may make a difference .. is this the case ?
^ No, I used $REMOVED just to make it a null .. but the modification clearly working for me on the default theme
(2014-09-19, 05:46 PM).m. Wrote: [ -> ]^ No, I used $REMOVED just to make it a null  .. but the modification clearly working for me on the default theme

but not for me on the default theme .... the div displays the stars but the js does not alter the value ....  can you show me your templates showthead and postbit so I can copy them exactly
^ sent PM with the code
(2014-09-19, 06:18 PM).m. Wrote: [ -> ]^ sent PM with the code

not got a pm yet ... however ... I'll wait to see if it arrives
^ looks like CloudFlare security ate it due to long php code !
anyway, see the postbit code => http://pastebin.com/89EDREL8
showthread => removed the ratethread variable
Pages: 1 2