2015-12-29, 09:27 AM
I would like to replace the post buttons (rate, report, etc) and moderation tools not to require javascript. How should this be done?
I had a look into the "general.js" and found out the button link.
general.js (only partial, the things related to Raputation):
So basically theĀ postbit_rep_button template should have this in it:
After that it works, but now I need to figure out how to get an delete reputation button aka dislike button created.
How can I add the custom button(s)?
I have created an template for the button called "postbit_rep_button_del". The template content:
My posbit template looks like this:
I had a look into the "general.js" and found out the button link.
general.js (only partial, the things related to Raputation):
reputation: function(uid, pid)
{
if(!pid)
{
var pid = 0;
}
MyBB.popupWindow("/reputation.php?action=add&uid="+uid+"&pid="+pid+"&modal=1");
},
deleteReputation: function(uid, rid)
{
$.prompt(delete_reputation_confirm, {
buttons:[
{title: yes_confirm, value: true},
{title: no_confirm, value: false}
],
submit: function(e,v,m,f){
if(v == true)
{
var form = $("<form />",
{
method: "post",
action: "reputation.php?action=delete",
style: "display: none;"
});
form.append(
$("<input />",
{
name: "rid",
type: "hidden",
value: rid
})
);
if(my_post_key)
{
form.append(
$("<input />",
{
name: "my_post_key",
type: "hidden",
value: my_post_key
})
);
}
form.append(
$("<input />",
{
name: "uid",
type: "hidden",
value: uid
})
);
$("body").append(form);
form.submit();
}
}
});
return false;
},
So basically theĀ postbit_rep_button template should have this in it:
<a href="/reputation.php?action=add&uid={$post['uid']}&pid={$post['pid']}&no_modal=1" title="{$lang->postbit_reputation_add}" class="postbit_reputation_add"><span>{$lang->postbit_button_reputation_add}</span></a>
After that it works, but now I need to figure out how to get an delete reputation button aka dislike button created.
How can I add the custom button(s)?
I have created an template for the button called "postbit_rep_button_del". The template content:
<a href="/reputation.php?action=delete&uid={$post['uid']}&pid={$post['pid']}&no_modal=1" title="{$lang->postbit_reputation_del}" class="postbit_reputation_del"><span>{$lang->postbit_button_reputation_del}</span></a>
My posbit template looks like this:
{$ignore_bit}
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<div class="post {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
<div class="post_author">
{$post['useravatar']}
<div class="author_information">
<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
<span class="smalltext">
{$post['usertitle']}<br />
{$post['userstars']}
{$post['groupimage']}
</span>
</div>
<div class="author_statistics">
{$post['user_details']}
</div>
</div>
<div class="post_content">
<div class="post_head">
{$post['posturl']}
{$post['icon']}
<span class="post_date">{$post['postdate']} <span class="post_edit" id="edited_by_{$post['pid']}">{$post['editedmsg']}</span></span>
{$post['subject_extra']}
</div>
<div class="post_body scaleimages" id="pid_{$post['pid']}">
{$post['message']}
</div>
{$post['attachments']}
{$post['signature']}
<div class="post_meta" id="post_meta_{$post['pid']}">
{$post['iplogged']}
</div>
</div>
<div class="post_controls">
<div class="postbit_buttons author_buttons float_left">
{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}{$post['button_rep']}{$post['button_rep_del']}
</div>
<div class="postbit_buttons post_management_buttons float_right">
{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quickrestore']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_purgespammer']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
</div>
</div>
</div>