4ngeluxpunk
New member
Good need your help, I tried to place my forum notification option, deputy capture: http://prntscr.com/ciyzq4.
To do that I created a plugin:
Hook: process_templates_complete
Execution Order: 5
With the following code:
And edit the template FORUMHOME changing this:
For this:
Then what I did is add the following script below: <title><vb:if condition="$title_note_count">({vb:raw bbuserinfo.notifications_total}) </vb:if>{vb:raw vboptions.bbtitle}</title>
Which is an Auto-Refresh script but not that reason I do not work that script; does not update the page title.
I need your help to make good the Auto-Refresh for Title X Page.
Thank you.
To do that I created a plugin:
Hook: process_templates_complete
Execution Order: 5
With the following code:
Code:
$currentuserid = $vbulletin->userinfo[userid];
$query = "SELECT * FROM user WHERE userid = $currentuserid";
$result = $vbulletin->db->query($query);
while($row = $vbulletin->db->fetch_array($result)) {
$a = $row['friendreqcount'];
$b = $row['vmunreadcount'];
$c = $row['socgroupinvitecount'];
$d = $row['socgroupreqcount'];
$e = $row['pcunreadcount'];
$f = $row['pmunread'];
$h = $row['recent_thankcnt'];
}
$title_note_count = $a + $b + $c + $d + $e + $f + $h;
$vbulletin->userinfo['notifications_total'] = $title_note_count;
vB_Template::preRegister('FORUMHOME',array('title_note_count' => $title_note_count));
vB_Template::preRegister('SHOWTHREAD',array('title_note_count' => $title_note_count));
vB_Template::preRegister('recent_thanks',array('title_note_count' => $title_note_count));
vB_Template::preRegister('FORUMDISPLAY',array('title_note_count' => $title_note_count));
vB_Template::preRegister('USERCP_SHELL',array('title_note_count' => $title_note_count));
vB_Template::preRegister('newthread',array('title_note_count' => $title_note_count));
vB_Template::preRegister('newreply',array('title_note_count' => $title_note_count));
And edit the template FORUMHOME changing this:
HTML:
<title>{vb:raw vboptions.bbtitle}</title>
For this:
HTML:
<title><vb:if condition="$title_note_count">({vb:raw bbuserinfo.notifications_total}) </vb:if>{vb:raw vboptions.bbtitle}</title>
Then what I did is add the following script below: <title><vb:if condition="$title_note_count">({vb:raw bbuserinfo.notifications_total}) </vb:if>{vb:raw vboptions.bbtitle}</title>
Code:
<script type="text/javascript">
setInterval(function() {
var data = "{vb:raw relpath}";
$.get(document.location.toString()).then(function (data){
//find and set the title of the page
document.title = data.match(/<title>(.+)<\/title>/)[1];
});
}, 30000);
setTimeout(function() {
var data = "{vb:raw relpath}";
$.get(document.location.toString()).then(function (data){
//find and set the title of the page
document.title = data.match(/<title>(.+)<\/title>/)[1];
});
}, 1000);
</script>
Which is an Auto-Refresh script but not that reason I do not work that script; does not update the page title.
I need your help to make good the Auto-Refresh for Title X Page.
Thank you.